mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'master' of git://github.com/php/php-src
This commit is contained in:
commit
4b43f5c533
47 changed files with 22836 additions and 17079 deletions
1
NEWS
1
NEWS
|
@ -98,6 +98,7 @@ PHP NEWS
|
||||||
. Fixed bug #73528 (Crash in zif_mb_send_mail). (Nikita)
|
. Fixed bug #73528 (Crash in zif_mb_send_mail). (Nikita)
|
||||||
. Fixed bug #74929 (mbstring functions version 7.1.1 are slow compared to 5.3
|
. Fixed bug #74929 (mbstring functions version 7.1.1 are slow compared to 5.3
|
||||||
on Windows). (Nikita)
|
on Windows). (Nikita)
|
||||||
|
. Update to Oniguruma 6.7.1. (cmb)
|
||||||
|
|
||||||
- ODBC:
|
- ODBC:
|
||||||
. Removed support for ODBCRouter. (Kalle)
|
. Removed support for ODBCRouter. (Kalle)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
The Win32 Build System.
|
The Win32 Build System.
|
||||||
|
|
||||||
See http://wiki.php.net/internals/windows/stepbystepbuild
|
See https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2
|
||||||
|
|
||||||
vim:tw=78:sw=1:ts=1:et
|
vim:tw=78:sw=1:ts=1:et
|
||||||
|
|
||||||
|
|
|
@ -4831,7 +4831,7 @@ PHP_FUNCTION(imagescale)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp_h <= 0 || tmp_w <= 0) {
|
if (tmp_h <= 0 || tmp_h > INT_MAX || tmp_w <= 0 || tmp_w > INT_MAX) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
ext/gd/tests/bug73957.phpt
Normal file
20
ext/gd/tests/bug73957.phpt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #73957 (signed integer conversion in imagescale())
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||||
|
if (PHP_INT_SIZE != 8) die('skip this test is for 64bit platforms only');
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$im = imagecreate(8, 8);
|
||||||
|
$im = imagescale($im, 0x100000001, 1);
|
||||||
|
var_dump($im);
|
||||||
|
if ($im) { // which is not supposed to happen
|
||||||
|
var_dump(imagesx($im));
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
===DONE===
|
||||||
|
--EXPECT--
|
||||||
|
bool(false)
|
||||||
|
===DONE===
|
|
@ -17,7 +17,7 @@ if (PHP_MBSTRING != "no") {
|
||||||
ADD_FLAG("CFLAGS_MBSTRING", "-Iext/mbstring/libmbfl -Iext/mbstring/libmbfl/mbfl \
|
ADD_FLAG("CFLAGS_MBSTRING", "-Iext/mbstring/libmbfl -Iext/mbstring/libmbfl/mbfl \
|
||||||
-Iext/mbstring/oniguruma /D NOT_RUBY=1 /D LIBMBFL_EXPORTS=1 \
|
-Iext/mbstring/oniguruma /D NOT_RUBY=1 /D LIBMBFL_EXPORTS=1 \
|
||||||
/D HAVE_STDARG_PROTOTYPES=1 /D HAVE_CONFIG_H /D HAVE_STDLIB_H \
|
/D HAVE_STDARG_PROTOTYPES=1 /D HAVE_CONFIG_H /D HAVE_STDLIB_H \
|
||||||
/D HAVE_STRICMP /D MBFL_DLL_EXPORT=1 /D EXPORT /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1")
|
/D HAVE_STRICMP /D MBFL_DLL_EXPORT=1 /D ONIGURUMA_EXPORT /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1")
|
||||||
|
|
||||||
FSO.CopyFile("ext\\mbstring\\libmbfl\\config.h.w32",
|
FSO.CopyFile("ext\\mbstring\\libmbfl\\config.h.w32",
|
||||||
"ext\\mbstring\\libmbfl\\config.h", true);
|
"ext\\mbstring\\libmbfl\\config.h", true);
|
||||||
|
|
|
@ -1,61 +1,28 @@
|
||||||
diff -wur oniguruma.orig/src/config.h.win32 oniguruma/src/config.h.win32
|
ext/mbstring/oniguruma/src/config.h.win32 | 1 +
|
||||||
--- oniguruma.orig/src/config.h.win32 2017-07-13 17:12:45.228068900 +0200
|
ext/mbstring/oniguruma/src/config.h.win64 | 1 +
|
||||||
+++ oniguruma/src/config.h.win32 2017-07-13 16:11:19.955226200 +0200
|
2 files changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/ext/mbstring/oniguruma/src/config.h.win32 b/ext/mbstring/oniguruma/src/config.h.win32
|
||||||
|
index bdbdaf25c1..9a9c43f26d 100644
|
||||||
|
--- a/ext/mbstring/oniguruma/src/config.h.win32
|
||||||
|
+++ b/ext/mbstring/oniguruma/src/config.h.win32
|
||||||
@@ -15,6 +15,7 @@
|
@@ -15,6 +15,7 @@
|
||||||
#define SIZEOF_VOIDP 4
|
#define SIZEOF_VOIDP 4
|
||||||
#define SIZEOF_FLOAT 4
|
#define SIZEOF_FLOAT 4
|
||||||
#define SIZEOF_DOUBLE 8
|
#define SIZEOF_DOUBLE 8
|
||||||
+#define SIZEOF_SIZE_T 4
|
+#define SIZEOF_SIZE_T 4
|
||||||
#define HAVE_PROTOTYPES 1
|
#define HAVE_PROTOTYPES 1
|
||||||
#define TOKEN_PASTE(x,y) x##y
|
#define TOKEN_PASTE(x,y) x##y
|
||||||
#define HAVE_STDARG_PROTOTYPES 1
|
#define HAVE_STDARG_PROTOTYPES 1
|
||||||
diff -wur oniguruma.orig/src/config.h.win64 oniguruma/src/config.h.win64
|
diff --git a/ext/mbstring/oniguruma/src/config.h.win64 b/ext/mbstring/oniguruma/src/config.h.win64
|
||||||
--- oniguruma.orig/src/config.h.win64 2017-07-13 17:12:45.273605000 +0200
|
index 01a86c7bb9..dec7b75773 100644
|
||||||
+++ oniguruma/src/config.h.win64 2017-07-13 16:11:19.957231300 +0200
|
--- a/ext/mbstring/oniguruma/src/config.h.win64
|
||||||
|
+++ b/ext/mbstring/oniguruma/src/config.h.win64
|
||||||
@@ -15,6 +15,7 @@
|
@@ -15,6 +15,7 @@
|
||||||
#define SIZEOF_VOIDP 8
|
#define SIZEOF_VOIDP 8
|
||||||
#define SIZEOF_FLOAT 4
|
#define SIZEOF_FLOAT 4
|
||||||
#define SIZEOF_DOUBLE 8
|
#define SIZEOF_DOUBLE 8
|
||||||
+#define SIZEOF_SIZE_T 8
|
+#define SIZEOF_SIZE_T 8
|
||||||
#define HAVE_PROTOTYPES 1
|
#define HAVE_PROTOTYPES 1
|
||||||
#define TOKEN_PASTE(x,y) x##y
|
#define TOKEN_PASTE(x,y) x##y
|
||||||
#define HAVE_STDARG_PROTOTYPES 1
|
#define HAVE_STDARG_PROTOTYPES 1
|
||||||
diff -wur oniguruma.orig/src/regint.h oniguruma/src/regint.h
|
|
||||||
--- oniguruma.orig/src/regint.h 2017-07-13 17:12:48.686073300 +0200
|
|
||||||
+++ oniguruma/src/regint.h 2017-07-13 17:13:28.032286100 +0200
|
|
||||||
@@ -201,17 +201,21 @@
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
/* sizeof(OnigCodePoint) */
|
|
||||||
+#ifdef SIZEOF_SIZE_T
|
|
||||||
+# define WORD_ALIGNMENT_SIZE SIZEOF_SIZE_T
|
|
||||||
+#else
|
|
||||||
#define WORD_ALIGNMENT_SIZE SIZEOF_LONG
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\
|
|
||||||
(pad_size) = WORD_ALIGNMENT_SIZE \
|
|
||||||
- - ((unsigned int )(addr) % WORD_ALIGNMENT_SIZE);\
|
|
||||||
+ - ((size_t)(addr) % WORD_ALIGNMENT_SIZE);\
|
|
||||||
if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define ALIGNMENT_RIGHT(addr) do {\
|
|
||||||
(addr) += (WORD_ALIGNMENT_SIZE - 1);\
|
|
||||||
- (addr) -= ((unsigned int )(addr) % WORD_ALIGNMENT_SIZE);\
|
|
||||||
+ (addr) -= ((size_t)(addr) % WORD_ALIGNMENT_SIZE);\
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#endif /* PLATFORM_UNALIGNED_WORD_ACCESS */
|
|
||||||
@@ -662,7 +666,11 @@
|
|
||||||
BBuf* mbuf; /* multi-byte info or NULL */
|
|
||||||
} CClassNode;
|
|
||||||
|
|
||||||
+#ifdef _WIN64
|
|
||||||
+typedef __int64 OnigStackIndex;
|
|
||||||
+#else
|
|
||||||
typedef long OnigStackIndex;
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
typedef struct _OnigStackType {
|
|
||||||
unsigned int type;
|
|
||||||
|
|
|
@ -1,5 +1,75 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
|
2018/01/26: Version 6.7.1
|
||||||
|
|
||||||
|
2018/01/25: disable USE_TRY_IN_MATCH_LIMIT by default
|
||||||
|
2018/01/24: implement mechanism of try-in-match-limit
|
||||||
|
2018/01/24: #76: rename EXPORT to ONIGURUMA_EXPORT
|
||||||
|
2018/01/15: #73: update for automake 1.15.1
|
||||||
|
2018/01/14: #74: update description of README
|
||||||
|
2018/01/10: #72: Correct spelling and grammar in FAQ (English)
|
||||||
|
2017/12/25: remove USE_COMBINATION_EXPLOSION_CHECK codes
|
||||||
|
|
||||||
|
2017/12/11: Version 6.7.0
|
||||||
|
|
||||||
|
2017/12/08: Disable \N and \O on ONIG_SYNTAX_RUBY
|
||||||
|
2017/12/08: add ONIG_SYNTAX_ONIGURUMA (default syntax)
|
||||||
|
2017/12/05: restructure StackType
|
||||||
|
2017/11/13: implement subexp calls (?R), (?&name), (?-n), (?+n) for Perl syntax
|
||||||
|
2017/09/25: use string pool of gperf for Unicode Property lookup function
|
||||||
|
2017/09/16: fix #70: an empty greedy regex and a word boundary (.*\b) fails
|
||||||
|
2017/09/13: remove a stack type STK_POS
|
||||||
|
2017/09/08: fix #69: add a declaration of onig_end()
|
||||||
|
2017/09/07: fix #68: Compilation failure in out-of-source build
|
||||||
|
2017/09/03: [new] hexadecimal codepoint \uHHHH
|
||||||
|
|
||||||
|
2017/08/30: Version 6.6.1
|
||||||
|
|
||||||
|
2017/08/29: fix definition of \X to (?>\O(?:\Y\O)*)
|
||||||
|
|
||||||
|
2017/08/28: Version 6.6.0
|
||||||
|
|
||||||
|
2017/08/26: fix #67: can't compile with Visual Studio 2005
|
||||||
|
2017/08/24: rename Absent clear to Range clear
|
||||||
|
2017/08/21: [new] Extended Grapheme Cluster \X and boundary \y, \Y
|
||||||
|
2017/08/17: fix: invalid index(ctype) value assigned to Unicode Block properties
|
||||||
|
2017/08/16: --enable-crnl-as-line-terminator to be deprecated
|
||||||
|
2017/08/15: [new] ASCII only mode options (?WDSP)
|
||||||
|
2017/08/14: [new] ONIG_OPTION_XXXX_IS_ASCII options
|
||||||
|
2017/08/11: disable OP_CCLASS_NODE
|
||||||
|
2017/08/11: [spec] Absent clear restore previous range value at backtrack
|
||||||
|
2017/08/07: optimize for simple one char repetition in Absent expression
|
||||||
|
2017/08/07: fix: invalid impl. for reluctant repetition in Absent expression
|
||||||
|
2017/08/04: remove compile switch USE_NAMED_GROUP
|
||||||
|
|
||||||
|
2017/08/03: Version 6.5.0
|
||||||
|
|
||||||
|
2017/07/30: [new] support Absent clear (Absent functions)
|
||||||
|
2017/07/25: abolish configure option: --enable-combination-explosion-check
|
||||||
|
2017/07/23: [new] support Absent functions (?~...)
|
||||||
|
2017/07/14: fix #65: SIZEOF_SIZE_T doesn't exist on certain architecutres
|
||||||
|
2017/07/11: [new] support \O (true anychar)
|
||||||
|
2017/07/10: [new] support \K (keep)
|
||||||
|
2017/07/10: add new node type: NODE_GIMMICK
|
||||||
|
2017/07/07: [new] support \N (no newline)
|
||||||
|
2017/07/05: [new] support \R (general newline)
|
||||||
|
2017/07/05: [new] support if-then-else syntax
|
||||||
|
2017/07/04: [new] support backref validity checker
|
||||||
|
|
||||||
|
2017/07/03: Version 6.4.0
|
||||||
|
|
||||||
|
2017/06/30: fix memory leaks
|
||||||
|
2017/06/29: fix memory leaks
|
||||||
|
2017/06/28: change encoding of doc/XXXX.ja from EUC-JP to UTF-8
|
||||||
|
2017/06/28: update doc/RE, and doc/RE.ja
|
||||||
|
2017/06/26: fix fatal bug of endless repeat check on Windows
|
||||||
|
2017/06/26: PR #62 : add check for return values
|
||||||
|
2017/06/23: [new] support call zero (\g{0})
|
||||||
|
2017/06/23: [new] support relative call by positive number
|
||||||
|
2017/06/23: [new] support relative back-reference by positive number
|
||||||
|
2017/06/15: fix #60 : check value type
|
||||||
|
2017/06/02: change output format for ONIG_DEBUG_COMPILE and ONIG_DEBUG_MATCH
|
||||||
|
|
||||||
2017/05/29: Version 6.3.0
|
2017/05/29: Version 6.3.0
|
||||||
|
|
||||||
2017/05/24: fix #60 : invalid state(CCS_VALUE) in parse_char_class()
|
2017/05/24: fix #60 : invalid state(CCS_VALUE) in parse_char_class()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Installation Instructions
|
Installation Instructions
|
||||||
*************************
|
*************************
|
||||||
|
|
||||||
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
|
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
|
||||||
Inc.
|
Foundation, Inc.
|
||||||
|
|
||||||
Copying and distribution of this file, with or without modification,
|
Copying and distribution of this file, with or without modification,
|
||||||
are permitted in any medium without royalty provided the copyright
|
are permitted in any medium without royalty provided the copyright
|
||||||
|
@ -12,97 +12,96 @@ without warranty of any kind.
|
||||||
Basic Installation
|
Basic Installation
|
||||||
==================
|
==================
|
||||||
|
|
||||||
Briefly, the shell command `./configure && make && make install'
|
Briefly, the shell command './configure && make && make install'
|
||||||
should configure, build, and install this package. The following
|
should configure, build, and install this package. The following
|
||||||
more-detailed instructions are generic; see the `README' file for
|
more-detailed instructions are generic; see the 'README' file for
|
||||||
instructions specific to this package. Some packages provide this
|
instructions specific to this package. Some packages provide this
|
||||||
`INSTALL' file but do not implement all of the features documented
|
'INSTALL' file but do not implement all of the features documented
|
||||||
below. The lack of an optional feature in a given package is not
|
below. The lack of an optional feature in a given package is not
|
||||||
necessarily a bug. More recommendations for GNU packages can be found
|
necessarily a bug. More recommendations for GNU packages can be found
|
||||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||||
|
|
||||||
The `configure' shell script attempts to guess correct values for
|
The 'configure' shell script attempts to guess correct values for
|
||||||
various system-dependent variables used during compilation. It uses
|
various system-dependent variables used during compilation. It uses
|
||||||
those values to create a `Makefile' in each directory of the package.
|
those values to create a 'Makefile' in each directory of the package.
|
||||||
It may also create one or more `.h' files containing system-dependent
|
It may also create one or more '.h' files containing system-dependent
|
||||||
definitions. Finally, it creates a shell script `config.status' that
|
definitions. Finally, it creates a shell script 'config.status' that
|
||||||
you can run in the future to recreate the current configuration, and a
|
you can run in the future to recreate the current configuration, and a
|
||||||
file `config.log' containing compiler output (useful mainly for
|
file 'config.log' containing compiler output (useful mainly for
|
||||||
debugging `configure').
|
debugging 'configure').
|
||||||
|
|
||||||
It can also use an optional file (typically called `config.cache'
|
It can also use an optional file (typically called 'config.cache' and
|
||||||
and enabled with `--cache-file=config.cache' or simply `-C') that saves
|
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||||
the results of its tests to speed up reconfiguring. Caching is
|
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||||
disabled by default to prevent problems with accidental use of stale
|
default to prevent problems with accidental use of stale cache files.
|
||||||
cache files.
|
|
||||||
|
|
||||||
If you need to do unusual things to compile the package, please try
|
If you need to do unusual things to compile the package, please try
|
||||||
to figure out how `configure' could check whether to do them, and mail
|
to figure out how 'configure' could check whether to do them, and mail
|
||||||
diffs or instructions to the address given in the `README' so they can
|
diffs or instructions to the address given in the 'README' so they can
|
||||||
be considered for the next release. If you are using the cache, and at
|
be considered for the next release. If you are using the cache, and at
|
||||||
some point `config.cache' contains results you don't want to keep, you
|
some point 'config.cache' contains results you don't want to keep, you
|
||||||
may remove or edit it.
|
may remove or edit it.
|
||||||
|
|
||||||
The file `configure.ac' (or `configure.in') is used to create
|
The file 'configure.ac' (or 'configure.in') is used to create
|
||||||
`configure' by a program called `autoconf'. You need `configure.ac' if
|
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||||
you want to change it or regenerate `configure' using a newer version
|
you want to change it or regenerate 'configure' using a newer version of
|
||||||
of `autoconf'.
|
'autoconf'.
|
||||||
|
|
||||||
The simplest way to compile this package is:
|
The simplest way to compile this package is:
|
||||||
|
|
||||||
1. `cd' to the directory containing the package's source code and type
|
1. 'cd' to the directory containing the package's source code and type
|
||||||
`./configure' to configure the package for your system.
|
'./configure' to configure the package for your system.
|
||||||
|
|
||||||
Running `configure' might take a while. While running, it prints
|
Running 'configure' might take a while. While running, it prints
|
||||||
some messages telling which features it is checking for.
|
some messages telling which features it is checking for.
|
||||||
|
|
||||||
2. Type `make' to compile the package.
|
2. Type 'make' to compile the package.
|
||||||
|
|
||||||
3. Optionally, type `make check' to run any self-tests that come with
|
3. Optionally, type 'make check' to run any self-tests that come with
|
||||||
the package, generally using the just-built uninstalled binaries.
|
the package, generally using the just-built uninstalled binaries.
|
||||||
|
|
||||||
4. Type `make install' to install the programs and any data files and
|
4. Type 'make install' to install the programs and any data files and
|
||||||
documentation. When installing into a prefix owned by root, it is
|
documentation. When installing into a prefix owned by root, it is
|
||||||
recommended that the package be configured and built as a regular
|
recommended that the package be configured and built as a regular
|
||||||
user, and only the `make install' phase executed with root
|
user, and only the 'make install' phase executed with root
|
||||||
privileges.
|
privileges.
|
||||||
|
|
||||||
5. Optionally, type `make installcheck' to repeat any self-tests, but
|
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||||
this time using the binaries in their final installed location.
|
this time using the binaries in their final installed location.
|
||||||
This target does not install anything. Running this target as a
|
This target does not install anything. Running this target as a
|
||||||
regular user, particularly if the prior `make install' required
|
regular user, particularly if the prior 'make install' required
|
||||||
root privileges, verifies that the installation completed
|
root privileges, verifies that the installation completed
|
||||||
correctly.
|
correctly.
|
||||||
|
|
||||||
6. You can remove the program binaries and object files from the
|
6. You can remove the program binaries and object files from the
|
||||||
source code directory by typing `make clean'. To also remove the
|
source code directory by typing 'make clean'. To also remove the
|
||||||
files that `configure' created (so you can compile the package for
|
files that 'configure' created (so you can compile the package for
|
||||||
a different kind of computer), type `make distclean'. There is
|
a different kind of computer), type 'make distclean'. There is
|
||||||
also a `make maintainer-clean' target, but that is intended mainly
|
also a 'make maintainer-clean' target, but that is intended mainly
|
||||||
for the package's developers. If you use it, you may have to get
|
for the package's developers. If you use it, you may have to get
|
||||||
all sorts of other programs in order to regenerate files that came
|
all sorts of other programs in order to regenerate files that came
|
||||||
with the distribution.
|
with the distribution.
|
||||||
|
|
||||||
7. Often, you can also type `make uninstall' to remove the installed
|
7. Often, you can also type 'make uninstall' to remove the installed
|
||||||
files again. In practice, not all packages have tested that
|
files again. In practice, not all packages have tested that
|
||||||
uninstallation works correctly, even though it is required by the
|
uninstallation works correctly, even though it is required by the
|
||||||
GNU Coding Standards.
|
GNU Coding Standards.
|
||||||
|
|
||||||
8. Some packages, particularly those that use Automake, provide `make
|
8. Some packages, particularly those that use Automake, provide 'make
|
||||||
distcheck', which can by used by developers to test that all other
|
distcheck', which can by used by developers to test that all other
|
||||||
targets like `make install' and `make uninstall' work correctly.
|
targets like 'make install' and 'make uninstall' work correctly.
|
||||||
This target is generally not run by end users.
|
This target is generally not run by end users.
|
||||||
|
|
||||||
Compilers and Options
|
Compilers and Options
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
Some systems require unusual options for compilation or linking that
|
Some systems require unusual options for compilation or linking that
|
||||||
the `configure' script does not know about. Run `./configure --help'
|
the 'configure' script does not know about. Run './configure --help'
|
||||||
for details on some of the pertinent environment variables.
|
for details on some of the pertinent environment variables.
|
||||||
|
|
||||||
You can give `configure' initial values for configuration parameters
|
You can give 'configure' initial values for configuration parameters
|
||||||
by setting variables in the command line or in the environment. Here
|
by setting variables in the command line or in the environment. Here is
|
||||||
is an example:
|
an example:
|
||||||
|
|
||||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||||
|
|
||||||
|
@ -113,21 +112,21 @@ Compiling For Multiple Architectures
|
||||||
|
|
||||||
You can compile the package for more than one kind of computer at the
|
You can compile the package for more than one kind of computer at the
|
||||||
same time, by placing the object files for each architecture in their
|
same time, by placing the object files for each architecture in their
|
||||||
own directory. To do this, you can use GNU `make'. `cd' to the
|
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||||
directory where you want the object files and executables to go and run
|
directory where you want the object files and executables to go and run
|
||||||
the `configure' script. `configure' automatically checks for the
|
the 'configure' script. 'configure' automatically checks for the source
|
||||||
source code in the directory that `configure' is in and in `..'. This
|
code in the directory that 'configure' is in and in '..'. This is known
|
||||||
is known as a "VPATH" build.
|
as a "VPATH" build.
|
||||||
|
|
||||||
With a non-GNU `make', it is safer to compile the package for one
|
With a non-GNU 'make', it is safer to compile the package for one
|
||||||
architecture at a time in the source code directory. After you have
|
architecture at a time in the source code directory. After you have
|
||||||
installed the package for one architecture, use `make distclean' before
|
installed the package for one architecture, use 'make distclean' before
|
||||||
reconfiguring for another architecture.
|
reconfiguring for another architecture.
|
||||||
|
|
||||||
On MacOS X 10.5 and later systems, you can create libraries and
|
On MacOS X 10.5 and later systems, you can create libraries and
|
||||||
executables that work on multiple system types--known as "fat" or
|
executables that work on multiple system types--known as "fat" or
|
||||||
"universal" binaries--by specifying multiple `-arch' options to the
|
"universal" binaries--by specifying multiple '-arch' options to the
|
||||||
compiler but only a single `-arch' option to the preprocessor. Like
|
compiler but only a single '-arch' option to the preprocessor. Like
|
||||||
this:
|
this:
|
||||||
|
|
||||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||||
|
@ -136,105 +135,104 @@ this:
|
||||||
|
|
||||||
This is not guaranteed to produce working output in all cases, you
|
This is not guaranteed to produce working output in all cases, you
|
||||||
may have to build one architecture at a time and combine the results
|
may have to build one architecture at a time and combine the results
|
||||||
using the `lipo' tool if you have problems.
|
using the 'lipo' tool if you have problems.
|
||||||
|
|
||||||
Installation Names
|
Installation Names
|
||||||
==================
|
==================
|
||||||
|
|
||||||
By default, `make install' installs the package's commands under
|
By default, 'make install' installs the package's commands under
|
||||||
`/usr/local/bin', include files under `/usr/local/include', etc. You
|
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||||
can specify an installation prefix other than `/usr/local' by giving
|
can specify an installation prefix other than '/usr/local' by giving
|
||||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
|
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||||
absolute file name.
|
absolute file name.
|
||||||
|
|
||||||
You can specify separate installation prefixes for
|
You can specify separate installation prefixes for
|
||||||
architecture-specific files and architecture-independent files. If you
|
architecture-specific files and architecture-independent files. If you
|
||||||
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
|
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||||
PREFIX as the prefix for installing programs and libraries.
|
PREFIX as the prefix for installing programs and libraries.
|
||||||
Documentation and other data files still use the regular prefix.
|
Documentation and other data files still use the regular prefix.
|
||||||
|
|
||||||
In addition, if you use an unusual directory layout you can give
|
In addition, if you use an unusual directory layout you can give
|
||||||
options like `--bindir=DIR' to specify different values for particular
|
options like '--bindir=DIR' to specify different values for particular
|
||||||
kinds of files. Run `configure --help' for a list of the directories
|
kinds of files. Run 'configure --help' for a list of the directories
|
||||||
you can set and what kinds of files go in them. In general, the
|
you can set and what kinds of files go in them. In general, the default
|
||||||
default for these options is expressed in terms of `${prefix}', so that
|
for these options is expressed in terms of '${prefix}', so that
|
||||||
specifying just `--prefix' will affect all of the other directory
|
specifying just '--prefix' will affect all of the other directory
|
||||||
specifications that were not explicitly provided.
|
specifications that were not explicitly provided.
|
||||||
|
|
||||||
The most portable way to affect installation locations is to pass the
|
The most portable way to affect installation locations is to pass the
|
||||||
correct locations to `configure'; however, many packages provide one or
|
correct locations to 'configure'; however, many packages provide one or
|
||||||
both of the following shortcuts of passing variable assignments to the
|
both of the following shortcuts of passing variable assignments to the
|
||||||
`make install' command line to change installation locations without
|
'make install' command line to change installation locations without
|
||||||
having to reconfigure or recompile.
|
having to reconfigure or recompile.
|
||||||
|
|
||||||
The first method involves providing an override variable for each
|
The first method involves providing an override variable for each
|
||||||
affected directory. For example, `make install
|
affected directory. For example, 'make install
|
||||||
prefix=/alternate/directory' will choose an alternate location for all
|
prefix=/alternate/directory' will choose an alternate location for all
|
||||||
directory configuration variables that were expressed in terms of
|
directory configuration variables that were expressed in terms of
|
||||||
`${prefix}'. Any directories that were specified during `configure',
|
'${prefix}'. Any directories that were specified during 'configure',
|
||||||
but not in terms of `${prefix}', must each be overridden at install
|
but not in terms of '${prefix}', must each be overridden at install time
|
||||||
time for the entire installation to be relocated. The approach of
|
for the entire installation to be relocated. The approach of makefile
|
||||||
makefile variable overrides for each directory variable is required by
|
variable overrides for each directory variable is required by the GNU
|
||||||
the GNU Coding Standards, and ideally causes no recompilation.
|
Coding Standards, and ideally causes no recompilation. However, some
|
||||||
However, some platforms have known limitations with the semantics of
|
platforms have known limitations with the semantics of shared libraries
|
||||||
shared libraries that end up requiring recompilation when using this
|
that end up requiring recompilation when using this method, particularly
|
||||||
method, particularly noticeable in packages that use GNU Libtool.
|
noticeable in packages that use GNU Libtool.
|
||||||
|
|
||||||
The second method involves providing the `DESTDIR' variable. For
|
The second method involves providing the 'DESTDIR' variable. For
|
||||||
example, `make install DESTDIR=/alternate/directory' will prepend
|
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||||
`/alternate/directory' before all installation names. The approach of
|
'/alternate/directory' before all installation names. The approach of
|
||||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
|
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||||
does not work on platforms that have drive letters. On the other hand,
|
does not work on platforms that have drive letters. On the other hand,
|
||||||
it does better at avoiding recompilation issues, and works well even
|
it does better at avoiding recompilation issues, and works well even
|
||||||
when some directory options were not specified in terms of `${prefix}'
|
when some directory options were not specified in terms of '${prefix}'
|
||||||
at `configure' time.
|
at 'configure' time.
|
||||||
|
|
||||||
Optional Features
|
Optional Features
|
||||||
=================
|
=================
|
||||||
|
|
||||||
If the package supports it, you can cause programs to be installed
|
If the package supports it, you can cause programs to be installed
|
||||||
with an extra prefix or suffix on their names by giving `configure' the
|
with an extra prefix or suffix on their names by giving 'configure' the
|
||||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||||
|
|
||||||
Some packages pay attention to `--enable-FEATURE' options to
|
Some packages pay attention to '--enable-FEATURE' options to
|
||||||
`configure', where FEATURE indicates an optional part of the package.
|
'configure', where FEATURE indicates an optional part of the package.
|
||||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||||
is something like `gnu-as' or `x' (for the X Window System). The
|
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||||
`README' should mention any `--enable-' and `--with-' options that the
|
'README' should mention any '--enable-' and '--with-' options that the
|
||||||
package recognizes.
|
package recognizes.
|
||||||
|
|
||||||
For packages that use the X Window System, `configure' can usually
|
For packages that use the X Window System, 'configure' can usually
|
||||||
find the X include and library files automatically, but if it doesn't,
|
find the X include and library files automatically, but if it doesn't,
|
||||||
you can use the `configure' options `--x-includes=DIR' and
|
you can use the 'configure' options '--x-includes=DIR' and
|
||||||
`--x-libraries=DIR' to specify their locations.
|
'--x-libraries=DIR' to specify their locations.
|
||||||
|
|
||||||
Some packages offer the ability to configure how verbose the
|
Some packages offer the ability to configure how verbose the
|
||||||
execution of `make' will be. For these packages, running `./configure
|
execution of 'make' will be. For these packages, running './configure
|
||||||
--enable-silent-rules' sets the default to minimal output, which can be
|
--enable-silent-rules' sets the default to minimal output, which can be
|
||||||
overridden with `make V=1'; while running `./configure
|
overridden with 'make V=1'; while running './configure
|
||||||
--disable-silent-rules' sets the default to verbose, which can be
|
--disable-silent-rules' sets the default to verbose, which can be
|
||||||
overridden with `make V=0'.
|
overridden with 'make V=0'.
|
||||||
|
|
||||||
Particular systems
|
Particular systems
|
||||||
==================
|
==================
|
||||||
|
|
||||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU
|
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||||
CC is not installed, it is recommended to use the following options in
|
is not installed, it is recommended to use the following options in
|
||||||
order to use an ANSI C compiler:
|
order to use an ANSI C compiler:
|
||||||
|
|
||||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||||
|
|
||||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||||
|
|
||||||
HP-UX `make' updates targets which have the same time stamps as
|
HP-UX 'make' updates targets which have the same time stamps as their
|
||||||
their prerequisites, which makes it generally unusable when shipped
|
prerequisites, which makes it generally unusable when shipped generated
|
||||||
generated files such as `configure' are involved. Use GNU `make'
|
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||||
instead.
|
|
||||||
|
|
||||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||||
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
|
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||||
a workaround. If GNU CC is not installed, it is therefore recommended
|
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||||
to try
|
try
|
||||||
|
|
||||||
./configure CC="cc"
|
./configure CC="cc"
|
||||||
|
|
||||||
|
@ -242,26 +240,26 @@ and if that doesn't work, try
|
||||||
|
|
||||||
./configure CC="cc -nodtk"
|
./configure CC="cc -nodtk"
|
||||||
|
|
||||||
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
|
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||||
directory contains several dysfunctional programs; working variants of
|
directory contains several dysfunctional programs; working variants of
|
||||||
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
|
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||||
in your `PATH', put it _after_ `/usr/bin'.
|
in your 'PATH', put it _after_ '/usr/bin'.
|
||||||
|
|
||||||
On Haiku, software installed for all users goes in `/boot/common',
|
On Haiku, software installed for all users goes in '/boot/common',
|
||||||
not `/usr/local'. It is recommended to use the following options:
|
not '/usr/local'. It is recommended to use the following options:
|
||||||
|
|
||||||
./configure --prefix=/boot/common
|
./configure --prefix=/boot/common
|
||||||
|
|
||||||
Specifying the System Type
|
Specifying the System Type
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
There may be some features `configure' cannot figure out
|
There may be some features 'configure' cannot figure out
|
||||||
automatically, but needs to determine by the type of machine the package
|
automatically, but needs to determine by the type of machine the package
|
||||||
will run on. Usually, assuming the package is built to be run on the
|
will run on. Usually, assuming the package is built to be run on the
|
||||||
_same_ architectures, `configure' can figure that out, but if it prints
|
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||||
a message saying it cannot guess the machine type, give it the
|
a message saying it cannot guess the machine type, give it the
|
||||||
`--build=TYPE' option. TYPE can either be a short name for the system
|
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||||
type, such as `sun4', or a canonical name which has the form:
|
type, such as 'sun4', or a canonical name which has the form:
|
||||||
|
|
||||||
CPU-COMPANY-SYSTEM
|
CPU-COMPANY-SYSTEM
|
||||||
|
|
||||||
|
@ -270,101 +268,101 @@ where SYSTEM can have one of these forms:
|
||||||
OS
|
OS
|
||||||
KERNEL-OS
|
KERNEL-OS
|
||||||
|
|
||||||
See the file `config.sub' for the possible values of each field. If
|
See the file 'config.sub' for the possible values of each field. If
|
||||||
`config.sub' isn't included in this package, then this package doesn't
|
'config.sub' isn't included in this package, then this package doesn't
|
||||||
need to know the machine type.
|
need to know the machine type.
|
||||||
|
|
||||||
If you are _building_ compiler tools for cross-compiling, you should
|
If you are _building_ compiler tools for cross-compiling, you should
|
||||||
use the option `--target=TYPE' to select the type of system they will
|
use the option '--target=TYPE' to select the type of system they will
|
||||||
produce code for.
|
produce code for.
|
||||||
|
|
||||||
If you want to _use_ a cross compiler, that generates code for a
|
If you want to _use_ a cross compiler, that generates code for a
|
||||||
platform different from the build platform, you should specify the
|
platform different from the build platform, you should specify the
|
||||||
"host" platform (i.e., that on which the generated programs will
|
"host" platform (i.e., that on which the generated programs will
|
||||||
eventually be run) with `--host=TYPE'.
|
eventually be run) with '--host=TYPE'.
|
||||||
|
|
||||||
Sharing Defaults
|
Sharing Defaults
|
||||||
================
|
================
|
||||||
|
|
||||||
If you want to set default values for `configure' scripts to share,
|
If you want to set default values for 'configure' scripts to share,
|
||||||
you can create a site shell script called `config.site' that gives
|
you can create a site shell script called 'config.site' that gives
|
||||||
default values for variables like `CC', `cache_file', and `prefix'.
|
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||||
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||||
`CONFIG_SITE' environment variable to the location of the site script.
|
'CONFIG_SITE' environment variable to the location of the site script.
|
||||||
A warning: not all `configure' scripts look for a site script.
|
A warning: not all 'configure' scripts look for a site script.
|
||||||
|
|
||||||
Defining Variables
|
Defining Variables
|
||||||
==================
|
==================
|
||||||
|
|
||||||
Variables not defined in a site shell script can be set in the
|
Variables not defined in a site shell script can be set in the
|
||||||
environment passed to `configure'. However, some packages may run
|
environment passed to 'configure'. However, some packages may run
|
||||||
configure again during the build, and the customized values of these
|
configure again during the build, and the customized values of these
|
||||||
variables may be lost. In order to avoid this problem, you should set
|
variables may be lost. In order to avoid this problem, you should set
|
||||||
them in the `configure' command line, using `VAR=value'. For example:
|
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||||
|
|
||||||
./configure CC=/usr/local2/bin/gcc
|
./configure CC=/usr/local2/bin/gcc
|
||||||
|
|
||||||
causes the specified `gcc' to be used as the C compiler (unless it is
|
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||||
overridden in the site shell script).
|
overridden in the site shell script).
|
||||||
|
|
||||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
|
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||||
an Autoconf limitation. Until the limitation is lifted, you can use
|
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||||
this workaround:
|
workaround:
|
||||||
|
|
||||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||||
|
|
||||||
`configure' Invocation
|
'configure' Invocation
|
||||||
======================
|
======================
|
||||||
|
|
||||||
`configure' recognizes the following options to control how it
|
'configure' recognizes the following options to control how it
|
||||||
operates.
|
operates.
|
||||||
|
|
||||||
`--help'
|
'--help'
|
||||||
`-h'
|
'-h'
|
||||||
Print a summary of all of the options to `configure', and exit.
|
Print a summary of all of the options to 'configure', and exit.
|
||||||
|
|
||||||
`--help=short'
|
'--help=short'
|
||||||
`--help=recursive'
|
'--help=recursive'
|
||||||
Print a summary of the options unique to this package's
|
Print a summary of the options unique to this package's
|
||||||
`configure', and exit. The `short' variant lists options used
|
'configure', and exit. The 'short' variant lists options used only
|
||||||
only in the top level, while the `recursive' variant lists options
|
in the top level, while the 'recursive' variant lists options also
|
||||||
also present in any nested packages.
|
present in any nested packages.
|
||||||
|
|
||||||
`--version'
|
'--version'
|
||||||
`-V'
|
'-V'
|
||||||
Print the version of Autoconf used to generate the `configure'
|
Print the version of Autoconf used to generate the 'configure'
|
||||||
script, and exit.
|
script, and exit.
|
||||||
|
|
||||||
`--cache-file=FILE'
|
'--cache-file=FILE'
|
||||||
Enable the cache: use and save the results of the tests in FILE,
|
Enable the cache: use and save the results of the tests in FILE,
|
||||||
traditionally `config.cache'. FILE defaults to `/dev/null' to
|
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||||
disable caching.
|
disable caching.
|
||||||
|
|
||||||
`--config-cache'
|
'--config-cache'
|
||||||
`-C'
|
'-C'
|
||||||
Alias for `--cache-file=config.cache'.
|
Alias for '--cache-file=config.cache'.
|
||||||
|
|
||||||
`--quiet'
|
'--quiet'
|
||||||
`--silent'
|
'--silent'
|
||||||
`-q'
|
'-q'
|
||||||
Do not print messages saying which checks are being made. To
|
Do not print messages saying which checks are being made. To
|
||||||
suppress all normal output, redirect it to `/dev/null' (any error
|
suppress all normal output, redirect it to '/dev/null' (any error
|
||||||
messages will still be shown).
|
messages will still be shown).
|
||||||
|
|
||||||
`--srcdir=DIR'
|
'--srcdir=DIR'
|
||||||
Look for the package's source code in directory DIR. Usually
|
Look for the package's source code in directory DIR. Usually
|
||||||
`configure' can determine that directory automatically.
|
'configure' can determine that directory automatically.
|
||||||
|
|
||||||
`--prefix=DIR'
|
'--prefix=DIR'
|
||||||
Use DIR as the installation prefix. *note Installation Names::
|
Use DIR as the installation prefix. *note Installation Names:: for
|
||||||
for more details, including other options available for fine-tuning
|
more details, including other options available for fine-tuning the
|
||||||
the installation locations.
|
installation locations.
|
||||||
|
|
||||||
`--no-create'
|
'--no-create'
|
||||||
`-n'
|
'-n'
|
||||||
Run the configure checks, but stop before creating any output
|
Run the configure checks, but stop before creating any output
|
||||||
files.
|
files.
|
||||||
|
|
||||||
`configure' also accepts some other, not widely useful, options. Run
|
'configure' also accepts some other, not widely useful, options. Run
|
||||||
`configure --help' for more details.
|
'configure --help' for more details.
|
||||||
|
|
|
@ -1,12 +1,30 @@
|
||||||
README 2016/05/06
|
README 2018/01/14
|
||||||
|
|
||||||
Oniguruma ---- (C) K.Kosako <kkosako0@gmail.com>
|
Oniguruma ---- (C) K.Kosako
|
||||||
|
|
||||||
https://github.com/kkos/oniguruma
|
https://github.com/kkos/oniguruma
|
||||||
|
|
||||||
Oniguruma is a regular expressions library.
|
FIXED Security Issues:
|
||||||
The characteristics of this library is that different character encoding
|
CVE-2017-9224, CVE-2017-9225, CVE-2017-9226
|
||||||
for every regular expression object can be specified.
|
CVE-2017-9227, CVE-2017-9228, CVE-2017-9229
|
||||||
|
|
||||||
|
---
|
||||||
|
Oniguruma is a modern and flexible regular expressions library. It
|
||||||
|
encompasses features from different regular expression implementations
|
||||||
|
that traditionally exist in different languages. It comes close to
|
||||||
|
being a complete superset of all regular expression features found
|
||||||
|
in other regular expression implementations.
|
||||||
|
|
||||||
|
Its features include:
|
||||||
|
* Character encoding can be specified per regular expression object.
|
||||||
|
* Several regular expression types are supported:
|
||||||
|
* POSIX
|
||||||
|
* Grep
|
||||||
|
* GNU Regex
|
||||||
|
* Perl
|
||||||
|
* Java
|
||||||
|
* Ruby
|
||||||
|
* Emacs
|
||||||
|
|
||||||
Supported character encodings:
|
Supported character encodings:
|
||||||
|
|
||||||
|
@ -174,16 +192,4 @@ Source Files
|
||||||
win32/config.h config.h for Win32
|
win32/config.h config.h for Win32
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ToDo
|
|
||||||
|
|
||||||
? case fold flag: Katakana <-> Hiragana.
|
|
||||||
? add ONIG_OPTION_NOTBOS/NOTEOS. (\A, \z, \Z)
|
|
||||||
?? \X (== \PM\pM*)
|
|
||||||
?? implement syntax behavior ONIG_SYN_CONTEXT_INDEP_ANCHORS.
|
|
||||||
?? transmission stopper. (return ONIG_STOP from match_at())
|
|
||||||
|
|
||||||
and I'm thankful to Akinori MUSHA.
|
and I'm thankful to Akinori MUSHA.
|
||||||
|
|
||||||
|
|
||||||
Mail Address: K.Kosako <kkosako0@gmail.com>
|
|
||||||
|
|
|
@ -3,9 +3,27 @@ Oniguruma
|
||||||
|
|
||||||
https://github.com/kkos/oniguruma
|
https://github.com/kkos/oniguruma
|
||||||
|
|
||||||
Oniguruma is a regular expressions library.
|
FIXED Security Issues:
|
||||||
The characteristics of this library is that different character encoding
|
--------------------------
|
||||||
for every regular expression object can be specified.
|
**CVE-2017-9224, CVE-2017-9225, CVE-2017-9226**
|
||||||
|
**CVE-2017-9227, CVE-2017-9228, CVE-2017-9229**
|
||||||
|
|
||||||
|
Oniguruma is a modern and flexible regular expressions library. It
|
||||||
|
encompasses features from different regular expression implementations
|
||||||
|
that traditionally exist in different languages. It comes close to
|
||||||
|
being a complete superset of all regular expression features found
|
||||||
|
in other regular expression implementations.
|
||||||
|
|
||||||
|
Its features include:
|
||||||
|
* Character encoding can be specified per regular expression object.
|
||||||
|
* Several regular expression types are supported:
|
||||||
|
* POSIX
|
||||||
|
* Grep
|
||||||
|
* GNU Regex
|
||||||
|
* Perl
|
||||||
|
* Java
|
||||||
|
* Ruby
|
||||||
|
* Emacs
|
||||||
|
|
||||||
Supported character encodings:
|
Supported character encodings:
|
||||||
|
|
||||||
|
@ -20,10 +38,61 @@ Supported character encodings:
|
||||||
* CP1251: contributed by Byte
|
* CP1251: contributed by Byte
|
||||||
|
|
||||||
|
|
||||||
|
New feature of version 6.7.1
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
* NEW: Mechanism of try-in-match-limit (* disabled by default)
|
||||||
|
|
||||||
|
|
||||||
|
New feature of version 6.7.0
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
* NEW: hexadecimal codepoint \uHHHH
|
||||||
|
* NEW: add ONIG_SYNTAX_ONIGURUMA (== ONIG_SYNTAX_DEFAULT)
|
||||||
|
* Disabled \N and \O on ONIG_SYNTAX_RUBY
|
||||||
|
* Reduced object size
|
||||||
|
|
||||||
|
|
||||||
|
New feature of version 6.6.1
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
* Fix definition of \X
|
||||||
|
|
||||||
|
|
||||||
|
New feature of version 6.6.0
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
* NEW: ASCII only mode options for character type/property (?WDSP)
|
||||||
|
* NEW: Extended Grapheme Cluster boundary \y, \Y (*original)
|
||||||
|
* NEW: Extended Grapheme Cluster \X
|
||||||
|
* Range-clear (Absent-clear) operator restores previous range in backtrack.
|
||||||
|
|
||||||
|
|
||||||
|
New feature of version 6.5.0
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
* NEW: \K (keep)
|
||||||
|
* NEW: \R (general newline) \N (no newline)
|
||||||
|
* NEW: \O (true anychar)
|
||||||
|
* NEW: if-then-else syntax (?(...)...\|...)
|
||||||
|
* NEW: Backreference validity checker (?(xxx)) (*original)
|
||||||
|
* NEW: Absent repeater (?~absent)
|
||||||
|
* NEW: Absent expression (?~|absent|expr) (*original)
|
||||||
|
* NEW: Absent stopper (?~|absent) (*original)
|
||||||
|
|
||||||
|
|
||||||
|
New feature of version 6.4.0
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
* Fix fatal problem of endless repeat on Windows
|
||||||
|
* NEW: call zero (call the total regexp) \g<0>
|
||||||
|
* NEW: relative backref/call by positive number \k<+n>, \g<+n>
|
||||||
|
|
||||||
|
|
||||||
New feature of version 6.3.0
|
New feature of version 6.3.0
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
* NEW SYNTAX: escape-o-brace for octal codepoint.
|
* NEW: octal codepoint \o{.....}
|
||||||
|
|
||||||
|
|
||||||
New feature of version 6.1.2
|
New feature of version 6.1.2
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
README.ja 2016/05/06
|
README.ja 2017/08/25
|
||||||
|
|
||||||
鬼車 ---- (C) K.Kosako <kkosako0@gmail.com>
|
鬼車 ---- (C) K.Kosako <kkosako0@gmail.com>
|
||||||
|
|
||||||
|
@ -180,16 +180,4 @@ https://github.com/kkos/oniguruma
|
||||||
win32/config.h Win32用 config.h
|
win32/config.h Win32用 config.h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
残件
|
|
||||||
|
|
||||||
? case fold flag: Katakana <-> Hiragana
|
|
||||||
? ONIG_OPTION_NOTBOS/NOTEOS追加 (\A, \z, \Z)
|
|
||||||
?? \X (== \PM\pM*)
|
|
||||||
?? 文法要素 ONIG_SYN_CONTEXT_INDEP_ANCHORSの実装
|
|
||||||
?? 検索位置移動停止演算子 (match_at()からONIG_STOPを返す)
|
|
||||||
|
|
||||||
and I'm thankful to Akinori MUSHA.
|
and I'm thankful to Akinori MUSHA.
|
||||||
|
|
||||||
|
|
||||||
アドレス: K.Kosako <kkosako0@gmail.com>
|
|
|
@ -1,4 +1,4 @@
|
||||||
Oniguruma API Version 6.1.0 2016/08/22
|
Oniguruma API Version 6.7.0 2017/12/08
|
||||||
|
|
||||||
#include <oniguruma.h>
|
#include <oniguruma.h>
|
||||||
|
|
||||||
|
@ -83,6 +83,16 @@ Oniguruma API Version 6.1.0 2016/08/22
|
||||||
ONIG_OPTION_DONT_CAPTURE_GROUP only named group captured.
|
ONIG_OPTION_DONT_CAPTURE_GROUP only named group captured.
|
||||||
ONIG_OPTION_CAPTURE_GROUP named and no-named group captured.
|
ONIG_OPTION_CAPTURE_GROUP named and no-named group captured.
|
||||||
|
|
||||||
|
ONIG_OPTION_WORD_IS_ASCII ASCII only word (\w, \p{Word}, [[:word:]])
|
||||||
|
ASCII only word bound (\b)
|
||||||
|
ONIG_OPTION_DIGIT_IS_ASCII ASCII only digit (\d, \p{Digit}, [[:digit:]])
|
||||||
|
ONIG_OPTION_SPACE_IS_ASCII ASCII only space (\s, \p{Space}, [[:space:]])
|
||||||
|
ONIG_OPTION_POSIX_IS_ASCII ASCII only POSIX properties
|
||||||
|
(includes word, digit, space)
|
||||||
|
(alnum, alpha, blank, cntrl, digit, graph,
|
||||||
|
lower, print, punct, space, upper, xdigit,
|
||||||
|
word)
|
||||||
|
|
||||||
5 enc: character encoding.
|
5 enc: character encoding.
|
||||||
|
|
||||||
ONIG_ENCODING_ASCII ASCII
|
ONIG_ENCODING_ASCII ASCII
|
||||||
|
@ -130,7 +140,8 @@ Oniguruma API Version 6.1.0 2016/08/22
|
||||||
ONIG_SYNTAX_PERL Perl
|
ONIG_SYNTAX_PERL Perl
|
||||||
ONIG_SYNTAX_PERL_NG Perl + named group
|
ONIG_SYNTAX_PERL_NG Perl + named group
|
||||||
ONIG_SYNTAX_RUBY Ruby
|
ONIG_SYNTAX_RUBY Ruby
|
||||||
ONIG_SYNTAX_DEFAULT default (== Ruby)
|
ONIG_SYNTAX_ONIGURUMA Oniguruma
|
||||||
|
ONIG_SYNTAX_DEFAULT default (== ONIG_SYNTAX_ONIGURUMA)
|
||||||
onig_set_default_syntax()
|
onig_set_default_syntax()
|
||||||
|
|
||||||
or any OnigSyntaxType data address defined by user.
|
or any OnigSyntaxType data address defined by user.
|
||||||
|
|
|
@ -1,89 +1,98 @@
|
||||||
鬼車インターフェース Version 6.1.0 2016/08/22
|
鬼車インターフェース Version 6.7.0 2017/12/08
|
||||||
|
|
||||||
#include <oniguruma.h>
|
#include <oniguruma.h>
|
||||||
|
|
||||||
|
|
||||||
# int onig_initialize(OnigEncoding use_encodings[], int num_encodings)
|
# int onig_initialize(OnigEncoding use_encodings[], int num_encodings)
|
||||||
|
|
||||||
ライブラリの初期化
|
ライブラリの初期化
|
||||||
最初に呼び出す必要がある。
|
最初に呼び出す必要がある。
|
||||||
|
|
||||||
* onig_init() は廃止
|
* onig_init() は廃止
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 use_encodings: 使用する文字エンコーディングの配列
|
1 use_encodings: 使用する文字エンコーディングの配列
|
||||||
2 num_encodings: 文字エンコーディングの数
|
2 num_encodings: 文字エンコーディングの数
|
||||||
|
|
||||||
|
|
||||||
# int onig_error_code_to_str(UChar* err_buf, int err_code, ...)
|
# int onig_error_code_to_str(UChar* err_buf, int err_code, ...)
|
||||||
|
|
||||||
エラーメッセージを取得する。
|
エラーメッセージを取得する。
|
||||||
|
|
||||||
この関数を、onig_new()の結果に対して呼び出す場合には、onig_new()のpattern引数を
|
この関数を、onig_new()の結果に対して呼び出す場合には、onig_new()のpattern引数を
|
||||||
メモリ解放するよりも前に呼び出さなければならない。
|
メモリ解放するよりも前に呼び出さなければならない。
|
||||||
|
|
||||||
正常終了戻り値: エラーメッセージ文字列のバイト長
|
正常終了戻り値: エラーメッセージ文字列のバイト長
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 err_buf: エラーメッセージを格納する領域
|
1 err_buf: エラーメッセージを格納する領域
|
||||||
(必要なサイズ: ONIG_MAX_ERROR_MESSAGE_LEN)
|
(必要なサイズ: ONIG_MAX_ERROR_MESSAGE_LEN)
|
||||||
2 err_code: エラーコード
|
2 err_code: エラーコード
|
||||||
3 err_info (optional): onig_new()のerr_info
|
3 err_info (optional): onig_new()のerr_info
|
||||||
|
|
||||||
|
|
||||||
# void onig_set_warn_func(OnigWarnFunc func)
|
# void onig_set_warn_func(OnigWarnFunc func)
|
||||||
|
|
||||||
警告通知関数をセットする。
|
警告通知関数をセットする。
|
||||||
|
|
||||||
警告:
|
警告:
|
||||||
'[', '-', ']' in character class without escape.
|
'[', '-', ']' in character class without escape.
|
||||||
']' in pattern without escape.
|
']' in pattern without escape.
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 func: 警告関数 void (*func)(char* warning_message)
|
1 func: 警告関数 void (*func)(char* warning_message)
|
||||||
|
|
||||||
|
|
||||||
# void onig_set_verb_warn_func(OnigWarnFunc func)
|
# void onig_set_verb_warn_func(OnigWarnFunc func)
|
||||||
|
|
||||||
詳細警告通知関数をセットする。
|
詳細警告通知関数をセットする。
|
||||||
|
|
||||||
詳細警告:
|
詳細警告:
|
||||||
redundant nested repeat operator.
|
redundant nested repeat operator.
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 func: 詳細警告関数 void (*func)(char* warning_message)
|
1 func: 詳細警告関数 void (*func)(char* warning_message)
|
||||||
|
|
||||||
|
|
||||||
# int onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
# int onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
||||||
OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax,
|
OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax,
|
||||||
OnigErrorInfo* err_info)
|
OnigErrorInfo* err_info)
|
||||||
|
|
||||||
正規表現オブジェクト(regex)を作成する。
|
正規表現オブジェクト(regex)を作成する。
|
||||||
|
|
||||||
正常終了戻り値: ONIG_NORMAL
|
正常終了戻り値: ONIG_NORMAL
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 作成された正規表現オブジェクトを返すアドレス
|
1 reg: 作成された正規表現オブジェクトを返すアドレス
|
||||||
2 pattern: 正規表現パターン文字列
|
2 pattern: 正規表現パターン文字列
|
||||||
3 pattern_end: 正規表現パターン文字列の終端アドレス(pattern + pattern length)
|
3 pattern_end: 正規表現パターン文字列の終端アドレス(pattern + pattern length)
|
||||||
4 option: 正規表現コンパイル時オプション
|
4 option: 正規表現コンパイル時オプション
|
||||||
|
|
||||||
ONIG_OPTION_NONE オプションなし
|
ONIG_OPTION_NONE オプションなし
|
||||||
ONIG_OPTION_SINGLELINE '^' -> '\A', '$' -> '\Z'
|
ONIG_OPTION_SINGLELINE '^' -> '\A', '$' -> '\Z'
|
||||||
ONIG_OPTION_MULTILINE '.'が改行にマッチする
|
ONIG_OPTION_MULTILINE '.'が改行にマッチする
|
||||||
ONIG_OPTION_IGNORECASE 曖昧マッチ オン
|
ONIG_OPTION_IGNORECASE 曖昧マッチ オン
|
||||||
ONIG_OPTION_EXTEND パターン拡張形式
|
ONIG_OPTION_EXTEND パターン拡張形式
|
||||||
ONIG_OPTION_FIND_LONGEST 最長マッチ
|
ONIG_OPTION_FIND_LONGEST 最長マッチ
|
||||||
ONIG_OPTION_FIND_NOT_EMPTY 空マッチを無視
|
ONIG_OPTION_FIND_NOT_EMPTY 空マッチを無視
|
||||||
ONIG_OPTION_NEGATE_SINGLELINE
|
ONIG_OPTION_NEGATE_SINGLELINE
|
||||||
ONIG_SYNTAX_POSIX_BASIC, ONIG_SYNTAX_POSIX_EXTENDED,
|
ONIG_SYNTAX_POSIX_BASIC, ONIG_SYNTAX_POSIX_EXTENDED,
|
||||||
ONIG_SYNTAX_PERL, ONIG_SYNTAX_PERL_NG, ONIG_SYNTAX_JAVAで
|
ONIG_SYNTAX_PERL, ONIG_SYNTAX_PERL_NG, ONIG_SYNTAX_JAVAで
|
||||||
デフォルトで有効なONIG_OPTION_SINGLELINEをクリアする。
|
デフォルトで有効なONIG_OPTION_SINGLELINEをクリアする。
|
||||||
|
|
||||||
ONIG_OPTION_DONT_CAPTURE_GROUP 名前付き捕獲式集合のみ捕獲
|
ONIG_OPTION_DONT_CAPTURE_GROUP 名前付き捕獲式集合のみ捕獲
|
||||||
ONIG_OPTION_CAPTURE_GROUP 名前無し捕獲式集合も捕獲
|
ONIG_OPTION_CAPTURE_GROUP 名前無し捕獲式集合も捕獲
|
||||||
|
ONIG_OPTION_WORD_IS_ASCII wordがASCIIのみ (\w, \p{Word}, [[:word:]])
|
||||||
|
word boundがASCIIのみ (\b)
|
||||||
|
ONIG_OPTION_DIGIT_IS_ASCII digitがASCIIのみ (\d, \p{Digit}, [[:digit:]])
|
||||||
|
ONIG_OPTION_SPACE_IS_ASCII spaceがASCIIのみ (\s, \p{Space}, [[:space:]])
|
||||||
|
ONIG_OPTION_POSIX_IS_ASCII POSIXプロパティがASCIIのみ
|
||||||
|
(word, digit, spaceを全て含んでいる)
|
||||||
|
(alnum, alpha, blank, cntrl, digit, graph,
|
||||||
|
lower, print, punct, space, upper, xdigit,
|
||||||
|
word)
|
||||||
|
|
||||||
5 enc: 文字エンコーディング
|
5 enc: 文字エンコーディング
|
||||||
|
|
||||||
ONIG_ENCODING_ASCII ASCII
|
ONIG_ENCODING_ASCII ASCII
|
||||||
ONIG_ENCODING_ISO_8859_1 ISO 8859-1
|
ONIG_ENCODING_ISO_8859_1 ISO 8859-1
|
||||||
|
@ -116,9 +125,9 @@
|
||||||
ONIG_ENCODING_BIG5 Big5
|
ONIG_ENCODING_BIG5 Big5
|
||||||
ONIG_ENCODING_GB18030 GB18030
|
ONIG_ENCODING_GB18030 GB18030
|
||||||
|
|
||||||
または、ユーザが定義したOnigEncodingTypeデータのアドレス
|
または、ユーザが定義したOnigEncodingTypeデータのアドレス
|
||||||
|
|
||||||
6 syntax: 正規表現パターン文法定義
|
6 syntax: 正規表現パターン文法定義
|
||||||
|
|
||||||
ONIG_SYNTAX_ASIS plain text
|
ONIG_SYNTAX_ASIS plain text
|
||||||
ONIG_SYNTAX_POSIX_BASIC POSIX Basic RE
|
ONIG_SYNTAX_POSIX_BASIC POSIX Basic RE
|
||||||
|
@ -128,15 +137,16 @@
|
||||||
ONIG_SYNTAX_GNU_REGEX GNU regex
|
ONIG_SYNTAX_GNU_REGEX GNU regex
|
||||||
ONIG_SYNTAX_JAVA Java (Sun java.util.regex)
|
ONIG_SYNTAX_JAVA Java (Sun java.util.regex)
|
||||||
ONIG_SYNTAX_PERL Perl
|
ONIG_SYNTAX_PERL Perl
|
||||||
ONIG_SYNTAX_PERL_NG Perl + 名前付き捕獲式集合
|
ONIG_SYNTAX_PERL_NG Perl + 名前付き捕獲式集合
|
||||||
ONIG_SYNTAX_RUBY Ruby
|
ONIG_SYNTAX_RUBY Ruby
|
||||||
ONIG_SYNTAX_DEFAULT default (== Ruby)
|
ONIG_SYNTAX_ONIGURUMA Oniguruma
|
||||||
|
ONIG_SYNTAX_DEFAULT default (== ONIG_SYNTAX_ONIGURUMA)
|
||||||
onig_set_default_syntax()
|
onig_set_default_syntax()
|
||||||
|
|
||||||
または、ユーザが定義したOnigSyntaxTypeデータのアドレス
|
または、ユーザが定義したOnigSyntaxTypeデータのアドレス
|
||||||
|
|
||||||
7 err_info: エラー情報を返すためのアドレス
|
7 err_info: エラー情報を返すためのアドレス
|
||||||
onig_error_code_to_str()の三番目の引数として使用する
|
onig_error_code_to_str()の三番目の引数として使用する
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,44 +155,44 @@
|
||||||
OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax,
|
OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax,
|
||||||
OnigErrorInfo* err_info)
|
OnigErrorInfo* err_info)
|
||||||
|
|
||||||
正規表現オブジェクト(regex)を作成する。
|
正規表現オブジェクト(regex)を作成する。
|
||||||
regの領域を内部で割り当てない。
|
regの領域を内部で割り当てない。
|
||||||
|
|
||||||
正常終了戻り値: ONIG_NORMAL
|
正常終了戻り値: ONIG_NORMAL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
# int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
||||||
OnigCompileInfo* ci, OnigErrorInfo* einfo)
|
OnigCompileInfo* ci, OnigErrorInfo* einfo)
|
||||||
|
|
||||||
正規表現オブジェクト(regex)を作成する。
|
正規表現オブジェクト(regex)を作成する。
|
||||||
この関数は、onig_new()のデラックス版。
|
この関数は、onig_new()のデラックス版。
|
||||||
|
|
||||||
正常終了戻り値: ONIG_NORMAL
|
正常終了戻り値: ONIG_NORMAL
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 作成された正規表現オブジェクトを返すアドレス
|
1 reg: 作成された正規表現オブジェクトを返すアドレス
|
||||||
2 pattern: 正規表現パターン文字列
|
2 pattern: 正規表現パターン文字列
|
||||||
3 pattern_end: 正規表現パターン文字列の終端アドレス(pattern + pattern length)
|
3 pattern_end: 正規表現パターン文字列の終端アドレス(pattern + pattern length)
|
||||||
4 ci: コンパイル情報
|
4 ci: コンパイル情報
|
||||||
|
|
||||||
ci->num_of_elements: ciの要素数 (現在の版では: 5)
|
ci->num_of_elements: ciの要素数 (現在の版では: 5)
|
||||||
ci->pattern_enc: パターン文字列の文字エンコーディング
|
ci->pattern_enc: パターン文字列の文字エンコーディング
|
||||||
ci->target_enc: 対象文字列の文字エンコーディング
|
ci->target_enc: 対象文字列の文字エンコーディング
|
||||||
ci->syntax: 正規表現パターン文法定義
|
ci->syntax: 正規表現パターン文法定義
|
||||||
ci->option: 正規表現コンパイル時オプション
|
ci->option: 正規表現コンパイル時オプション
|
||||||
ci->case_fold_flag: ONIG_OPTION_IGNORECASEモードでの
|
ci->case_fold_flag: ONIG_OPTION_IGNORECASEモードでの
|
||||||
文字曖昧マッチ指定ビットフラグ
|
文字曖昧マッチ指定ビットフラグ
|
||||||
|
|
||||||
ONIGENC_CASE_FOLD_MIN: 最小
|
ONIGENC_CASE_FOLD_MIN: 最小
|
||||||
ONIGENC_CASE_FOLD_DEFAULT: 最小
|
ONIGENC_CASE_FOLD_DEFAULT: 最小
|
||||||
onig_set_default_case_fold_flag()
|
onig_set_default_case_fold_flag()
|
||||||
|
|
||||||
5 err_info: エラー情報を返すためのアドレス
|
5 err_info: エラー情報を返すためのアドレス
|
||||||
onig_error_code_to_str()の三番目の引数として使用する
|
onig_error_code_to_str()の三番目の引数として使用する
|
||||||
|
|
||||||
|
|
||||||
異なる文字エンコーディングの組み合わせは、以下の場合にのみ許される。
|
異なる文字エンコーディングの組み合わせは、以下の場合にのみ許される。
|
||||||
|
|
||||||
pattern_enc: ASCII, ISO_8859_1
|
pattern_enc: ASCII, ISO_8859_1
|
||||||
target_enc: UTF16_BE, UTF16_LE, UTF32_BE, UTF32_LE
|
target_enc: UTF16_BE, UTF16_LE, UTF32_BE, UTF32_LE
|
||||||
|
@ -196,64 +206,64 @@
|
||||||
|
|
||||||
# void onig_free(regex_t* reg)
|
# void onig_free(regex_t* reg)
|
||||||
|
|
||||||
正規表現オブジェクトのメモリを解放する。
|
正規表現オブジェクトのメモリを解放する。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
|
|
||||||
|
|
||||||
# void onig_free_body(regex_t* reg)
|
# void onig_free_body(regex_t* reg)
|
||||||
|
|
||||||
正規表現オブジェクトのメモリを解放する。(reg自身の領域を除いて)
|
正規表現オブジェクトのメモリを解放する。(reg自身の領域を除いて)
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start,
|
# int onig_search(regex_t* reg, const UChar* str, const UChar* end, const UChar* start,
|
||||||
const UChar* range, OnigRegion* region, OnigOptionType option)
|
const UChar* range, OnigRegion* region, OnigOptionType option)
|
||||||
|
|
||||||
正規表現で文字列を検索し、検索結果とマッチ領域を返す。
|
正規表現で文字列を検索し、検索結果とマッチ領域を返す。
|
||||||
|
|
||||||
正常終了戻り値: マッチ位置 (p - str >= 0)
|
正常終了戻り値: マッチ位置 (p - str >= 0)
|
||||||
検索失敗: ONIG_MISMATCH (< 0)
|
検索失敗: ONIG_MISMATCH (< 0)
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
2 str: 検索対象文字列
|
2 str: 検索対象文字列
|
||||||
3 end: 検索対象文字列の終端アドレス
|
3 end: 検索対象文字列の終端アドレス
|
||||||
4 start: 検索対象文字列の検索先頭位置アドレス
|
4 start: 検索対象文字列の検索先頭位置アドレス
|
||||||
5 range: 検索対象文字列の検索終了位置アドレス
|
5 range: 検索対象文字列の検索終了位置アドレス
|
||||||
前方探索 (start <= 探索される文字列 < range)
|
前方探索 (start <= 探索される文字列 < range)
|
||||||
後方探索 (range <= 探索される文字列 <= start)
|
後方探索 (range <= 探索される文字列 <= start)
|
||||||
6 region: マッチ領域情報(region) (NULLも許される)
|
6 region: マッチ領域情報(region) (NULLも許される)
|
||||||
7 option: 検索時オプション
|
7 option: 検索時オプション
|
||||||
|
|
||||||
ONIG_OPTION_NOTBOL 文字列の先頭(str)を行頭と看做さない
|
ONIG_OPTION_NOTBOL 文字列の先頭(str)を行頭と看做さない
|
||||||
ONIG_OPTION_NOTEOL 文字列の終端(end)を行末と看做さない
|
ONIG_OPTION_NOTEOL 文字列の終端(end)を行末と看做さない
|
||||||
ONIG_OPTION_POSIX_REGION region引数をPOSIX APIのregmatch_t[]にする
|
ONIG_OPTION_POSIX_REGION region引数をPOSIX APIのregmatch_t[]にする
|
||||||
|
|
||||||
|
|
||||||
# int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at,
|
# int onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at,
|
||||||
OnigRegion* region, OnigOptionType option)
|
OnigRegion* region, OnigOptionType option)
|
||||||
|
|
||||||
文字列の指定位置でマッチングを行い、結果とマッチ領域を返す。
|
文字列の指定位置でマッチングを行い、結果とマッチ領域を返す。
|
||||||
|
|
||||||
正常終了戻り値: マッチしたバイト長 (>= 0)
|
正常終了戻り値: マッチしたバイト長 (>= 0)
|
||||||
not match: ONIG_MISMATCH ( < 0)
|
not match: ONIG_MISMATCH ( < 0)
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
2 str: 検索対象文字列
|
2 str: 検索対象文字列
|
||||||
3 end: 検索対象文字列の終端アドレス
|
3 end: 検索対象文字列の終端アドレス
|
||||||
4 at: 検索対象文字列の検索アドレス
|
4 at: 検索対象文字列の検索アドレス
|
||||||
5 region: マッチ領域情報(region) (NULLも許される)
|
5 region: マッチ領域情報(region) (NULLも許される)
|
||||||
6 option: 検索時オプション
|
6 option: 検索時オプション
|
||||||
|
|
||||||
ONIG_OPTION_NOTBOL 文字列の先頭(str)を行頭と看做さない
|
ONIG_OPTION_NOTBOL 文字列の先頭(str)を行頭と看做さない
|
||||||
ONIG_OPTION_NOTEOL 文字列の終端(end)を行末と看做さない
|
ONIG_OPTION_NOTEOL 文字列の終端(end)を行末と看做さない
|
||||||
ONIG_OPTION_POSIX_REGION region引数をPOSIX APIのregmatch_t[]にする
|
ONIG_OPTION_POSIX_REGION region引数をPOSIX APIのregmatch_t[]にする
|
||||||
|
|
||||||
|
|
||||||
# int onig_scan(regex_t* reg, const UChar* str, const UChar* end,
|
# int onig_scan(regex_t* reg, const UChar* str, const UChar* end,
|
||||||
|
@ -261,127 +271,127 @@
|
||||||
int (*scan_callback)(int, int, OnigRegion*, void*),
|
int (*scan_callback)(int, int, OnigRegion*, void*),
|
||||||
void* callback_arg)
|
void* callback_arg)
|
||||||
|
|
||||||
正規表現で文字列をスキャンして、マッチングする毎にコールバック関数を呼び出す。
|
正規表現で文字列をスキャンして、マッチングする毎にコールバック関数を呼び出す。
|
||||||
|
|
||||||
正常終了: マッチ回数 (0回も含める)
|
正常終了: マッチ回数 (0回も含める)
|
||||||
エラー: エラーコード (< 0)
|
エラー: エラーコード (< 0)
|
||||||
中断: コールバック関数が0以外の戻り値を返したとき、その値を戻り値として中断
|
中断: コールバック関数が0以外の戻り値を返したとき、その値を戻り値として中断
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
2 str: 検索対象文字列
|
2 str: 検索対象文字列
|
||||||
3 end: 検索対象文字列の終端アドレス
|
3 end: 検索対象文字列の終端アドレス
|
||||||
4 region: マッチ領域情報(region) (NULLも許される)
|
4 region: マッチ領域情報(region) (NULLも許される)
|
||||||
5 option: 検索時オプション
|
5 option: 検索時オプション
|
||||||
6 scan_callback: コールバック関数
|
6 scan_callback: コールバック関数
|
||||||
7 callback_arg: コールバック関数に渡される付加引数値
|
7 callback_arg: コールバック関数に渡される付加引数値
|
||||||
|
|
||||||
|
|
||||||
# OnigRegion* onig_region_new(void)
|
# OnigRegion* onig_region_new(void)
|
||||||
|
|
||||||
マッチ領域情報(region)を作成する。
|
マッチ領域情報(region)を作成する。
|
||||||
|
|
||||||
|
|
||||||
# void onig_region_free(OnigRegion* region, int free_self)
|
# void onig_region_free(OnigRegion* region, int free_self)
|
||||||
|
|
||||||
マッチ領域情報(region)で使用されているメモリを解放する。
|
マッチ領域情報(region)で使用されているメモリを解放する。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 region: マッチ領域情報オブジェクト
|
1 region: マッチ領域情報オブジェクト
|
||||||
2 free_self: [1: region自身を含めて全て解放, 0: region自身は解放しない]
|
2 free_self: [1: region自身を含めて全て解放, 0: region自身は解放しない]
|
||||||
|
|
||||||
|
|
||||||
# void onig_region_copy(OnigRegion* to, OnigRegion* from)
|
# void onig_region_copy(OnigRegion* to, OnigRegion* from)
|
||||||
|
|
||||||
マッチ領域情報(region)を複製する。
|
マッチ領域情報(region)を複製する。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 to: 対象領域
|
1 to: 対象領域
|
||||||
2 from: 元領域
|
2 from: 元領域
|
||||||
|
|
||||||
|
|
||||||
# void onig_region_clear(OnigRegion* region)
|
# void onig_region_clear(OnigRegion* region)
|
||||||
|
|
||||||
マッチ領域情報(region)の中味をクリアする。
|
マッチ領域情報(region)の中味をクリアする。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 region: 対象領域
|
1 region: 対象領域
|
||||||
|
|
||||||
|
|
||||||
# int onig_region_resize(OnigRegion* region, int n)
|
# int onig_region_resize(OnigRegion* region, int n)
|
||||||
|
|
||||||
マッチ領域情報(region)の捕獲式集合(グループ)数を変更する。
|
マッチ領域情報(region)の捕獲式集合(グループ)数を変更する。
|
||||||
|
|
||||||
正常終了戻り値: ONIG_NORMAL
|
正常終了戻り値: ONIG_NORMAL
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 region: 対象領域
|
1 region: 対象領域
|
||||||
2 n: 新しいサイズ
|
2 n: 新しいサイズ
|
||||||
|
|
||||||
|
|
||||||
# int onig_name_to_group_numbers(regex_t* reg, const UChar* name, const UChar* name_end,
|
# int onig_name_to_group_numbers(regex_t* reg, const UChar* name, const UChar* name_end,
|
||||||
int** num_list)
|
int** num_list)
|
||||||
|
|
||||||
指定した名前に対する名前付き捕獲式集合(グループ)の
|
指定した名前に対する名前付き捕獲式集合(グループ)の
|
||||||
グループ番号リストを返す。
|
グループ番号リストを返す。
|
||||||
名前付き捕獲式集合は、(?<name>....)によって定義できる。
|
名前付き捕獲式集合は、(?<name>....)によって定義できる。
|
||||||
|
|
||||||
正常終了戻り値: 指定された名前に対するグループ数
|
正常終了戻り値: 指定された名前に対するグループ数
|
||||||
(例 /(?<x>..)(?<x>..)/ ==> 2)
|
(例 /(?<x>..)(?<x>..)/ ==> 2)
|
||||||
名前に対するグループが存在しない: -1
|
名前に対するグループが存在しない: -1
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
2 name: 捕獲式集合(グループ)名
|
2 name: 捕獲式集合(グループ)名
|
||||||
3 name_end: 捕獲式集合(グループ)名の終端アドレス
|
3 name_end: 捕獲式集合(グループ)名の終端アドレス
|
||||||
4 num_list: 番号リストを返すアドレス
|
4 num_list: 番号リストを返すアドレス
|
||||||
|
|
||||||
|
|
||||||
# int onig_name_to_backref_number(regex_t* reg, const UChar* name, const UChar* name_end,
|
# int onig_name_to_backref_number(regex_t* reg, const UChar* name, const UChar* name_end,
|
||||||
OnigRegion *region)
|
OnigRegion *region)
|
||||||
|
|
||||||
指定された名前の後方参照(\k<name>)に対する捕獲式集合(グループ)の番号を返す。
|
指定された名前の後方参照(\k<name>)に対する捕獲式集合(グループ)の番号を返す。
|
||||||
名前に対して、複数のマッチ領域が有効であれば、その中の最大の番号を返す。
|
名前に対して、複数のマッチ領域が有効であれば、その中の最大の番号を返す。
|
||||||
名前に対する捕獲式集合が一個しかないときには、対応するマッチ領域が有効か
|
名前に対する捕獲式集合が一個しかないときには、対応するマッチ領域が有効か
|
||||||
どうかに関係なく、その番号を返す。(従って、regionにはNULLを渡してもよい。)
|
どうかに関係なく、その番号を返す。(従って、regionにはNULLを渡してもよい。)
|
||||||
|
|
||||||
正常終了戻り値: 番号
|
正常終了戻り値: 番号
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
2 name: 捕獲式集合(グループ)名
|
2 name: 捕獲式集合(グループ)名
|
||||||
3 name_end: 捕獲式集合(グループ)名の終端アドレス
|
3 name_end: 捕獲式集合(グループ)名の終端アドレス
|
||||||
4 region: search/match結果のマッチ領域
|
4 region: search/match結果のマッチ領域
|
||||||
|
|
||||||
|
|
||||||
# int onig_foreach_name(regex_t* reg,
|
# int onig_foreach_name(regex_t* reg,
|
||||||
int (*func)(const UChar*, const UChar*, int,int*,regex_t*,void*),
|
int (*func)(const UChar*, const UChar*, int,int*,regex_t*,void*),
|
||||||
void* arg)
|
void* arg)
|
||||||
|
|
||||||
全ての名前に対してコールバック関数呼び出しを実行する。
|
全ての名前に対してコールバック関数呼び出しを実行する。
|
||||||
|
|
||||||
正常終了戻り値: 0
|
正常終了戻り値: 0
|
||||||
エラー: コールバック関数の戻り値
|
エラー: コールバック関数の戻り値
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
2 func: コールバック関数
|
2 func: コールバック関数
|
||||||
func(name, name_end, <number of groups>, <group number's list>,
|
func(name, name_end, <number of groups>, <group number's list>,
|
||||||
reg, arg);
|
reg, arg);
|
||||||
|
|
||||||
funcが0以外の値を返すと、それ以降のコールバックは行なわずに
|
funcが0以外の値を返すと、それ以降のコールバックは行なわずに
|
||||||
終了する。
|
終了する。
|
||||||
|
|
||||||
3 arg: funcに対する追加引数
|
3 arg: funcに対する追加引数
|
||||||
|
|
||||||
|
|
||||||
# int onig_number_of_names(regex_t* reg)
|
# int onig_number_of_names(regex_t* reg)
|
||||||
|
|
||||||
パターン中で定義された名前の数を返す。
|
パターン中で定義された名前の数を返す。
|
||||||
一個の名前の多重定義は一個と看做す。
|
一個の名前の多重定義は一個と看做す。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
|
|
||||||
|
|
||||||
# OnigEncoding onig_get_encoding(regex_t* reg)
|
# OnigEncoding onig_get_encoding(regex_t* reg)
|
||||||
|
@ -389,157 +399,157 @@
|
||||||
# OnigCaseFoldType onig_get_case_fold_flag(regex_t* reg)
|
# OnigCaseFoldType onig_get_case_fold_flag(regex_t* reg)
|
||||||
# OnigSyntaxType* onig_get_syntax(regex_t* reg)
|
# OnigSyntaxType* onig_get_syntax(regex_t* reg)
|
||||||
|
|
||||||
正規表現オブジェクトに対して、対応する値を返す。
|
正規表現オブジェクトに対して、対応する値を返す。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
|
|
||||||
|
|
||||||
# int onig_number_of_captures(regex_t* reg)
|
# int onig_number_of_captures(regex_t* reg)
|
||||||
|
|
||||||
パターン中で定義された捕獲グループの数を返す。
|
パターン中で定義された捕獲グループの数を返す。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
|
|
||||||
|
|
||||||
# int onig_number_of_capture_histories(regex_t* reg)
|
# int onig_number_of_capture_histories(regex_t* reg)
|
||||||
|
|
||||||
パターン中で定義された捕獲履歴(?@...)の数を返す。
|
パターン中で定義された捕獲履歴(?@...)の数を返す。
|
||||||
|
|
||||||
使用する文法で捕獲履歴機能が有効(ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY)
|
使用する文法で捕獲履歴機能が有効(ONIG_SYN_OP2_ATMARK_CAPTURE_HISTORY)
|
||||||
でなければ、捕獲履歴機能は使用できない。
|
でなければ、捕獲履歴機能は使用できない。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
|
|
||||||
|
|
||||||
# OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region)
|
# OnigCaptureTreeNode* onig_get_capture_tree(OnigRegion* region)
|
||||||
|
|
||||||
捕獲履歴データのルートノードを返す。
|
捕獲履歴データのルートノードを返す。
|
||||||
|
|
||||||
マッチが失敗している場合には、この値は不定である。
|
マッチが失敗している場合には、この値は不定である。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 region: マッチ領域
|
1 region: マッチ領域
|
||||||
|
|
||||||
|
|
||||||
# int onig_capture_tree_traverse(OnigRegion* region, int at,
|
# int onig_capture_tree_traverse(OnigRegion* region, int at,
|
||||||
int(*func)(int,int,int,int,int,void*), void* arg)
|
int(*func)(int,int,int,int,int,void*), void* arg)
|
||||||
|
|
||||||
捕獲履歴データ木を巡回してコールバックする。
|
捕獲履歴データ木を巡回してコールバックする。
|
||||||
|
|
||||||
正常終了戻り値: 0
|
正常終了戻り値: 0
|
||||||
エラー: コールバック関数の戻り値
|
エラー: コールバック関数の戻り値
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 region: マッチ領域
|
1 region: マッチ領域
|
||||||
2 at: コールバックを行なうタイミング
|
2 at: コールバックを行なうタイミング
|
||||||
|
|
||||||
ONIG_TRAVERSE_CALLBACK_AT_FIRST:
|
ONIG_TRAVERSE_CALLBACK_AT_FIRST:
|
||||||
最初にコールバックして、子ノードを巡回
|
最初にコールバックして、子ノードを巡回
|
||||||
ONIG_TRAVERSE_CALLBACK_AT_LAST:
|
ONIG_TRAVERSE_CALLBACK_AT_LAST:
|
||||||
子ノードを巡回して、コールバック
|
子ノードを巡回して、コールバック
|
||||||
ONIG_TRAVERSE_CALLBACK_AT_BOTH:
|
ONIG_TRAVERSE_CALLBACK_AT_BOTH:
|
||||||
最初にコールバックして、子ノードを巡回、最後にもう一度コールバック
|
最初にコールバックして、子ノードを巡回、最後にもう一度コールバック
|
||||||
|
|
||||||
3 func: コールバック関数
|
3 func: コールバック関数
|
||||||
funcが0以外の値を返すと、それ以降の巡回は行なわずに
|
funcが0以外の値を返すと、それ以降の巡回は行なわずに
|
||||||
終了する。
|
終了する。
|
||||||
|
|
||||||
int func(int group, int beg, int end, int level, int at,
|
int func(int group, int beg, int end, int level, int at,
|
||||||
void* arg)
|
void* arg)
|
||||||
group: グループ番号
|
group: グループ番号
|
||||||
beg: マッチ開始位置
|
beg: マッチ開始位置
|
||||||
end マッチ終了位置
|
end マッチ終了位置
|
||||||
level: ネストレベル (0から)
|
level: ネストレベル (0から)
|
||||||
at: コールバックが呼び出されたタイミング
|
at: コールバックが呼び出されたタイミング
|
||||||
ONIG_TRAVERSE_CALLBACK_AT_FIRST
|
ONIG_TRAVERSE_CALLBACK_AT_FIRST
|
||||||
ONIG_TRAVERSE_CALLBACK_AT_LAST
|
ONIG_TRAVERSE_CALLBACK_AT_LAST
|
||||||
arg: 追加引数
|
arg: 追加引数
|
||||||
|
|
||||||
4 arg; funcに対する追加引数
|
4 arg; funcに対する追加引数
|
||||||
|
|
||||||
|
|
||||||
# int onig_noname_group_capture_is_active(regex_t* reg)
|
# int onig_noname_group_capture_is_active(regex_t* reg)
|
||||||
|
|
||||||
名前なし式集合の捕獲機能が有効かどうかを返す。
|
名前なし式集合の捕獲機能が有効かどうかを返す。
|
||||||
|
|
||||||
有効: 1
|
有効: 1
|
||||||
無効: 0
|
無効: 0
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 reg: 正規表現オブジェクト
|
1 reg: 正規表現オブジェクト
|
||||||
|
|
||||||
|
|
||||||
オプションのONIG_OPTION_DONT_CAPTURE_GROUPがON --> 無効
|
オプションのONIG_OPTION_DONT_CAPTURE_GROUPがON --> 無効
|
||||||
|
|
||||||
パターンが名前つき式集合を使用している
|
パターンが名前つき式集合を使用している
|
||||||
AND 使用文法で、ONIG_SYN_CAPTURE_ONLY_NAMED_GROUPがON
|
AND 使用文法で、ONIG_SYN_CAPTURE_ONLY_NAMED_GROUPがON
|
||||||
AND オプションのONIG_OPTION_CAPTURE_GROUPがOFF
|
AND オプションのONIG_OPTION_CAPTURE_GROUPがOFF
|
||||||
--> 無効
|
--> 無効
|
||||||
|
|
||||||
上記以外の場合 --> 有効
|
上記以外の場合 --> 有効
|
||||||
|
|
||||||
|
|
||||||
# UChar* onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s)
|
# UChar* onigenc_get_prev_char_head(OnigEncoding enc, const UChar* start, const UChar* s)
|
||||||
|
|
||||||
文字一個分前の文字列位置を返す。
|
文字一個分前の文字列位置を返す。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 enc: 文字エンコーディング
|
1 enc: 文字エンコーディング
|
||||||
2 start: 文字列の先頭アドレス
|
2 start: 文字列の先頭アドレス
|
||||||
3 s: 文字列中の位置
|
3 s: 文字列中の位置
|
||||||
|
|
||||||
|
|
||||||
# UChar* onigenc_get_left_adjust_char_head(OnigEncoding enc,
|
# UChar* onigenc_get_left_adjust_char_head(OnigEncoding enc,
|
||||||
const UChar* start, const UChar* s)
|
const UChar* start, const UChar* s)
|
||||||
|
|
||||||
文字の先頭バイト位置になるように左側に調整したアドレスを返す。
|
文字の先頭バイト位置になるように左側に調整したアドレスを返す。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 enc: 文字エンコーディング
|
1 enc: 文字エンコーディング
|
||||||
2 start: 文字列の先頭アドレス
|
2 start: 文字列の先頭アドレス
|
||||||
3 s: 文字列中の位置
|
3 s: 文字列中の位置
|
||||||
|
|
||||||
|
|
||||||
# UChar* onigenc_get_right_adjust_char_head(OnigEncoding enc,
|
# UChar* onigenc_get_right_adjust_char_head(OnigEncoding enc,
|
||||||
const UChar* start, const UChar* s)
|
const UChar* start, const UChar* s)
|
||||||
|
|
||||||
文字の先頭バイト位置になるように右側に調整したアドレスを返す。
|
文字の先頭バイト位置になるように右側に調整したアドレスを返す。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 enc: 文字エンコーディング
|
1 enc: 文字エンコーディング
|
||||||
2 start: 文字列の先頭アドレス
|
2 start: 文字列の先頭アドレス
|
||||||
3 s: 文字列中の位置
|
3 s: 文字列中の位置
|
||||||
|
|
||||||
|
|
||||||
# int onigenc_strlen(OnigEncoding enc, const UChar* s, const UChar* end)
|
# int onigenc_strlen(OnigEncoding enc, const UChar* s, const UChar* end)
|
||||||
# int onigenc_strlen_null(OnigEncoding enc, const UChar* s)
|
# int onigenc_strlen_null(OnigEncoding enc, const UChar* s)
|
||||||
|
|
||||||
文字列の文字数を返す。
|
文字列の文字数を返す。
|
||||||
|
|
||||||
|
|
||||||
# int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s)
|
# int onigenc_str_bytelen_null(OnigEncoding enc, const UChar* s)
|
||||||
|
|
||||||
文字列のバイト数を返す。
|
文字列のバイト数を返す。
|
||||||
|
|
||||||
|
|
||||||
# int onig_set_default_syntax(OnigSyntaxType* syntax)
|
# int onig_set_default_syntax(OnigSyntaxType* syntax)
|
||||||
|
|
||||||
デフォルトの正規表現パターン文法をセットする。
|
デフォルトの正規表現パターン文法をセットする。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 syntax: 正規表現パターン文法
|
1 syntax: 正規表現パターン文法
|
||||||
|
|
||||||
|
|
||||||
# void onig_copy_syntax(OnigSyntaxType* to, OnigSyntaxType* from)
|
# void onig_copy_syntax(OnigSyntaxType* to, OnigSyntaxType* from)
|
||||||
|
|
||||||
正規表現パターン文法をコピーする。
|
正規表現パターン文法をコピーする。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 to: 対象
|
1 to: 対象
|
||||||
2 from: 元
|
2 from: 元
|
||||||
|
|
||||||
|
|
||||||
# unsigned int onig_get_syntax_op(OnigSyntaxType* syntax)
|
# unsigned int onig_get_syntax_op(OnigSyntaxType* syntax)
|
||||||
|
@ -552,35 +562,35 @@
|
||||||
# void onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior)
|
# void onig_set_syntax_behavior(OnigSyntaxType* syntax, unsigned int behavior)
|
||||||
# void onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options)
|
# void onig_set_syntax_options(OnigSyntaxType* syntax, OnigOptionType options)
|
||||||
|
|
||||||
正規表現パターン文法の要素を参照/取得する。
|
正規表現パターン文法の要素を参照/取得する。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 syntax: 正規表現パターン文法
|
1 syntax: 正規表現パターン文法
|
||||||
2 op, op2, behavior, options: 要素の値
|
2 op, op2, behavior, options: 要素の値
|
||||||
|
|
||||||
|
|
||||||
# void onig_copy_encoding(OnigEncoding to, OnigEncoding from)
|
# void onig_copy_encoding(OnigEncoding to, OnigEncoding from)
|
||||||
|
|
||||||
文字エンコーディングをコピーする。
|
文字エンコーディングをコピーする。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 to: 対象
|
1 to: 対象
|
||||||
2 from: 元
|
2 from: 元
|
||||||
|
|
||||||
|
|
||||||
# int onig_set_meta_char(OnigSyntaxType* syntax, unsigned int what,
|
# int onig_set_meta_char(OnigSyntaxType* syntax, unsigned int what,
|
||||||
OnigCodePoint code)
|
OnigCodePoint code)
|
||||||
|
|
||||||
メタ文字を指定したコードポイント値にセットする。
|
メタ文字を指定したコードポイント値にセットする。
|
||||||
ONIG_SYN_OP_VARIABLE_META_CHARACTERSが正規表現パターン文法で有効に
|
ONIG_SYN_OP_VARIABLE_META_CHARACTERSが正規表現パターン文法で有効に
|
||||||
なっていない場合には、エスケープ文字を除いて、ここで指定したメタ文字は
|
なっていない場合には、エスケープ文字を除いて、ここで指定したメタ文字は
|
||||||
機能しない。(組込みの文法では有効にしていない。)
|
機能しない。(組込みの文法では有効にしていない。)
|
||||||
|
|
||||||
正常終了戻り値: ONIG_NORMAL
|
正常終了戻り値: ONIG_NORMAL
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 syntax: 対象文法
|
1 syntax: 対象文法
|
||||||
2 what: メタ文字機能の指定
|
2 what: メタ文字機能の指定
|
||||||
|
|
||||||
ONIG_META_CHAR_ESCAPE
|
ONIG_META_CHAR_ESCAPE
|
||||||
ONIG_META_CHAR_ANYCHAR
|
ONIG_META_CHAR_ANYCHAR
|
||||||
|
@ -589,79 +599,79 @@
|
||||||
ONIG_META_CHAR_ONE_OR_MORE_TIME
|
ONIG_META_CHAR_ONE_OR_MORE_TIME
|
||||||
ONIG_META_CHAR_ANYCHAR_ANYTIME
|
ONIG_META_CHAR_ANYCHAR_ANYTIME
|
||||||
|
|
||||||
3 code: メタ文字のコードポイント または ONIG_INEFFECTIVE_META_CHAR.
|
3 code: メタ文字のコードポイント または ONIG_INEFFECTIVE_META_CHAR.
|
||||||
|
|
||||||
|
|
||||||
# OnigCaseFoldType onig_get_default_case_fold_flag()
|
# OnigCaseFoldType onig_get_default_case_fold_flag()
|
||||||
|
|
||||||
デフォルトのcase foldフラグを取得する。
|
デフォルトのcase foldフラグを取得する。
|
||||||
|
|
||||||
|
|
||||||
# int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
|
# int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
|
||||||
|
|
||||||
デフォルトのcase foldフラグをセットする。
|
デフォルトのcase foldフラグをセットする。
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 case_fold_flag: case foldフラグ
|
1 case_fold_flag: case foldフラグ
|
||||||
|
|
||||||
|
|
||||||
# unsigned int onig_get_match_stack_limit_size(void)
|
# unsigned int onig_get_match_stack_limit_size(void)
|
||||||
|
|
||||||
マッチスタックサイズの最大値を返す。
|
マッチスタックサイズの最大値を返す。
|
||||||
(デフォルト: 0 == 無制限)
|
(デフォルト: 0 == 無制限)
|
||||||
|
|
||||||
|
|
||||||
# int onig_set_match_stack_limit_size(unsigned int size)
|
# int onig_set_match_stack_limit_size(unsigned int size)
|
||||||
|
|
||||||
マッチスタックサイズの最大値を指定する。
|
マッチスタックサイズの最大値を指定する。
|
||||||
(size = 0: 無制限)
|
(size = 0: 無制限)
|
||||||
|
|
||||||
正常終了戻り値: ONIG_NORMAL
|
正常終了戻り値: ONIG_NORMAL
|
||||||
|
|
||||||
|
|
||||||
# int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges))
|
# int onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges))
|
||||||
|
|
||||||
新しいUnicodeプロパティを定義する。
|
新しいUnicodeプロパティを定義する。
|
||||||
(この関数はスレッドセーフではない)
|
(この関数はスレッドセーフではない)
|
||||||
|
|
||||||
引数
|
引数
|
||||||
1 name: プロパティ名 (ASCIIコードのみ。 文字 ' ', '-', '_' は無視される。)
|
1 name: プロパティ名 (ASCIIコードのみ。 文字 ' ', '-', '_' は無視される。)
|
||||||
2 ranges: プロパティコードポイント範囲
|
2 ranges: プロパティコードポイント範囲
|
||||||
(最初の要素は範囲の数)
|
(最初の要素は範囲の数)
|
||||||
|
|
||||||
[num-of-ranges, 1st-range-start, 1st-range-end, 2nd-range-start... ]
|
[num-of-ranges, 1st-range-start, 1st-range-end, 2nd-range-start... ]
|
||||||
|
|
||||||
* この関数を呼んだ後で、rangesを変更/破壊しないこと
|
* この関数を呼んだ後で、rangesを変更/破壊しないこと
|
||||||
|
|
||||||
正常終了戻り値: ONIG_NORMAL
|
正常終了戻り値: ONIG_NORMAL
|
||||||
|
|
||||||
|
|
||||||
# unsigned int onig_get_parse_depth_limit(void)
|
# unsigned int onig_get_parse_depth_limit(void)
|
||||||
|
|
||||||
再帰パース処理の最大深さを返す。
|
再帰パース処理の最大深さを返す。
|
||||||
(デフォルト: regint.h で定義されている DEFAULT_PARSE_DEPTH_LIMIT。現在は 4096)
|
(デフォルト: regint.h で定義されている DEFAULT_PARSE_DEPTH_LIMIT。現在は 4096)
|
||||||
|
|
||||||
|
|
||||||
# int onig_set_parse_depth_limit(unsigned int depth)
|
# int onig_set_parse_depth_limit(unsigned int depth)
|
||||||
|
|
||||||
再帰パース処理の最大深さを指定する。
|
再帰パース処理の最大深さを指定する。
|
||||||
(depth = 0: regint.h で定義されたデフォルト値に設定する。)
|
(depth = 0: regint.h で定義されたデフォルト値に設定する。)
|
||||||
|
|
||||||
正常終了戻り値: ONIG_NORMAL
|
正常終了戻り値: ONIG_NORMAL
|
||||||
|
|
||||||
|
|
||||||
# int onig_end(void)
|
# int onig_end(void)
|
||||||
|
|
||||||
ライブラリの使用を終了する。
|
ライブラリの使用を終了する。
|
||||||
|
|
||||||
正常終了戻り値: ONIG_NORMAL
|
正常終了戻り値: ONIG_NORMAL
|
||||||
|
|
||||||
onig_init()を再度呼び出しても、以前に作成した正規表現オブジェクト
|
onig_init()を再度呼び出しても、以前に作成した正規表現オブジェクト
|
||||||
を使用することはできない。
|
を使用することはできない。
|
||||||
|
|
||||||
|
|
||||||
# const char* onig_version(void)
|
# const char* onig_version(void)
|
||||||
|
|
||||||
バージョン文字列を返す。(例 "5.0.3")
|
バージョン文字列を返す。(例 "5.0.3")
|
||||||
|
|
||||||
// END
|
// END
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
FAQ 2006/11/14
|
FAQ 2006/11/14
|
||||||
|
|
||||||
1. Lognest match
|
1. Longest match
|
||||||
|
|
||||||
You can execute longest match by using ONIG_OPTION_FIND_LONGEST option
|
You can execute the longest match by using ONIG_OPTION_FIND_LONGEST option
|
||||||
in onig_new().
|
in onig_new().
|
||||||
|
|
||||||
2. Mailing list
|
2. Mailing list
|
||||||
|
|
||||||
There is no mailing list about Oniguruma.
|
There is no mailing list for Oniguruma.
|
||||||
|
|
||||||
// END
|
// END
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
FAQ 2016/04/06
|
FAQ 2016/04/06
|
||||||
|
|
||||||
1. 最長マッチ
|
1. 最長マッチ
|
||||||
|
|
||||||
onig_new()の中で、ONIG_OPTION_FIND_LONGESTオプション
|
onig_new()の中で、ONIG_OPTION_FIND_LONGESTオプション
|
||||||
を使用すれば最長マッチになる。
|
を使用すれば最長マッチになる。
|
||||||
|
|
||||||
|
|
||||||
2. CR + LF
|
2. CR + LF
|
||||||
|
|
||||||
DOSの改行(CR(0x0c) + LF(0x0a)の連続)
|
DOSの改行(CR(0x0c) + LF(0x0a)の連続)
|
||||||
|
|
||||||
regenc.hの中の、以下の部分を有効にする。
|
regenc.hの中の、以下の部分を有効にする。
|
||||||
|
|
||||||
/* #define USE_CRNL_AS_LINE_TERMINATOR */
|
/* #define USE_CRNL_AS_LINE_TERMINATOR */
|
||||||
|
|
||||||
|
|
||||||
3. メーリングリスト
|
3. メーリングリスト
|
||||||
|
|
||||||
鬼車に関するメーリングリストは存在しない。
|
鬼車に関するメーリングリストは存在しない。
|
||||||
|
|
||||||
//END
|
//END
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Oniguruma Regular Expressions Version 6.3.0 2017/05/19
|
Oniguruma Regular Expressions Version 6.7.0 2017/12/08
|
||||||
|
|
||||||
syntax: ONIG_SYNTAX_RUBY (default)
|
syntax: ONIG_SYNTAX_ONIGURUMA (default)
|
||||||
|
|
||||||
|
|
||||||
1. Syntax elements
|
1. Syntax elements
|
||||||
|
@ -23,6 +23,7 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
\e escape (0x1B)
|
\e escape (0x1B)
|
||||||
\nnn octal char (encoded byte value)
|
\nnn octal char (encoded byte value)
|
||||||
\o{17777777777} wide octal char (character code point value)
|
\o{17777777777} wide octal char (character code point value)
|
||||||
|
\uHHHH wide hexadecimal char (character code point value)
|
||||||
\xHH hexadecimal char (encoded byte value)
|
\xHH hexadecimal char (encoded byte value)
|
||||||
\x{7HHHHHHH} wide hexadecimal char (character code point value)
|
\x{7HHHHHHH} wide hexadecimal char (character code point value)
|
||||||
\cx control char (character code point value)
|
\cx control char (character code point value)
|
||||||
|
@ -52,8 +53,8 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
Not Unicode:
|
Not Unicode:
|
||||||
\t, \n, \v, \f, \r, \x20
|
\t, \n, \v, \f, \r, \x20
|
||||||
|
|
||||||
Unicode:
|
Unicode case:
|
||||||
0009, 000A, 000B, 000C, 000D, 0085(NEL),
|
U+0009, U+000A, U+000B, U+000C, U+000D, U+0085(NEL),
|
||||||
General_Category -- Line_Separator
|
General_Category -- Line_Separator
|
||||||
-- Paragraph_Separator
|
-- Paragraph_Separator
|
||||||
-- Space_Separator
|
-- Space_Separator
|
||||||
|
@ -70,6 +71,26 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
|
|
||||||
\H non-hexdigit char
|
\H non-hexdigit char
|
||||||
|
|
||||||
|
\R general newline (* can't be used in character-class)
|
||||||
|
"\r\n" or \n,\v,\f,\r (* but doesn't backtrack from \r\n to \r)
|
||||||
|
|
||||||
|
Unicode case:
|
||||||
|
"\r\n" or \n,\v,\f,\r or U+0085, U+2028, U+2029
|
||||||
|
|
||||||
|
\N negative newline (?-m:.)
|
||||||
|
|
||||||
|
\O true anychar (?m:.) (* original function)
|
||||||
|
|
||||||
|
\X Extended Grapheme Cluster (?>\O(?:\Y\O)*)
|
||||||
|
|
||||||
|
\X doesn't check whether matching start position is boundary.
|
||||||
|
Write as \y\X if you want to ensure it.
|
||||||
|
|
||||||
|
Unicode case:
|
||||||
|
See [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
|
||||||
|
|
||||||
|
Not Unicode: (?>\r\n|\O)
|
||||||
|
|
||||||
|
|
||||||
Character Property
|
Character Property
|
||||||
|
|
||||||
|
@ -129,10 +150,15 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
$ end of the line
|
$ end of the line
|
||||||
\b word boundary
|
\b word boundary
|
||||||
\B non-word boundary
|
\B non-word boundary
|
||||||
|
\y Extended Grapheme Cluster boundary
|
||||||
|
\Y Extended Grapheme Cluster non-boundary
|
||||||
|
|
||||||
\A beginning of string
|
\A beginning of string
|
||||||
\Z end of string, or before newline at the end
|
\Z end of string, or before newline at the end
|
||||||
\z end of string
|
\z end of string
|
||||||
\G where the current search attempt begins
|
\G where the current search attempt begins
|
||||||
|
\K keep (keep start position of the result string)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
6. Character class
|
6. Character class
|
||||||
|
@ -183,9 +209,9 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
Final_Punctuation | Initial_Punctuation | Other_Punctuation |
|
Final_Punctuation | Initial_Punctuation | Other_Punctuation |
|
||||||
Open_Punctuation
|
Open_Punctuation
|
||||||
space Space_Separator | Line_Separator | Paragraph_Separator |
|
space Space_Separator | Line_Separator | Paragraph_Separator |
|
||||||
0009 | 000A | 000B | 000C | 000D | 0085
|
U+0009 | U+000A | U+000B | U+000C | U+000D | U+0085
|
||||||
upper Uppercase_Letter
|
upper Uppercase_Letter
|
||||||
xdigit 0030 - 0039 | 0041 - 0046 | 0061 - 0066
|
xdigit U+0030 - U+0039 | U+0041 - U+0046 | U+0061 - U+0066
|
||||||
(0-9, a-f, A-F)
|
(0-9, a-f, A-F)
|
||||||
word Letter | Mark | Decimal_Number | Connector_Punctuation
|
word Letter | Mark | Decimal_Number | Connector_Punctuation
|
||||||
|
|
||||||
|
@ -195,11 +221,19 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
|
|
||||||
(?#...) comment
|
(?#...) comment
|
||||||
|
|
||||||
(?imx-imx) option on/off
|
(?imxWDSP-imxWDSP) option on/off
|
||||||
i: ignore case
|
i: ignore case
|
||||||
m: multi-line (dot (.) also matches newline)
|
m: multi-line (dot (.) also matches newline)
|
||||||
x: extended form
|
x: extended form
|
||||||
(?imx-imx:subexp) option on/off for subexp
|
W: ASCII only word (\w, \p{Word}, [[:word:]])
|
||||||
|
ASCII only word bound (\b)
|
||||||
|
D: ASCII only digit (\d, \p{Digit}, [[:digit:]])
|
||||||
|
S: ASCII only space (\s, \p{Space}, [[:space:]])
|
||||||
|
P: ASCII only POSIX properties (includes W,D,S)
|
||||||
|
(alnum, alpha, blank, cntrl, digit, graph,
|
||||||
|
lower, print, punct, space, upper, xdigit, word)
|
||||||
|
|
||||||
|
(?imxWDSP-imxWDSP:subexp) option on/off for subexp
|
||||||
|
|
||||||
(?:subexp) non-capturing group
|
(?:subexp) non-capturing group
|
||||||
(subexp) capturing group
|
(subexp) capturing group
|
||||||
|
@ -228,6 +262,49 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
|
|
||||||
Assigning the same name to two or more subexps is allowed.
|
Assigning the same name to two or more subexps is allowed.
|
||||||
|
|
||||||
|
<Absent functions>
|
||||||
|
|
||||||
|
(?~absent) Absent repeater (* proposed by Tanaka Akira)
|
||||||
|
This works like .* (more precisely \O*), but it is
|
||||||
|
limited by the range that does not include the string
|
||||||
|
match with <absent>.
|
||||||
|
This is a written abbreviation of (?~|absent|\O*).
|
||||||
|
\O* is used as a repeater.
|
||||||
|
|
||||||
|
(?~|absent|exp) Absent expression (* original)
|
||||||
|
This works like "exp", but it is limited by the range
|
||||||
|
that does not include the string match with <absent>.
|
||||||
|
|
||||||
|
ex. (?~|345|\d*) "12345678" ==> "12", "1", ""
|
||||||
|
|
||||||
|
(?~|absent) Absent stopper (* original)
|
||||||
|
After passed this operator, string right range is limited
|
||||||
|
at the point that does not include the string match whth
|
||||||
|
<absent>.
|
||||||
|
|
||||||
|
(?~|) Range clear
|
||||||
|
Clear the effects caused by Absent stoppers.
|
||||||
|
|
||||||
|
* Nested Absent functions are not supported and the behavior
|
||||||
|
is undefined.
|
||||||
|
|
||||||
|
|
||||||
|
(?(condition_exp)then_exp|else_exp) if-then-else
|
||||||
|
(?(condition_exp)then_exp) if-then
|
||||||
|
|
||||||
|
condition_exp can be a backreference number/name or a normal
|
||||||
|
regular expression.
|
||||||
|
When condition_exp is a backreference number/name, both then_exp and
|
||||||
|
else_exp can be omitted.
|
||||||
|
Then it works as a backreference validity checker.
|
||||||
|
|
||||||
|
[ backreference validity checker ] (* original)
|
||||||
|
|
||||||
|
(?(n)), (?(-n)), (?(+n)), (?(n+level)) ...
|
||||||
|
(?(<n>)), (?('-n')), (?(<+n>)) ...
|
||||||
|
(?(<name>)), (?('name')), (?(<name+level>)) ...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
8. Backreferences
|
8. Backreferences
|
||||||
|
|
||||||
|
@ -237,6 +314,8 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
\n \k<n> \k'n' (n >= 1) backreference the nth group in the regexp
|
\n \k<n> \k'n' (n >= 1) backreference the nth group in the regexp
|
||||||
\k<-n> \k'-n' (n >= 1) backreference the nth group counting
|
\k<-n> \k'-n' (n >= 1) backreference the nth group counting
|
||||||
backwards from the referring position
|
backwards from the referring position
|
||||||
|
\k<+n> \k'+n' (n >= 1) backreference the nth group counting
|
||||||
|
forwards from the referring position
|
||||||
\k<name> \k'name' backreference a group with the specified name
|
\k<name> \k'name' backreference a group with the specified name
|
||||||
|
|
||||||
When backreferencing with a name that is assigned to more than one groups,
|
When backreferencing with a name that is assigned to more than one groups,
|
||||||
|
@ -280,14 +359,17 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
p r.match("<foo>f<bar>bbb</bar>f</foo>").captures
|
p r.match("<foo>f<bar>bbb</bar>f</foo>").captures
|
||||||
|
|
||||||
|
|
||||||
9. Subexp calls ("Tanaka Akira special")
|
9. Subexp calls ("Tanaka Akira special") (* original function)
|
||||||
|
|
||||||
When we say "call a group," it actually means, "re-execute the subexp in
|
When we say "call a group," it actually means, "re-execute the subexp in
|
||||||
that group."
|
that group."
|
||||||
|
|
||||||
\g<n> \g'n' (n >= 1) call the nth group
|
\g<n> \g'n' (n >= 1) call the nth group
|
||||||
|
\g<0> \g'0' call zero (call the total regexp)
|
||||||
\g<-n> \g'-n' (n >= 1) call the nth group counting backwards from
|
\g<-n> \g'-n' (n >= 1) call the nth group counting backwards from
|
||||||
the calling position
|
the calling position
|
||||||
|
\g<+n> \g'+n' (n >= 1) call the nth group counting forwards from
|
||||||
|
the calling position
|
||||||
\g<name> \g'name' call the group with the specified name
|
\g<name> \g'name' call the group with the specified name
|
||||||
|
|
||||||
* Left-most recursive calls are not allowed.
|
* Left-most recursive calls are not allowed.
|
||||||
|
@ -340,7 +422,7 @@ syntax: ONIG_SYNTAX_RUBY (default)
|
||||||
-----------------------------
|
-----------------------------
|
||||||
A-1. Syntax-dependent options
|
A-1. Syntax-dependent options
|
||||||
|
|
||||||
+ ONIG_SYNTAX_RUBY
|
+ ONIG_SYNTAX_ONIGURUMA
|
||||||
(?m): dot (.) also matches newline
|
(?m): dot (.) also matches newline
|
||||||
|
|
||||||
+ ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA
|
+ ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA
|
||||||
|
@ -359,10 +441,9 @@ A-2. Original extensions
|
||||||
A-3. Missing features compared with perl 5.8.0
|
A-3. Missing features compared with perl 5.8.0
|
||||||
|
|
||||||
+ \N{name}
|
+ \N{name}
|
||||||
+ \l,\u,\L,\U, \X, \C
|
+ \l,\u,\L,\U,\C
|
||||||
+ (?{code})
|
+ (?{code})
|
||||||
+ (??{code})
|
+ (??{code})
|
||||||
+ (?(condition)yes-pat|no-pat)
|
|
||||||
|
|
||||||
* \Q...\E
|
* \Q...\E
|
||||||
This is effective on ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA.
|
This is effective on ONIG_SYNTAX_PERL and ONIG_SYNTAX_JAVA.
|
||||||
|
|
|
@ -1,74 +1,95 @@
|
||||||
鬼車 正規表現 Version 6.3.0 2017/05/19
|
鬼車 正規表現 Version 6.7.0 2017/12/08
|
||||||
|
|
||||||
使用文法: ONIG_SYNTAX_RUBY (既定値)
|
使用文法: ONIG_SYNTAX_ONIGURUMA (既定値)
|
||||||
|
|
||||||
|
|
||||||
1. 基本要素
|
1. 基本要素
|
||||||
|
|
||||||
\ 退避修飾 (エスケープ) 正規表現記号の有効/無効の制御
|
\ 退避修飾 (エスケープ) 正規表現記号の有効/無効の制御
|
||||||
| 選択子
|
| 選択子
|
||||||
(...) 式集合 (グループ)
|
(...) 式集合 (グループ)
|
||||||
[...] 文字集合 (文字クラス)
|
[...] 文字集合 (文字クラス)
|
||||||
|
|
||||||
|
|
||||||
2. 文字
|
2. 文字
|
||||||
|
|
||||||
\t 水平タブ (0x09)
|
\t 水平タブ (0x09)
|
||||||
\v 垂直タブ (0x0B)
|
\v 垂直タブ (0x0B)
|
||||||
\n 改行 (0x0A)
|
\n 改行 (0x0A)
|
||||||
\r 復帰 (0x0D)
|
\r 復帰 (0x0D)
|
||||||
\b 後退空白 (0x08)
|
\b 後退空白 (0x08)
|
||||||
\f 改頁 (0x0C)
|
\f 改頁 (0x0C)
|
||||||
\a 鐘 (0x07)
|
\a 鐘 (0x07)
|
||||||
\e 退避修飾 (0x1B)
|
\e 退避修飾 (0x1B)
|
||||||
\nnn 八進数表現 符号化バイト値(の一部)
|
\nnn 八進数表現 符号化バイト値(の一部)
|
||||||
\o{17777777777} 拡張八進数表現 コードポイント値
|
\o{17777777777} 拡張八進数表現 コードポイント値
|
||||||
\xHH 十六進数表現 符号化バイト値(の一部)
|
\uHHHH 拡張十六進数表現 コードポイント値
|
||||||
\x{7HHHHHHH} 拡張十六進数表現 コードポイント値
|
\xHH 十六進数表現 符号化バイト値(の一部)
|
||||||
\cx 制御文字表現 コードポイント値
|
\x{7HHHHHHH} 拡張十六進数表現 コードポイント値
|
||||||
\C-x 制御文字表現 コードポイント値
|
\cx 制御文字表現 コードポイント値
|
||||||
\M-x 超 (x|0x80) コードポイント値
|
\C-x 制御文字表現 コードポイント値
|
||||||
\M-\C-x 超 + 制御文字表現 コードポイント値
|
\M-x 超 (x|0x80) コードポイント値
|
||||||
|
\M-\C-x 超 + 制御文字表現 コードポイント値
|
||||||
|
|
||||||
※ \bは、文字集合内でのみ有効
|
※ \bは、文字集合内でのみ有効
|
||||||
|
|
||||||
|
|
||||||
3. 文字種
|
3. 文字種
|
||||||
|
|
||||||
. 任意文字 (改行を除く)
|
. 任意文字 (改行を除く: オプションに依存)
|
||||||
|
|
||||||
\w 単語構成文字
|
\w 単語構成文字
|
||||||
|
|
||||||
Unicode以外の場合:
|
Unicode以外の場合:
|
||||||
英数字, "_" および 多バイト文字。
|
英数字, "_" および 多バイト文字。
|
||||||
|
|
||||||
Unicodeの場合:
|
Unicodeの場合:
|
||||||
General_Category -- (Letter|Mark|Number|Connector_Punctuation)
|
General_Category -- (Letter|Mark|Number|Connector_Punctuation)
|
||||||
|
|
||||||
\W 非単語構成文字
|
\W 非単語構成文字
|
||||||
|
|
||||||
\s 空白文字
|
\s 空白文字
|
||||||
|
|
||||||
Unicode以外の場合:
|
Unicode以外の場合:
|
||||||
\t, \n, \v, \f, \r, \x20
|
\t, \n, \v, \f, \r, \x20
|
||||||
|
|
||||||
Unicodeの場合:
|
Unicodeの場合:
|
||||||
0009, 000A, 000B, 000C, 000D, 0085(NEL),
|
U+0009, U+000A, U+000B, U+000C, U+000D, U+0085(NEL),
|
||||||
General_Category -- Line_Separator
|
General_Category -- Line_Separator
|
||||||
-- Paragraph_Separator
|
-- Paragraph_Separator
|
||||||
-- Space_Separator
|
-- Space_Separator
|
||||||
|
|
||||||
\S 非空白文字
|
\S 非空白文字
|
||||||
|
|
||||||
\d 10進数字
|
\d 10進数字
|
||||||
|
|
||||||
Unicodeの場合: General_Category -- Decimal_Number
|
Unicodeの場合: General_Category -- Decimal_Number
|
||||||
|
|
||||||
\D 非10進数字
|
\D 非10進数字
|
||||||
|
|
||||||
\h 16進数字 [0-9a-fA-F]
|
\h 16進数字 [0-9a-fA-F]
|
||||||
|
|
||||||
\H 非16進数字
|
\H 非16進数字
|
||||||
|
|
||||||
|
\R 汎改行 (* 文字集合の中では使用できない)
|
||||||
|
"\r\n" or \n,\v,\f,\r (* 但し \r\nから\rにはバックトラックしない)
|
||||||
|
|
||||||
|
Unicodeの場合:
|
||||||
|
"\r\n" or \n,\v,\f,\r or U+0085, U+2028, U+2029
|
||||||
|
|
||||||
|
\N 非改行文字 (?-m:.)
|
||||||
|
|
||||||
|
\O 真任意文字 (?m:.) (* 原作)
|
||||||
|
|
||||||
|
\X 拡張書記素房 (?>\O(?:\Y\O)*)
|
||||||
|
|
||||||
|
\Xは照合の開始位置が拡張書記素房の境界かどうかを確認しない。
|
||||||
|
それを確実にしたければ、\y\Xと書けば良い。
|
||||||
|
|
||||||
|
Unicodeの場合:
|
||||||
|
参照 [Unicode Standard Annex #29: http://unicode.org/reports/tr29/]
|
||||||
|
|
||||||
|
Unicode以外の場合: (?>\r\n|\O)
|
||||||
|
|
||||||
|
|
||||||
Character Property
|
Character Property
|
||||||
|
@ -79,95 +100,100 @@
|
||||||
|
|
||||||
property-name:
|
property-name:
|
||||||
|
|
||||||
+ 全てのエンコーディングで有効
|
+ 全てのエンコーディングで有効
|
||||||
Alnum, Alpha, Blank, Cntrl, Digit, Graph, Lower,
|
Alnum, Alpha, Blank, Cntrl, Digit, Graph, Lower,
|
||||||
Print, Punct, Space, Upper, XDigit, Word, ASCII,
|
Print, Punct, Space, Upper, XDigit, Word, ASCII,
|
||||||
|
|
||||||
+ EUC-JP, Shift_JISで有効
|
+ EUC-JP, Shift_JISで有効
|
||||||
Hiragana, Katakana
|
Hiragana, Katakana
|
||||||
|
|
||||||
+ UTF8, UTF16, UTF32で有効
|
+ UTF8, UTF16, UTF32で有効
|
||||||
doc/UNICODE_PROPERTIES参照
|
doc/UNICODE_PROPERTIES参照
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
4. 量指定子
|
4. 量指定子
|
||||||
|
|
||||||
欲張り
|
欲張り
|
||||||
|
|
||||||
? 一回または零回
|
? 一回または零回
|
||||||
* 零回以上
|
* 零回以上
|
||||||
+ 一回以上
|
+ 一回以上
|
||||||
{n,m} n回以上m回以下
|
{n,m} n回以上m回以下
|
||||||
{n,} n回以上
|
{n,} n回以上
|
||||||
{,n} 零回以上n回以下 ({0,n})
|
{,n} 零回以上n回以下 ({0,n})
|
||||||
{n} n回
|
{n} n回
|
||||||
|
|
||||||
無欲
|
無欲
|
||||||
|
|
||||||
?? 一回または零回
|
?? 一回または零回
|
||||||
*? 零回以上
|
*? 零回以上
|
||||||
+? 一回以上
|
+? 一回以上
|
||||||
{n,m}? n回以上m回以下
|
{n,m}? n回以上m回以下
|
||||||
{n,}? n回以上
|
{n,}? n回以上
|
||||||
{,n}? 零回以上n回以下 (== {0,n}?)
|
{,n}? 零回以上n回以下 (== {0,n}?)
|
||||||
|
|
||||||
強欲 (欲張りで、繰り返しに成功した後は回数を減らすような後退再試行をしない)
|
強欲 (欲張りで、繰り返しに成功した後は回数を減らすような後退再試行をしない)
|
||||||
|
|
||||||
?+ 一回または零回
|
?+ 一回または零回
|
||||||
*+ 零回以上
|
*+ 零回以上
|
||||||
++ 一回以上
|
++ 一回以上
|
||||||
|
|
||||||
({n,m}+, {n,}+, {n}+ は、ONIG_SYNTAX_JAVAでのみ強欲な指定子)
|
({n,m}+, {n,}+, {n}+ は、ONIG_SYNTAX_JAVAでのみ強欲な指定子)
|
||||||
|
|
||||||
例. /a*+/ === /(?>a*)/
|
例. /a*+/ === /(?>a*)/
|
||||||
|
|
||||||
|
|
||||||
5. 錨
|
5. 錨
|
||||||
|
|
||||||
^ 行頭
|
^ 行頭
|
||||||
$ 行末
|
$ 行末
|
||||||
\b 単語境界
|
\b 単語境界
|
||||||
\B 非単語境界
|
\B 非単語境界
|
||||||
\A 文字列先頭
|
\y 拡張書記素房 境界
|
||||||
\Z 文字列末尾、または文字列末尾の改行の直前
|
\Y 拡張書記素房 非境界
|
||||||
\z 文字列末尾
|
|
||||||
\G 照合開始位置
|
\A 文字列先頭
|
||||||
|
\Z 文字列末尾、または文字列末尾の改行の直前
|
||||||
|
\z 文字列末尾
|
||||||
|
\G 探索開始位置
|
||||||
|
\K 保持 (結果の開始位置をこの位置に保つ)
|
||||||
|
|
||||||
|
|
||||||
6. 文字集合
|
|
||||||
|
|
||||||
^... 否定 (最低優先度演算子)
|
6. 文字集合
|
||||||
x-y 範囲 (xからyまで)
|
|
||||||
[...] 集合 (文字集合内文字集合)
|
|
||||||
..&&.. 積演算 (^の次に優先度が低い演算子)
|
|
||||||
|
|
||||||
例. [a-w&&[^c-g]z] ==> ([a-w] and ([^c-g] or z)) ==> [abh-w]
|
^... 否定 (最低優先度演算子)
|
||||||
|
x-y 範囲 (xからyまで)
|
||||||
|
[...] 集合 (文字集合内文字集合)
|
||||||
|
..&&.. 積演算 (^の次に優先度が低い演算子)
|
||||||
|
|
||||||
※ '[', '-', ']'を、文字集合内で通常文字の意味で使用したい場合には、
|
例. [a-w&&[^c-g]z] ==> ([a-w] and ([^c-g] or z)) ==> [abh-w]
|
||||||
これらの文字を'\'で退避修飾しなければならない。
|
|
||||||
|
※ '[', '-', ']'を、文字集合内で通常文字の意味で使用したい場合には、
|
||||||
|
これらの文字を'\'で退避修飾しなければならない。
|
||||||
|
|
||||||
|
|
||||||
POSIXブラケット ([:xxxxx:], 否定 [:^xxxxx:])
|
POSIXブラケット ([:xxxxx:], 否定 [:^xxxxx:])
|
||||||
|
|
||||||
Unicode以外の場合:
|
Unicode以外の場合:
|
||||||
|
|
||||||
alnum 英数字
|
alnum 英数字
|
||||||
alpha 英字
|
alpha 英字
|
||||||
ascii 0 - 127
|
ascii 0 - 127
|
||||||
blank \t, \x20
|
blank \t, \x20
|
||||||
cntrl
|
cntrl
|
||||||
digit 0-9
|
digit 0-9
|
||||||
graph 多バイト文字全部を含む
|
graph 多バイト文字全部を含む
|
||||||
lower
|
lower
|
||||||
print 多バイト文字全部を含む
|
print 多バイト文字全部を含む
|
||||||
punct
|
punct
|
||||||
space \t, \n, \v, \f, \r, \x20
|
space \t, \n, \v, \f, \r, \x20
|
||||||
upper
|
upper
|
||||||
xdigit 0-9, a-f, A-F
|
xdigit 0-9, a-f, A-F
|
||||||
word 英数字, "_" および 多バイト文字
|
word 英数字, "_" および 多バイト文字
|
||||||
|
|
||||||
Unicodeの場合:
|
Unicodeの場合:
|
||||||
|
|
||||||
alnum Letter | Mark | Decimal_Number
|
alnum Letter | Mark | Decimal_Number
|
||||||
alpha Letter | Mark
|
alpha Letter | Mark
|
||||||
|
@ -182,75 +208,130 @@
|
||||||
Final_Punctuation | Initial_Punctuation | Other_Punctuation |
|
Final_Punctuation | Initial_Punctuation | Other_Punctuation |
|
||||||
Open_Punctuation
|
Open_Punctuation
|
||||||
space Space_Separator | Line_Separator | Paragraph_Separator |
|
space Space_Separator | Line_Separator | Paragraph_Separator |
|
||||||
0009 | 000A | 000B | 000C | 000D | 0085
|
U+0009 | U+000A | U+000B | U+000C | U+000D | U+0085
|
||||||
upper Uppercase_Letter
|
upper Uppercase_Letter
|
||||||
xdigit 0030 - 0039 | 0041 - 0046 | 0061 - 0066
|
xdigit U+0030 - U+0039 | U+0041 - U+0046 | U+0061 - U+0066
|
||||||
(0-9, a-f, A-F)
|
(0-9, a-f, A-F)
|
||||||
word Letter | Mark | Decimal_Number | Connector_Punctuation
|
word Letter | Mark | Decimal_Number | Connector_Punctuation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
7. 拡張式集合
|
7. 拡張式集合
|
||||||
|
|
||||||
(?#...) 注釈
|
(?#...) 注釈
|
||||||
(?imx-imx) 孤立オプション
|
(?imxWDSP-imxWDSP) 孤立オプション
|
||||||
i: 大文字小文字照合
|
i: 大文字小文字照合
|
||||||
m: 複数行
|
m: 複数行
|
||||||
x: 拡張形式
|
x: 拡張形式
|
||||||
(?imx-imx:式) 式オプション
|
W: wordがASCIIのみ (\w, \p{Word}, [[:word:]])
|
||||||
|
word境界がASCIIのみ (\b)
|
||||||
|
D: digitがASCIIのみ (\d, \p{Digit}, [[:digit:]])
|
||||||
|
S: spaceがASCIIのみ (\s, \p{Space}, [[:space:]])
|
||||||
|
P: POSIXプロパティがASCIIのみ (W,D,Sを全て含んでいる)
|
||||||
|
(alnum, alpha, blank, cntrl, digit, graph,
|
||||||
|
lower, print, punct, space, upper, xdigit, word)
|
||||||
|
|
||||||
(式) 捕獲式集合
|
(?imxWDSP-imxWDSP:式) 式オプション
|
||||||
(?:式) 非捕獲式集合
|
|
||||||
|
|
||||||
(?=式) 先読み
|
(式) 捕獲式集合
|
||||||
(?!式) 否定先読み
|
(?:式) 非捕獲式集合
|
||||||
(?<=式) 戻り読み
|
|
||||||
(?<!式) 否定戻り読み
|
|
||||||
|
|
||||||
戻り読みの式は固定文字長でなければならない。
|
(?=式) 先読み
|
||||||
しかし、最上位の選択子だけは異なった文字長が許される。
|
(?!式) 否定先読み
|
||||||
例. (?<=a|bc) は許可. (?<=aaa(?:b|cd)) は不許可
|
(?<=式) 戻り読み
|
||||||
|
(?<!式) 否定戻り読み
|
||||||
|
|
||||||
否定戻り読みでは、捕獲式集合は許されないが、
|
戻り読みの式は固定文字長でなければならない。
|
||||||
非捕獲式集合は許される。
|
しかし、最上位の選択子だけは異なった文字長が許される。
|
||||||
|
例. (?<=a|bc) は許可. (?<=aaa(?:b|cd)) は不許可
|
||||||
|
|
||||||
(?>式) 原子的式集合
|
否定戻り読みでは、捕獲式集合は許されないが、
|
||||||
式全体を通過したとき、式の中での後退再試行を行なわない
|
非捕獲式集合は許される。
|
||||||
|
|
||||||
(?<name>式), (?'name'式)
|
(?>式) 原子的式集合
|
||||||
名前付き捕獲式集合
|
式全体を通過したとき、式の中での後退再試行を行なわない
|
||||||
式集合に名前を割り当てる(定義する)。
|
|
||||||
(名前は単語構成文字でなければならない。)
|
|
||||||
|
|
||||||
名前だけでなく、捕獲式集合と同様に番号も割り当てられる。
|
(?<name>式), (?'name'式)
|
||||||
番号指定が禁止されていない状態 (10. 捕獲式集合 を参照)
|
名前付き捕獲式集合
|
||||||
のときは、名前を使わないで番号でも参照できる。
|
式集合に名前を割り当てる(定義する)。
|
||||||
|
(名前は単語構成文字でなければならない。)
|
||||||
|
|
||||||
複数の式集合に同じ名前を与えることは許されている。
|
名前だけでなく、捕獲式集合と同様に番号も割り当てられる。
|
||||||
この場合には、この名前を使用した後方参照は可能であるが、
|
番号指定が禁止されていない状態 (10. 捕獲式集合 を参照)
|
||||||
部分式呼出しはできない。
|
のときは、名前を使わないで番号でも参照できる。
|
||||||
|
|
||||||
|
複数の式集合に同じ名前を与えることは許されている。
|
||||||
|
この場合には、この名前を使用した後方参照は可能であるが、
|
||||||
|
部分式呼出しはできない。
|
||||||
|
|
||||||
|
<不在機能群>
|
||||||
|
|
||||||
|
(?~不在式) 不在繰り返し (*原案 田中哲)
|
||||||
|
これは.*(より正確には\O*)のように動作するが、<不在式>に
|
||||||
|
適合する文字列を含まない範囲に制限される。
|
||||||
|
これは(?~|不在式|\O*)の省略表記である。
|
||||||
|
|
||||||
|
(?~|不在式|式) 不在式 (* 原作)
|
||||||
|
これは<式>のように動作するが、<不在式>に適合する文字列を
|
||||||
|
含まない範囲に制限される。
|
||||||
|
|
||||||
|
例 (?~|345|\d*) "12345678" ==> "12", "1", ""
|
||||||
|
|
||||||
|
(?~|不在式) 不在停止 (* 原作)
|
||||||
|
この演算子を通過した後は、対象文字列の適合範囲の最後が
|
||||||
|
<不在式>に適合する文字列を含まない範囲に制限される。
|
||||||
|
|
||||||
|
(?~|) 範囲消去
|
||||||
|
不在停止の効果を消して、初期状態にする。
|
||||||
|
|
||||||
|
* 不在機能の入れ子には対応しておらず、挙動は不定とする。
|
||||||
|
|
||||||
|
|
||||||
8. 後方参照
|
(?(条件式)成功式|失敗式) 条件式が成功すれば成功式、失敗すれば失敗式を実行する
|
||||||
|
この機能の存在理由は、成功式が失敗しても失敗式には
|
||||||
|
行かないこと。これは他の正規表現で書くことができない。
|
||||||
|
もうひとつは、条件式が後方参照の番号/名前のとき、
|
||||||
|
後方参照値の有効性を調べる(文字列と照合はしない)
|
||||||
|
意味になる。
|
||||||
|
|
||||||
\n 番号指定参照 (n >= 1)
|
(?(条件式)成功式) 条件式が成功すれば成功式を実行する
|
||||||
\k<n> 番号指定参照 (n >= 1)
|
(条件式が通常の式のときには、この構文は不必要だが
|
||||||
\k'n' 番号指定参照 (n >= 1)
|
今のところエラーにはしない。)
|
||||||
\k<-n> 相対番号指定参照 (n >= 1)
|
|
||||||
\k'-n' 相対番号指定参照 (n >= 1)
|
|
||||||
\k<name> 名前指定参照
|
|
||||||
\k'name' 名前指定参照
|
|
||||||
|
|
||||||
名前指定参照で、その名前が複数の式集合で多重定義されている場合には、
|
|
||||||
番号の大きい式集合から優先的に参照される。
|
|
||||||
(マッチしないときには番号の小さい式集合が参照される)
|
|
||||||
|
|
||||||
※ 番号指定参照は、名前付き捕獲式集合が定義され、
|
|
||||||
かつ ONIG_OPTION_CAPTURE_GROUPが指定されていない場合には、
|
|
||||||
禁止される。(10. 捕獲式集合 を参照)
|
|
||||||
|
|
||||||
|
|
||||||
ネストレベル付き後方参照
|
条件式は後方参照の番号/名前または普通の式を使用できる。
|
||||||
|
条件式が後方参照の場合、成功式と失敗式の両方を省略可能であり、
|
||||||
|
この場合、後方参照値有効性を調べる(成功/失敗)機能のみになる。
|
||||||
|
|
||||||
|
[後方参照値有効性確認器] (* 原作)
|
||||||
|
(?(n)), (?(-n)), (?(+n)), (?(n+level)) ...
|
||||||
|
(?(<n>)), (?('-n')), (?(<+n>)) ...
|
||||||
|
(?(<name>)), (?('name')), (?(<name+level>)) ...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
8. 後方参照
|
||||||
|
|
||||||
|
\n 番号指定参照 (n >= 1)
|
||||||
|
\k<n> 番号指定参照 (n >= 1)
|
||||||
|
\k'n' 番号指定参照 (n >= 1)
|
||||||
|
\k<-n> 相対番号指定参照 (n >= 1)
|
||||||
|
\k'-n' 相対番号指定参照 (n >= 1)
|
||||||
|
\k<+n> 相対番号指定参照 (n >= 1)
|
||||||
|
\k'+n' 相対番号指定参照 (n >= 1)
|
||||||
|
\k<name> 名前指定参照
|
||||||
|
\k'name' 名前指定参照
|
||||||
|
|
||||||
|
名前指定参照で、その名前が複数の式集合で多重定義されている場合には、
|
||||||
|
番号の大きい式集合から優先的に参照される。
|
||||||
|
(マッチしないときには番号の小さい式集合が参照される)
|
||||||
|
|
||||||
|
※ 番号指定参照は、名前付き捕獲式集合が定義され、
|
||||||
|
かつ ONIG_OPTION_CAPTURE_GROUPが指定されていない場合には、
|
||||||
|
禁止される。(10. 捕獲式集合 を参照)
|
||||||
|
|
||||||
|
|
||||||
|
ネストレベル付き後方参照
|
||||||
|
|
||||||
level: 0, 1, 2, ...
|
level: 0, 1, 2, ...
|
||||||
|
|
||||||
|
@ -264,14 +345,14 @@
|
||||||
\k'name+level'
|
\k'name+level'
|
||||||
\k'name-level'
|
\k'name-level'
|
||||||
|
|
||||||
後方参照の位置から相対的な部分式呼出しネストレベルを指定して、そのレベルでの
|
後方参照の位置から相対的な部分式呼出しネストレベルを指定して、そのレベルでの
|
||||||
捕獲値を参照する。
|
捕獲値を参照する。
|
||||||
|
|
||||||
例-1.
|
例-1.
|
||||||
|
|
||||||
/\A(?<a>|.|(?:(?<b>.)\g<a>\k<b+0>))\z/.match("reer")
|
/\A(?<a>|.|(?:(?<b>.)\g<a>\k<b+0>))\z/.match("reer")
|
||||||
|
|
||||||
例-2.
|
例-2.
|
||||||
|
|
||||||
r = Regexp.compile(<<'__REGEXP__'.strip, Regexp::EXTENDED)
|
r = Regexp.compile(<<'__REGEXP__'.strip, Regexp::EXTENDED)
|
||||||
(?<element> \g<stag> \g<content>* \g<etag> ){0}
|
(?<element> \g<stag> \g<content>* \g<etag> ){0}
|
||||||
|
@ -286,164 +367,167 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
9. 部分式呼出し ("田中哲スペシャル")
|
9. 部分式呼出し ("田中哲スペシャル") (* 原作)
|
||||||
|
|
||||||
\g<name> 名前指定呼出し
|
\g<name> 名前指定呼出し
|
||||||
\g'name' 名前指定呼出し
|
\g'name' 名前指定呼出し
|
||||||
\g<n> 番号指定呼出し (n >= 1)
|
\g<n> 番号指定呼出し (n >= 1)
|
||||||
\g'n' 番号指定呼出し (n >= 1)
|
\g'n' 番号指定呼出し (n >= 1)
|
||||||
\g<-n> 相対番号指定呼出し (n >= 1)
|
\g<0> 番号指定呼出し(全体呼び出し)
|
||||||
\g'-n' 相対番号指定呼出し (n >= 1)
|
\g'0' 番号指定呼出し(全体呼び出し)
|
||||||
|
\g<-n> 相対番号指定呼出し (n >= 1)
|
||||||
|
\g'-n' 相対番号指定呼出し (n >= 1)
|
||||||
|
\g<+n> 相対番号指定呼出し (n >= 1)
|
||||||
|
\g'+n' 相対番号指定呼出し (n >= 1)
|
||||||
|
|
||||||
※ 最左位置での再帰呼出しは禁止される。
|
※ 最左位置での再帰呼出しは禁止される。
|
||||||
例. (?<name>a|\g<name>b) => error
|
例. (?<name>a|\g<name>b) => error
|
||||||
(?<name>a|b\g<name>c) => OK
|
(?<name>a|b\g<name>c) => OK
|
||||||
|
|
||||||
※ 番号指定呼出しは、名前付き捕獲式集合が定義され、
|
※ 番号指定呼出しは、名前付き捕獲式集合が定義され、
|
||||||
かつ ONIG_OPTION_CAPTURE_GROUPが指定されていない場合には、
|
かつ ONIG_OPTION_CAPTURE_GROUPが指定されていない場合には、
|
||||||
禁止される。 (10. 捕獲式集合 を参照)
|
禁止される。 (10. 捕獲式集合 を参照)
|
||||||
|
|
||||||
※ 呼び出された式集合のオプション状態が呼出し側のオプション状態と異なっている
|
※ 呼び出された式集合のオプション状態が呼出し側のオプション状態と異なっている
|
||||||
とき、呼び出された側のオプション状態が有効である。
|
とき、呼び出された側のオプション状態が有効である。
|
||||||
|
|
||||||
例. (?-i:\g<name>)(?i:(?<name>a)){0} は "A" に照合成功する。
|
例. (?-i:\g<name>)(?i:(?<name>a)){0} は "A" に照合成功する。
|
||||||
|
|
||||||
|
|
||||||
10. 捕獲式集合
|
10. 捕獲式集合
|
||||||
|
|
||||||
捕獲式集合(...)は、以下の条件に応じて振舞が変化する。
|
捕獲式集合(...)は、以下の条件に応じて振舞が変化する。
|
||||||
(名前付き捕獲式集合は変化しない)
|
(名前付き捕獲式集合は変化しない)
|
||||||
|
|
||||||
case 1. /.../ (名前付き捕獲式集合は不使用、オプションなし)
|
case 1. /.../ (名前付き捕獲式集合は不使用、オプションなし)
|
||||||
|
|
||||||
(...) は、捕獲式集合として扱われる。
|
(...) は、捕獲式集合として扱われる。
|
||||||
|
|
||||||
case 2. /.../g (名前付き捕獲式集合は不使用、オプション 'g'を指定)
|
case 2. /.../g (名前付き捕獲式集合は不使用、オプション 'g'を指定)
|
||||||
|
|
||||||
(...) は、非捕獲式集合として扱われる。
|
(...) は、非捕獲式集合として扱われる。
|
||||||
|
|
||||||
case 3. /..(?<name>..)../ (名前付き捕獲式集合は使用、オプションなし)
|
case 3. /..(?<name>..)../ (名前付き捕獲式集合は使用、オプションなし)
|
||||||
|
|
||||||
(...) は、非捕獲式集合として扱われる。
|
(...) は、非捕獲式集合として扱われる。
|
||||||
番号指定参照/呼び出しは不許可。
|
番号指定参照/呼び出しは不許可。
|
||||||
|
|
||||||
case 4. /..(?<name>..)../G (名前付き捕獲式集合は使用、オプション 'G'を指定)
|
case 4. /..(?<name>..)../G (名前付き捕獲式集合は使用、オプション 'G'を指定)
|
||||||
|
|
||||||
(...) は、捕獲式集合として扱われる。
|
(...) は、捕獲式集合として扱われる。
|
||||||
番号指定参照/呼び出しは許可。
|
番号指定参照/呼び出しは許可。
|
||||||
|
|
||||||
但し
|
但し
|
||||||
g: ONIG_OPTION_DONT_CAPTURE_GROUP
|
g: ONIG_OPTION_DONT_CAPTURE_GROUP
|
||||||
G: ONIG_OPTION_CAPTURE_GROUP
|
G: ONIG_OPTION_CAPTURE_GROUP
|
||||||
('g'と'G'オプションは、ruby-dev MLで議論された。)
|
('g'と'G'オプションは、ruby-dev MLで議論された。)
|
||||||
|
|
||||||
これらの振舞の意味は、
|
これらの振舞の意味は、
|
||||||
名前付き捕獲と名前無し捕獲を同時に使用する必然性のある場面は少ないであろう
|
名前付き捕獲と名前無し捕獲を同時に使用する必然性のある場面は少ないであろう
|
||||||
という理由から考えられたものである。
|
という理由から考えられたものである。
|
||||||
|
|
||||||
|
|
||||||
-----------------------------
|
-----------------------------
|
||||||
補記 1. 文法依存オプション
|
補記 1. 文法依存オプション
|
||||||
|
|
||||||
+ ONIG_SYNTAX_RUBY
|
+ ONIG_SYNTAX_ONIGURUMA
|
||||||
(?m): 終止符記号(.)は改行と照合成功
|
(?m): 終止符記号(.)は改行と照合成功
|
||||||
|
|
||||||
+ ONIG_SYNTAX_PERL と ONIG_SYNTAX_JAVA
|
+ ONIG_SYNTAX_PERL と ONIG_SYNTAX_JAVA
|
||||||
(?s): 終止符記号(.)は改行と照合成功
|
(?s): 終止符記号(.)は改行と照合成功
|
||||||
(?m): ^ は改行の直後に照合する、$ は改行の直前に照合する
|
(?m): ^ は改行の直後に照合する、$ は改行の直前に照合する
|
||||||
|
|
||||||
|
|
||||||
補記 2. 独自拡張機能
|
補記 2. 独自拡張機能
|
||||||
|
|
||||||
+ 16進数数字、非16進数字 \h, \H
|
+ 16進数数字、非16進数字 \h, \H
|
||||||
+ 名前付き捕獲式集合 (?<name>...), (?'name'...)
|
+ 名前付き捕獲式集合 (?<name>...), (?'name'...)
|
||||||
+ 名前指定後方参照 \k<name>
|
+ 名前指定後方参照 \k<name>
|
||||||
+ 部分式呼出し \g<name>, \g<group-num>
|
+ 部分式呼出し \g<name>, \g<group-num>
|
||||||
|
|
||||||
|
|
||||||
補記 3. Perl 5.8.0と比較して存在しない機能
|
補記 3. Perl 5.8.0と比較して存在しない機能
|
||||||
|
|
||||||
+ \N{name}
|
+ \N{name}
|
||||||
+ \l,\u,\L,\U, \X, \C
|
+ \l,\u,\L,\U,\C
|
||||||
+ (?{code})
|
+ (?{code})
|
||||||
+ (??{code})
|
+ (??{code})
|
||||||
+ (?(condition)yes-pat|no-pat)
|
|
||||||
|
|
||||||
* \Q...\E
|
* \Q...\E
|
||||||
但しONIG_SYNTAX_PERLとONIG_SYNTAX_JAVAでは有効
|
但しONIG_SYNTAX_PERLとONIG_SYNTAX_JAVAでは有効
|
||||||
|
|
||||||
|
|
||||||
補記 4. Ruby 1.8 の日本語化 GNU regex(version 0.12)との違い
|
補記 4. Ruby 1.8 の日本語化 GNU regex(version 0.12)との違い
|
||||||
|
|
||||||
+ 文字Property機能追加 (\p{property}, \P{Property})
|
+ 文字Property機能追加 (\p{property}, \P{Property})
|
||||||
+ 16進数字タイプ追加 (\h, \H)
|
+ 16進数字タイプ追加 (\h, \H)
|
||||||
+ 戻り読み機能を追加
|
+ 戻り読み機能を追加
|
||||||
+ 強欲な繰り返し指定子を追加 (?+, *+, ++)
|
+ 強欲な繰り返し指定子を追加 (?+, *+, ++)
|
||||||
+ 文字集合の中の演算子を追加 ([...], &&)
|
+ 文字集合の中の演算子を追加 ([...], &&)
|
||||||
('[' は、文字集合の中で通常の文字として使用するときには
|
('[' は、文字集合の中で通常の文字として使用するときには
|
||||||
退避修飾しなければならない)
|
退避修飾しなければならない)
|
||||||
+ 名前付き捕獲式集合と、部分式呼出し機能追加
|
+ 名前付き捕獲式集合と、部分式呼出し機能追加
|
||||||
+ 多バイト文字コードが指定されているとき、
|
+ 多バイト文字コードが指定されているとき、
|
||||||
文字集合の中で八進数または十六進数表現の連続は、多バイト符号で表現された
|
文字集合の中で八進数または十六進数表現の連続は、多バイト符号で表現された
|
||||||
一個の文字と解釈される
|
一個の文字と解釈される
|
||||||
(例. [\xa1\xa2], [\xa1\xa7-\xa4\xa1])
|
(例. [\xa1\xa2], [\xa1\xa7-\xa4\xa1])
|
||||||
+ 文字集合の中で、一バイト文字と多バイト文字の範囲指定は許される。
|
+ 文字集合の中で、一バイト文字と多バイト文字の範囲指定は許される。
|
||||||
ex. /[a-あ]/
|
ex. /[a-あ]/
|
||||||
+ 孤立オプションの有効範囲は、その孤立オプションを含んでいる式集合の
|
+ 孤立オプションの有効範囲は、その孤立オプションを含んでいる式集合の
|
||||||
終わりまでである
|
終わりまでである
|
||||||
例. (?:(?i)a|b) は (?:(?i:a|b)) と解釈される、(?:(?i:a)|b)ではない
|
例. (?:(?i)a|b) は (?:(?i:a|b)) と解釈される、(?:(?i:a)|b)ではない
|
||||||
+ 孤立オプションはその前の式に対して透過的ではない
|
+ 孤立オプションはその前の式に対して透過的ではない
|
||||||
例. /a(?i)*/ は文法エラーとなる
|
例. /a(?i)*/ は文法エラーとなる
|
||||||
+ 不完全な繰り返し範囲指定子は通常の文字列として許可される
|
+ 不完全な繰り返し範囲指定子は通常の文字列として許可される
|
||||||
例. /{/, /({)/, /a{2,3/
|
例. /{/, /({)/, /a{2,3/
|
||||||
+ 否定的POSIXブラケット [:^xxxx:] を追加
|
+ 否定的POSIXブラケット [:^xxxx:] を追加
|
||||||
+ POSIXブラケット [:ascii:] を追加
|
+ POSIXブラケット [:ascii:] を追加
|
||||||
+ 先読みの繰り返しは不許可
|
+ 先読みの繰り返しは不許可
|
||||||
例. /(?=a)*/, /(?!b){5}/
|
例. /(?=a)*/, /(?!b){5}/
|
||||||
+ 数値で指定された文字に対しても、大文字小文字照合オプションは有効
|
+ 数値で指定された文字に対しても、大文字小文字照合オプションは有効
|
||||||
例. /\x61/i =~ "A"
|
例. /\x61/i =~ "A"
|
||||||
+ 繰り返し回数指定で、最低回数の省略(0回)ができる
|
+ 繰り返し回数指定で、最低回数の省略(0回)ができる
|
||||||
/a{,n}/ == /a{0,n}/
|
/a{,n}/ == /a{0,n}/
|
||||||
最低回数と最大回数の同時省略は許されない。(/a{,}/)
|
最低回数と最大回数の同時省略は許されない。(/a{,}/)
|
||||||
+ /a{n}?/は無欲な演算子ではない。
|
+ /a{n}?/は無欲な演算子ではない。
|
||||||
/a{n}?/ == /(?:a{n})?/
|
/a{n}?/ == /(?:a{n})?/
|
||||||
+ 無効な後方参照をチェックしてエラーにする。
|
+ 無効な後方参照をチェックしてエラーにする。
|
||||||
/\1/, /(a)\2/
|
/\1/, /(a)\2/
|
||||||
+ 無限繰り返しの中で、長さ零での照合成功は繰り返しを中断させるが、
|
+ 無限繰り返しの中で、長さ零での照合成功は繰り返しを中断させるが、
|
||||||
このとき、中断すべきかどうかの判定として、捕獲式集合の捕獲状態の
|
このとき、中断すべきかどうかの判定として、捕獲式集合の捕獲状態の
|
||||||
変化まで考慮している
|
変化まで考慮している
|
||||||
/(?:()|())*\1\2/ =~ ""
|
/(?:()|())*\1\2/ =~ ""
|
||||||
/(?:\1a|())*/ =~ "a"
|
/(?:\1a|())*/ =~ "a"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
補記 5. 実装されているが、既定値では有効にしていない機能
|
補記 5. 実装されているが、既定値では有効にしていない機能
|
||||||
|
|
||||||
+ 捕獲履歴参照
|
+ 捕獲履歴参照
|
||||||
|
|
||||||
(?@...) と (?@<name>...)
|
(?@...) と (?@<name>...)
|
||||||
|
|
||||||
例. /(?@a)*/.match("aaa") ==> [<0-1>, <1-2>, <2-3>]
|
例. /(?@a)*/.match("aaa") ==> [<0-1>, <1-2>, <2-3>]
|
||||||
|
|
||||||
使用方法は、sample/listcap.cを参照
|
使用方法は、sample/listcap.cを参照
|
||||||
|
|
||||||
有効にしていない理由は、どの程度役に立つかはっきりしないため。
|
有効にしていない理由は、どの程度役に立つかはっきりしないため。
|
||||||
|
|
||||||
|
|
||||||
補記 6. 問題点
|
補記 6. 問題点
|
||||||
|
|
||||||
+ エンコーディングバイト値が適正な価かどうかのチェックは行なっていない。
|
+ エンコーディングバイト値が適正な価かどうかのチェックは行なっていない。
|
||||||
|
|
||||||
例: UTF-8
|
例: UTF-8
|
||||||
|
|
||||||
* 先頭バイトとして不正なバイトを一文字とみなす
|
* 先頭バイトとして不正なバイトを一文字とみなす
|
||||||
/./u =~ "\xa3"
|
/./u =~ "\xa3"
|
||||||
|
|
||||||
* 不完全なバイトシーケンスのチェックをしない
|
* 不完全なバイトシーケンスのチェックをしない
|
||||||
/\w+/u =~ "a\xf3\x8ec"
|
/\w+/u =~ "a\xf3\x8ec"
|
||||||
|
|
||||||
これを調べることは可能ではあるが、遅くなるので行なわない。
|
これを調べることは可能ではあるが、遅くなるので行なわない。
|
||||||
|
|
||||||
文字列として、そのようなバイト列を指定した場合の動作は保証しない。
|
文字列として、そのようなバイト列を指定した場合の動作は保証しない。
|
||||||
|
|
||||||
終り
|
終り
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,7 @@
|
||||||
<h1>Oniguruma</h1> (<a href="index_ja.html">Japanese</a>)
|
<h1>Oniguruma</h1> (<a href="index_ja.html">Japanese</a>)
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
(c) K.Kosako, updated at: 2017/05/26
|
(c) K.Kosako, updated at: 2018/01/25
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
|
@ -16,6 +16,12 @@
|
||||||
<dt><b>What's new</b>
|
<dt><b>What's new</b>
|
||||||
</font>
|
</font>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>2018/01/26: Version 6.7.1 released.</li>
|
||||||
|
<li>2017/12/11: Version 6.7.0 released.</li>
|
||||||
|
<li>2017/08/30: Version 6.6.1 released.</li>
|
||||||
|
<li>2017/08/28: Version 6.6.0 released.</li>
|
||||||
|
<li>2017/08/03: Version 6.5.0 released.</li>
|
||||||
|
<li>2017/07/03: Version 6.4.0 released.</li>
|
||||||
<li>2017/05/29: Version 6.3.0 released.</li>
|
<li>2017/05/29: Version 6.3.0 released.</li>
|
||||||
<li>2017/04/08: Version 6.2.0 released.</li>
|
<li>2017/04/08: Version 6.2.0 released.</li>
|
||||||
<li>2016/12/11: Version 6.1.3 released.</li>
|
<li>2016/12/11: Version 6.1.3 released.</li>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<h1>鬼車</h1>
|
<h1>鬼車</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
(c) K.Kosako, 最終更新: 2017/05/26
|
(c) K.Kosako, 最終更新: 2018/01/26
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
|
@ -16,6 +16,12 @@
|
||||||
<dt><b>更新情報</b>
|
<dt><b>更新情報</b>
|
||||||
</font>
|
</font>
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>2018/01/26: Version 6.7.1 リリース</li>
|
||||||
|
<li>2017/12/11: Version 6.7.0 リリース</li>
|
||||||
|
<li>2017/08/30: Version 6.6.1 リリース</li>
|
||||||
|
<li>2017/08/28: Version 6.6.0 リリース</li>
|
||||||
|
<li>2017/08/03: Version 6.5.0 リリース</li>
|
||||||
|
<li>2017/07/03: Version 6.4.0 リリース</li>
|
||||||
<li>2017/05/29: Version 6.3.0 リリース</li>
|
<li>2017/05/29: Version 6.3.0 リリース</li>
|
||||||
<li>2017/04/08: Version 6.2.0 リリース</li>
|
<li>2017/04/08: Version 6.2.0 リリース</li>
|
||||||
<li>2016/12/11: Version 6.1.3 リリース</li>
|
<li>2016/12/11: Version 6.1.3 リリース</li>
|
||||||
|
|
|
@ -151,7 +151,7 @@ big5_left_adjust_char_head(const UChar* start, const UChar* s)
|
||||||
p++;
|
p++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
len = enclen(ONIG_ENCODING_BIG5, p);
|
len = enclen(ONIG_ENCODING_BIG5, p);
|
||||||
if (p + len > s) return (UChar* )p;
|
if (p + len > s) return (UChar* )p;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
euc_jp.c - Oniguruma (regular expression library)
|
euc_jp.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -151,8 +151,8 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
|
||||||
#if 1
|
#if 1
|
||||||
if (enclen(ONIG_ENCODING_EUC_JP, buf) != (p - buf))
|
if (enclen(ONIG_ENCODING_EUC_JP, buf) != (p - buf))
|
||||||
return ONIGERR_INVALID_CODE_POINT_VALUE;
|
return ONIGERR_INVALID_CODE_POINT_VALUE;
|
||||||
#endif
|
#endif
|
||||||
return p - buf;
|
return (int )(p - buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -230,7 +230,7 @@ static int
|
||||||
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
||||||
{
|
{
|
||||||
struct PropertyNameCtype* pc;
|
struct PropertyNameCtype* pc;
|
||||||
int len = end - p;
|
int len = (int )(end - p);
|
||||||
char q[32];
|
char q[32];
|
||||||
|
|
||||||
if (len < sizeof(q) - 1) {
|
if (len < sizeof(q) - 1) {
|
||||||
|
@ -252,7 +252,7 @@ is_code_ctype(OnigCodePoint code, unsigned int ctype)
|
||||||
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
|
return ONIGENC_IS_ASCII_CODE_CTYPE(code, ctype);
|
||||||
else {
|
else {
|
||||||
if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) {
|
if (CTYPE_IS_WORD_GRAPH_PRINT(ctype)) {
|
||||||
return (code_to_mbclen(code) > 1 ? TRUE : FALSE);
|
return (code_to_mbclen(code) > 1 ? TRUE : FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
onigposix.h - Oniguruma (regular expression library)
|
onigposix.h - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2005 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -97,7 +97,7 @@ typedef struct {
|
||||||
|
|
||||||
#ifndef ONIG_EXTERN
|
#ifndef ONIG_EXTERN
|
||||||
#if defined(_WIN32) && !defined(__GNUC__)
|
#if defined(_WIN32) && !defined(__GNUC__)
|
||||||
#if defined(EXPORT)
|
#if defined(ONIGURUMA_EXPORT)
|
||||||
#define ONIG_EXTERN extern __declspec(dllexport)
|
#define ONIG_EXTERN extern __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define ONIG_EXTERN extern __declspec(dllimport)
|
#define ONIG_EXTERN extern __declspec(dllimport)
|
||||||
|
@ -128,6 +128,7 @@ ONIG_EXTERN OnigSyntaxType OnigSyntaxGnuRegex;
|
||||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxJava;
|
ONIG_EXTERN OnigSyntaxType OnigSyntaxJava;
|
||||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl;
|
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl;
|
||||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
|
ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
|
||||||
|
ONIG_EXTERN OnigSyntaxType OnigSyntaxOniguruma;
|
||||||
|
|
||||||
/* predefined syntaxes (see regsyntax.c) */
|
/* predefined syntaxes (see regsyntax.c) */
|
||||||
#define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic)
|
#define ONIG_SYNTAX_POSIX_BASIC (&OnigSyntaxPosixBasic)
|
||||||
|
@ -138,6 +139,7 @@ ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
|
||||||
#define ONIG_SYNTAX_JAVA (&OnigSyntaxJava)
|
#define ONIG_SYNTAX_JAVA (&OnigSyntaxJava)
|
||||||
#define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)
|
#define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)
|
||||||
#define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
|
#define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
|
||||||
|
#define ONIG_SYNTAX_ONIGURUMA (&OnigSyntaxOniguruma)
|
||||||
/* default syntax */
|
/* default syntax */
|
||||||
#define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax
|
#define ONIG_SYNTAX_DEFAULT OnigDefaultSyntax
|
||||||
|
|
||||||
|
@ -147,6 +149,7 @@ ONIG_EXTERN int onig_set_default_syntax P_((OnigSyntaxType* syntax));
|
||||||
ONIG_EXTERN void onig_copy_syntax P_((OnigSyntaxType* to, OnigSyntaxType* from));
|
ONIG_EXTERN void onig_copy_syntax P_((OnigSyntaxType* to, OnigSyntaxType* from));
|
||||||
ONIG_EXTERN const char* onig_version P_((void));
|
ONIG_EXTERN const char* onig_version P_((void));
|
||||||
ONIG_EXTERN const char* onig_copyright P_((void));
|
ONIG_EXTERN const char* onig_copyright P_((void));
|
||||||
|
ONIG_EXTERN int onig_end P_((void));
|
||||||
|
|
||||||
#endif /* ONIGURUMA_H */
|
#endif /* ONIGURUMA_H */
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
oniguruma.h - Oniguruma (regular expression library)
|
oniguruma.h - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -35,8 +35,8 @@ extern "C" {
|
||||||
|
|
||||||
#define ONIGURUMA
|
#define ONIGURUMA
|
||||||
#define ONIGURUMA_VERSION_MAJOR 6
|
#define ONIGURUMA_VERSION_MAJOR 6
|
||||||
#define ONIGURUMA_VERSION_MINOR 3
|
#define ONIGURUMA_VERSION_MINOR 7
|
||||||
#define ONIGURUMA_VERSION_TEENY 0
|
#define ONIGURUMA_VERSION_TEENY 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
# ifndef HAVE_PROTOTYPES
|
# ifndef HAVE_PROTOTYPES
|
||||||
|
@ -78,7 +78,7 @@ extern "C" {
|
||||||
|
|
||||||
#ifndef ONIG_EXTERN
|
#ifndef ONIG_EXTERN
|
||||||
#if defined(_WIN32) && !defined(__GNUC__)
|
#if defined(_WIN32) && !defined(__GNUC__)
|
||||||
#if defined(EXPORT) || defined(RUBY_EXPORT)
|
#if defined(ONIGURUMA_EXPORT)
|
||||||
#define ONIG_EXTERN extern __declspec(dllexport)
|
#define ONIG_EXTERN extern __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define ONIG_EXTERN extern __declspec(dllimport)
|
#define ONIG_EXTERN extern __declspec(dllimport)
|
||||||
|
@ -143,7 +143,7 @@ typedef struct {
|
||||||
OnigCodePoint one_or_more_time;
|
OnigCodePoint one_or_more_time;
|
||||||
OnigCodePoint anychar_anytime;
|
OnigCodePoint anychar_anytime;
|
||||||
} OnigMetaCharTableType;
|
} OnigMetaCharTableType;
|
||||||
|
|
||||||
typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg);
|
typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg);
|
||||||
|
|
||||||
typedef struct OnigEncodingTypeST {
|
typedef struct OnigEncodingTypeST {
|
||||||
|
@ -270,7 +270,7 @@ ONIG_EXTERN OnigEncodingType OnigEncodingGB18030;
|
||||||
#define ONIGENC_IS_CODE_ASCII(code) ((code) < 128)
|
#define ONIGENC_IS_CODE_ASCII(code) ((code) < 128)
|
||||||
#define ONIGENC_IS_MBC_WORD(enc,s,end) \
|
#define ONIGENC_IS_MBC_WORD(enc,s,end) \
|
||||||
ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end))
|
ONIGENC_IS_CODE_WORD(enc,ONIGENC_MBC_TO_CODE(enc,s,end))
|
||||||
|
#define ONIGENC_IS_MBC_WORD_ASCII(enc,s,end) onigenc_is_mbc_word_ascii(enc,s,end)
|
||||||
|
|
||||||
#define ONIGENC_NAME(enc) ((enc)->name)
|
#define ONIGENC_NAME(enc) ((enc)->name)
|
||||||
|
|
||||||
|
@ -385,6 +385,7 @@ typedef unsigned int OnigOptionType;
|
||||||
|
|
||||||
/* options */
|
/* options */
|
||||||
#define ONIG_OPTION_NONE 0U
|
#define ONIG_OPTION_NONE 0U
|
||||||
|
/* options (compile time) */
|
||||||
#define ONIG_OPTION_IGNORECASE 1U
|
#define ONIG_OPTION_IGNORECASE 1U
|
||||||
#define ONIG_OPTION_EXTEND (ONIG_OPTION_IGNORECASE << 1)
|
#define ONIG_OPTION_EXTEND (ONIG_OPTION_IGNORECASE << 1)
|
||||||
#define ONIG_OPTION_MULTILINE (ONIG_OPTION_EXTEND << 1)
|
#define ONIG_OPTION_MULTILINE (ONIG_OPTION_EXTEND << 1)
|
||||||
|
@ -395,11 +396,18 @@ typedef unsigned int OnigOptionType;
|
||||||
#define ONIG_OPTION_DONT_CAPTURE_GROUP (ONIG_OPTION_NEGATE_SINGLELINE << 1)
|
#define ONIG_OPTION_DONT_CAPTURE_GROUP (ONIG_OPTION_NEGATE_SINGLELINE << 1)
|
||||||
#define ONIG_OPTION_CAPTURE_GROUP (ONIG_OPTION_DONT_CAPTURE_GROUP << 1)
|
#define ONIG_OPTION_CAPTURE_GROUP (ONIG_OPTION_DONT_CAPTURE_GROUP << 1)
|
||||||
/* options (search time) */
|
/* options (search time) */
|
||||||
#define ONIG_OPTION_NOTBOL (ONIG_OPTION_CAPTURE_GROUP << 1)
|
#define ONIG_OPTION_NOTBOL (ONIG_OPTION_CAPTURE_GROUP << 1)
|
||||||
#define ONIG_OPTION_NOTEOL (ONIG_OPTION_NOTBOL << 1)
|
#define ONIG_OPTION_NOTEOL (ONIG_OPTION_NOTBOL << 1)
|
||||||
#define ONIG_OPTION_POSIX_REGION (ONIG_OPTION_NOTEOL << 1)
|
#define ONIG_OPTION_POSIX_REGION (ONIG_OPTION_NOTEOL << 1)
|
||||||
#define ONIG_OPTION_CHECK_VALIDITY_OF_STRING (ONIG_OPTION_POSIX_REGION << 1)
|
#define ONIG_OPTION_CHECK_VALIDITY_OF_STRING (ONIG_OPTION_POSIX_REGION << 1)
|
||||||
#define ONIG_OPTION_MAXBIT ONIG_OPTION_CHECK_VALIDITY_OF_STRING /* limit */
|
/* #define ONIG_OPTION_CRLF_AS_LINE_SEPARATOR (ONIG_OPTION_CHECK_VALIDITY_OF_STRING << 1) */
|
||||||
|
/* options (compile time) */
|
||||||
|
#define ONIG_OPTION_WORD_IS_ASCII (ONIG_OPTION_CHECK_VALIDITY_OF_STRING << 4)
|
||||||
|
#define ONIG_OPTION_DIGIT_IS_ASCII (ONIG_OPTION_WORD_IS_ASCII << 1)
|
||||||
|
#define ONIG_OPTION_SPACE_IS_ASCII (ONIG_OPTION_DIGIT_IS_ASCII << 1)
|
||||||
|
#define ONIG_OPTION_POSIX_IS_ASCII (ONIG_OPTION_SPACE_IS_ASCII << 1)
|
||||||
|
|
||||||
|
#define ONIG_OPTION_MAXBIT ONIG_OPTION_POSIX_IS_ASCII /* limit */
|
||||||
|
|
||||||
#define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt))
|
#define ONIG_OPTION_ON(options,regopt) ((options) |= (regopt))
|
||||||
#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
|
#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
|
||||||
|
@ -424,6 +432,7 @@ ONIG_EXTERN OnigSyntaxType OnigSyntaxJava;
|
||||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl;
|
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl;
|
||||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl_NG;
|
ONIG_EXTERN OnigSyntaxType OnigSyntaxPerl_NG;
|
||||||
ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
|
ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
|
||||||
|
ONIG_EXTERN OnigSyntaxType OnigSyntaxOniguruma;
|
||||||
|
|
||||||
/* predefined syntaxes (see regsyntax.c) */
|
/* predefined syntaxes (see regsyntax.c) */
|
||||||
#define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS)
|
#define ONIG_SYNTAX_ASIS (&OnigSyntaxASIS)
|
||||||
|
@ -436,6 +445,7 @@ ONIG_EXTERN OnigSyntaxType OnigSyntaxRuby;
|
||||||
#define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)
|
#define ONIG_SYNTAX_PERL (&OnigSyntaxPerl)
|
||||||
#define ONIG_SYNTAX_PERL_NG (&OnigSyntaxPerl_NG)
|
#define ONIG_SYNTAX_PERL_NG (&OnigSyntaxPerl_NG)
|
||||||
#define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
|
#define ONIG_SYNTAX_RUBY (&OnigSyntaxRuby)
|
||||||
|
#define ONIG_SYNTAX_ONIGURUMA (&OnigSyntaxOniguruma)
|
||||||
|
|
||||||
/* default syntax */
|
/* default syntax */
|
||||||
ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
|
ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
|
||||||
|
@ -496,6 +506,13 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
|
||||||
/* #define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) */
|
/* #define ONIG_SYN_OP2_CHAR_PROPERTY_PREFIX_IS (1U<<18) */
|
||||||
#define ONIG_SYN_OP2_ESC_H_XDIGIT (1U<<19) /* \h, \H */
|
#define ONIG_SYN_OP2_ESC_H_XDIGIT (1U<<19) /* \h, \H */
|
||||||
#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1U<<20) /* \ */
|
#define ONIG_SYN_OP2_INEFFECTIVE_ESCAPE (1U<<20) /* \ */
|
||||||
|
#define ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE (1U<<21) /* (?(n)) (?(...)...|...) */
|
||||||
|
#define ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP (1U<<22) /* \K */
|
||||||
|
#define ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE (1U<<23) /* \R \r\n else [\x0a-\x0d] */
|
||||||
|
#define ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT (1U<<24) /* \N (?-m:.), \O (?m:.) */
|
||||||
|
#define ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP (1U<<25) /* (?~...) */
|
||||||
|
#define ONIG_SYN_OP2_ESC_X_Y_GRAPHEME_CLUSTER (1U<<26) /* \X \y \Y */
|
||||||
|
#define ONIG_SYN_OP2_QMARK_PERL_SUBEXP_CALL (1U<<27) /* (?R), (?&name)... */
|
||||||
|
|
||||||
/* syntax (behavior) */
|
/* syntax (behavior) */
|
||||||
#define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */
|
#define ONIG_SYN_CONTEXT_INDEP_ANCHORS (1U<<31) /* not implemented */
|
||||||
|
@ -545,11 +562,12 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
|
||||||
#define ONIGERR_UNEXPECTED_BYTECODE -14
|
#define ONIGERR_UNEXPECTED_BYTECODE -14
|
||||||
#define ONIGERR_MATCH_STACK_LIMIT_OVER -15
|
#define ONIGERR_MATCH_STACK_LIMIT_OVER -15
|
||||||
#define ONIGERR_PARSE_DEPTH_LIMIT_OVER -16
|
#define ONIGERR_PARSE_DEPTH_LIMIT_OVER -16
|
||||||
|
#define ONIGERR_TRY_IN_MATCH_LIMIT_OVER -17
|
||||||
#define ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED -21
|
#define ONIGERR_DEFAULT_ENCODING_IS_NOT_SETTED -21
|
||||||
#define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -22
|
#define ONIGERR_SPECIFIED_ENCODING_CANT_CONVERT_TO_WIDE_CHAR -22
|
||||||
#define ONIGERR_FAIL_TO_INITIALIZE -23
|
#define ONIGERR_FAIL_TO_INITIALIZE -23
|
||||||
/* general error */
|
/* general error */
|
||||||
#define ONIGERR_INVALID_ARGUMENT -30
|
#define ONIGERR_INVALID_ARGUMENT -30
|
||||||
/* syntax error */
|
/* syntax error */
|
||||||
#define ONIGERR_END_PATTERN_AT_LEFT_BRACE -100
|
#define ONIGERR_END_PATTERN_AT_LEFT_BRACE -100
|
||||||
#define ONIGERR_END_PATTERN_AT_LEFT_BRACKET -101
|
#define ONIGERR_END_PATTERN_AT_LEFT_BRACKET -101
|
||||||
|
@ -596,6 +614,9 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
|
||||||
#define ONIGERR_NEVER_ENDING_RECURSION -221
|
#define ONIGERR_NEVER_ENDING_RECURSION -221
|
||||||
#define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY -222
|
#define ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY -222
|
||||||
#define ONIGERR_INVALID_CHAR_PROPERTY_NAME -223
|
#define ONIGERR_INVALID_CHAR_PROPERTY_NAME -223
|
||||||
|
#define ONIGERR_INVALID_IF_ELSE_SYNTAX -224
|
||||||
|
#define ONIGERR_INVALID_ABSENT_GROUP_PATTERN -225
|
||||||
|
#define ONIGERR_INVALID_ABSENT_GROUP_GENERATOR_PATTERN -226
|
||||||
#define ONIGERR_INVALID_CODE_POINT_VALUE -400
|
#define ONIGERR_INVALID_CODE_POINT_VALUE -400
|
||||||
#define ONIGERR_INVALID_WIDE_CHAR_VALUE -400
|
#define ONIGERR_INVALID_WIDE_CHAR_VALUE -400
|
||||||
#define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401
|
#define ONIGERR_TOO_BIG_WIDE_CHAR_VALUE -401
|
||||||
|
@ -609,7 +630,7 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
|
||||||
/* #define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT -1001 */
|
/* #define ONIGERR_OVER_THREAD_PASS_LIMIT_COUNT -1001 */
|
||||||
|
|
||||||
|
|
||||||
/* must be smaller than BIT_STATUS_BITS_NUM (unsigned int * 8) */
|
/* must be smaller than MEM_STATUS_BITS_NUM (unsigned int * 8) */
|
||||||
#define ONIG_MAX_CAPTURE_HISTORY_GROUP 31
|
#define ONIG_MAX_CAPTURE_HISTORY_GROUP 31
|
||||||
#define ONIG_IS_CAPTURE_HISTORY_GROUP(r, i) \
|
#define ONIG_IS_CAPTURE_HISTORY_GROUP(r, i) \
|
||||||
((i) <= ONIG_MAX_CAPTURE_HISTORY_GROUP && (r)->list && (r)->list[i])
|
((i) <= ONIG_MAX_CAPTURE_HISTORY_GROUP && (r)->list && (r)->list[i])
|
||||||
|
@ -669,7 +690,7 @@ typedef struct re_pattern_buffer {
|
||||||
|
|
||||||
int num_mem; /* used memory(...) num counted from 1 */
|
int num_mem; /* used memory(...) num counted from 1 */
|
||||||
int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */
|
int num_repeat; /* OP_REPEAT/OP_REPEAT_NG id-counter */
|
||||||
int num_null_check; /* OP_NULL_CHECK_START/END id counter */
|
int num_null_check; /* OP_EMPTY_CHECK_START/END id counter */
|
||||||
int num_comb_exp_check; /* combination explosion check */
|
int num_comb_exp_check; /* combination explosion check */
|
||||||
int num_call; /* number of subexp call */
|
int num_call; /* number of subexp call */
|
||||||
unsigned int capture_history; /* (?@...) flag (1-31) */
|
unsigned int capture_history; /* (?@...) flag (1-31) */
|
||||||
|
@ -823,6 +844,10 @@ unsigned int onig_get_match_stack_limit_size P_((void));
|
||||||
ONIG_EXTERN
|
ONIG_EXTERN
|
||||||
int onig_set_match_stack_limit_size P_((unsigned int size));
|
int onig_set_match_stack_limit_size P_((unsigned int size));
|
||||||
ONIG_EXTERN
|
ONIG_EXTERN
|
||||||
|
unsigned long onig_get_try_in_match_limit P_((void));
|
||||||
|
ONIG_EXTERN
|
||||||
|
int onig_set_try_in_match_limit P_((unsigned long n));
|
||||||
|
ONIG_EXTERN
|
||||||
unsigned int onig_get_parse_depth_limit P_((void));
|
unsigned int onig_get_parse_depth_limit P_((void));
|
||||||
ONIG_EXTERN
|
ONIG_EXTERN
|
||||||
int onig_set_capture_num_limit P_((int num));
|
int onig_set_capture_num_limit P_((int num));
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,7 +2,7 @@
|
||||||
regenc.c - Oniguruma (regular expression library)
|
regenc.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -137,7 +137,7 @@ onigenc_strlen(OnigEncoding enc, const UChar* p, const UChar* end)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
UChar* q = (UChar* )p;
|
UChar* q = (UChar* )p;
|
||||||
|
|
||||||
while (q < end) {
|
while (q < end) {
|
||||||
q += ONIGENC_MBC_ENC_LEN(enc, q);
|
q += ONIGENC_MBC_ENC_LEN(enc, q);
|
||||||
n++;
|
n++;
|
||||||
|
@ -150,7 +150,7 @@ onigenc_strlen_null(OnigEncoding enc, const UChar* s)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
UChar* p = (UChar* )s;
|
UChar* p = (UChar* )s;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (*p == '\0') {
|
if (*p == '\0') {
|
||||||
UChar* q;
|
UChar* q;
|
||||||
|
@ -780,7 +780,7 @@ onigenc_mb2_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
|
||||||
if (enclen(enc, buf) != (p - buf))
|
if (enclen(enc, buf) != (p - buf))
|
||||||
return ONIGERR_INVALID_CODE_POINT_VALUE;
|
return ONIGERR_INVALID_CODE_POINT_VALUE;
|
||||||
#endif
|
#endif
|
||||||
return p - buf;
|
return (int )(p - buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
|
@ -803,7 +803,7 @@ onigenc_mb4_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar *buf)
|
||||||
if (enclen(enc, buf) != (p - buf))
|
if (enclen(enc, buf) != (p - buf))
|
||||||
return ONIGERR_INVALID_CODE_POINT_VALUE;
|
return ONIGERR_INVALID_CODE_POINT_VALUE;
|
||||||
#endif
|
#endif
|
||||||
return p - buf;
|
return (int )(p - buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
|
@ -840,6 +840,16 @@ onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
||||||
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int
|
||||||
|
onigenc_is_mbc_word_ascii(OnigEncoding enc, UChar* s, const UChar* end)
|
||||||
|
{
|
||||||
|
OnigCodePoint code = ONIGENC_MBC_TO_CODE(enc, s, end);
|
||||||
|
|
||||||
|
if (code > 127) return 0;
|
||||||
|
|
||||||
|
return ONIGENC_IS_ASCII_CODE_WORD(code);
|
||||||
|
}
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
|
onigenc_mb2_is_code_ctype(OnigEncoding enc, OnigCodePoint code,
|
||||||
unsigned int ctype)
|
unsigned int ctype)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
regenc.h - Oniguruma (regular expression library)
|
regenc.h - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -71,6 +71,8 @@ typedef struct {
|
||||||
#define ONIG_CHECK_NULL_RETURN(p) if (ONIG_IS_NULL(p)) return NULL
|
#define ONIG_CHECK_NULL_RETURN(p) if (ONIG_IS_NULL(p)) return NULL
|
||||||
#define ONIG_CHECK_NULL_RETURN_VAL(p,val) if (ONIG_IS_NULL(p)) return (val)
|
#define ONIG_CHECK_NULL_RETURN_VAL(p,val) if (ONIG_IS_NULL(p)) return (val)
|
||||||
|
|
||||||
|
#define MAX_CODE_POINT (~((OnigCodePoint )0))
|
||||||
|
|
||||||
#define enclen(enc,p) ONIGENC_MBC_ENC_LEN(enc,p)
|
#define enclen(enc,p) ONIGENC_MBC_ENC_LEN(enc,p)
|
||||||
|
|
||||||
/* character types bit flag */
|
/* character types bit flag */
|
||||||
|
@ -109,6 +111,7 @@ struct PropertyNameCtype {
|
||||||
|
|
||||||
/* #define USE_CRNL_AS_LINE_TERMINATOR */
|
/* #define USE_CRNL_AS_LINE_TERMINATOR */
|
||||||
#define USE_UNICODE_PROPERTIES
|
#define USE_UNICODE_PROPERTIES
|
||||||
|
#define USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER
|
||||||
/* #define USE_UNICODE_CASE_FOLD_TURKISH_AZERI */
|
/* #define USE_UNICODE_CASE_FOLD_TURKISH_AZERI */
|
||||||
/* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTS #18 */
|
/* #define USE_UNICODE_ALL_LINE_TERMINATORS */ /* see Unicode.org UTS #18 */
|
||||||
|
|
||||||
|
@ -143,6 +146,7 @@ ONIG_EXTERN int onigenc_mb2_code_to_mbclen P_((OnigCodePoint code));
|
||||||
ONIG_EXTERN int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
|
ONIG_EXTERN int onigenc_mb2_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
|
||||||
ONIG_EXTERN int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
|
ONIG_EXTERN int onigenc_minimum_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
|
||||||
ONIG_EXTERN int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
|
ONIG_EXTERN int onigenc_unicode_property_name_to_ctype P_((OnigEncoding enc, UChar* p, UChar* end));
|
||||||
|
ONIG_EXTERN int onigenc_is_mbc_word_ascii P_((OnigEncoding enc, UChar* s, const UChar* end));
|
||||||
ONIG_EXTERN int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
|
ONIG_EXTERN int onigenc_mb2_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, unsigned int ctype));
|
||||||
ONIG_EXTERN int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code));
|
ONIG_EXTERN int onigenc_mb4_code_to_mbclen P_((OnigCodePoint code));
|
||||||
ONIG_EXTERN int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
|
ONIG_EXTERN int onigenc_mb4_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, UChar *buf));
|
||||||
|
@ -154,10 +158,11 @@ ONIG_EXTERN struct PropertyNameCtype* sjis_lookup_property_name P_((register con
|
||||||
/* in enc/unicode.c */
|
/* in enc/unicode.c */
|
||||||
ONIG_EXTERN int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype));
|
ONIG_EXTERN int onigenc_unicode_is_code_ctype P_((OnigCodePoint code, unsigned int ctype));
|
||||||
ONIG_EXTERN int onigenc_utf16_32_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint* ranges[]));
|
ONIG_EXTERN int onigenc_utf16_32_get_ctype_code_range P_((OnigCtype ctype, OnigCodePoint *sb_out, const OnigCodePoint* ranges[]));
|
||||||
ONIG_EXTERN int onigenc_unicode_ctype_code_range P_((int ctype, const OnigCodePoint* ranges[]));
|
ONIG_EXTERN int onigenc_unicode_ctype_code_range P_((OnigCtype ctype, const OnigCodePoint* ranges[]));
|
||||||
ONIG_EXTERN int onigenc_unicode_get_case_fold_codes_by_str P_((OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
|
ONIG_EXTERN int onigenc_unicode_get_case_fold_codes_by_str P_((OnigEncoding enc, OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[]));
|
||||||
ONIG_EXTERN int onigenc_unicode_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold));
|
ONIG_EXTERN int onigenc_unicode_mbc_case_fold P_((OnigEncoding enc, OnigCaseFoldType flag, const UChar** pp, const UChar* end, UChar* fold));
|
||||||
ONIG_EXTERN int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
|
ONIG_EXTERN int onigenc_unicode_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
|
||||||
|
ONIG_EXTERN int onigenc_egcb_is_break_position P_((OnigEncoding enc, UChar* p, UChar* prev, const UChar* start, const UChar* end));
|
||||||
|
|
||||||
|
|
||||||
#define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8)
|
#define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8)
|
||||||
|
@ -194,8 +199,8 @@ extern OnigCodePoint OnigUnicodeFolds3[];
|
||||||
|
|
||||||
struct ByUnfoldKey {
|
struct ByUnfoldKey {
|
||||||
OnigCodePoint code;
|
OnigCodePoint code;
|
||||||
int index;
|
short int index;
|
||||||
int fold_len;
|
short int fold_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct ByUnfoldKey* unicode_unfold_key(OnigCodePoint code);
|
extern const struct ByUnfoldKey* unicode_unfold_key(OnigCodePoint code);
|
||||||
|
@ -235,9 +240,13 @@ ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];
|
||||||
#define ONIGENC_ASCII_CODE_TO_UPPER_CASE(c) OnigEncAsciiToUpperCaseTable[c]
|
#define ONIGENC_ASCII_CODE_TO_UPPER_CASE(c) OnigEncAsciiToUpperCaseTable[c]
|
||||||
#define ONIGENC_IS_ASCII_CODE_CTYPE(code,ctype) \
|
#define ONIGENC_IS_ASCII_CODE_CTYPE(code,ctype) \
|
||||||
((OnigEncAsciiCtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
|
((OnigEncAsciiCtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
|
||||||
|
#define ONIGENC_IS_ASCII_CODE_WORD(code) \
|
||||||
|
((OnigEncAsciiCtypeTable[code] & CTYPE_TO_BIT(ONIGENC_CTYPE_WORD)) != 0)
|
||||||
#define ONIGENC_IS_ASCII_CODE_CASE_AMBIG(code) \
|
#define ONIGENC_IS_ASCII_CODE_CASE_AMBIG(code) \
|
||||||
(ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_UPPER) ||\
|
(ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_UPPER) ||\
|
||||||
ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_LOWER))
|
ONIGENC_IS_ASCII_CODE_CTYPE(code, ONIGENC_CTYPE_LOWER))
|
||||||
|
|
||||||
|
#define ONIGENC_IS_UNICODE_ENCODING(enc) \
|
||||||
|
((enc)->is_code_ctype == onigenc_unicode_is_code_ctype)
|
||||||
|
|
||||||
#endif /* REGENC_H */
|
#endif /* REGENC_H */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
regerror.c - Oniguruma (regular expression library)
|
regerror.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -56,6 +56,8 @@ onig_error_code_to_format(int code)
|
||||||
p = "match-stack limit over"; break;
|
p = "match-stack limit over"; break;
|
||||||
case ONIGERR_PARSE_DEPTH_LIMIT_OVER:
|
case ONIGERR_PARSE_DEPTH_LIMIT_OVER:
|
||||||
p = "parse depth limit over"; break;
|
p = "parse depth limit over"; break;
|
||||||
|
case ONIGERR_TRY_IN_MATCH_LIMIT_OVER:
|
||||||
|
p = "try-in-match limit over"; break;
|
||||||
case ONIGERR_TYPE_BUG:
|
case ONIGERR_TYPE_BUG:
|
||||||
p = "undefined type (bug)"; break;
|
p = "undefined type (bug)"; break;
|
||||||
case ONIGERR_PARSER_BUG:
|
case ONIGERR_PARSER_BUG:
|
||||||
|
@ -135,11 +137,7 @@ onig_error_code_to_format(int code)
|
||||||
case ONIGERR_TOO_BIG_BACKREF_NUMBER:
|
case ONIGERR_TOO_BIG_BACKREF_NUMBER:
|
||||||
p = "too big backref number"; break;
|
p = "too big backref number"; break;
|
||||||
case ONIGERR_INVALID_BACKREF:
|
case ONIGERR_INVALID_BACKREF:
|
||||||
#ifdef USE_NAMED_GROUP
|
|
||||||
p = "invalid backref number/name"; break;
|
p = "invalid backref number/name"; break;
|
||||||
#else
|
|
||||||
p = "invalid backref number"; break;
|
|
||||||
#endif
|
|
||||||
case ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED:
|
case ONIGERR_NUMBERED_BACKREF_OR_CALL_NOT_ALLOWED:
|
||||||
p = "numbered backref/call is not allowed. (use name)"; break;
|
p = "numbered backref/call is not allowed. (use name)"; break;
|
||||||
case ONIGERR_TOO_MANY_CAPTURES:
|
case ONIGERR_TOO_MANY_CAPTURES:
|
||||||
|
@ -155,11 +153,7 @@ onig_error_code_to_format(int code)
|
||||||
case ONIGERR_INVALID_GROUP_NAME:
|
case ONIGERR_INVALID_GROUP_NAME:
|
||||||
p = "invalid group name <%n>"; break;
|
p = "invalid group name <%n>"; break;
|
||||||
case ONIGERR_INVALID_CHAR_IN_GROUP_NAME:
|
case ONIGERR_INVALID_CHAR_IN_GROUP_NAME:
|
||||||
#ifdef USE_NAMED_GROUP
|
|
||||||
p = "invalid char in group name <%n>"; break;
|
p = "invalid char in group name <%n>"; break;
|
||||||
#else
|
|
||||||
p = "invalid char in group number <%n>"; break;
|
|
||||||
#endif
|
|
||||||
case ONIGERR_UNDEFINED_NAME_REFERENCE:
|
case ONIGERR_UNDEFINED_NAME_REFERENCE:
|
||||||
p = "undefined name <%n> reference"; break;
|
p = "undefined name <%n> reference"; break;
|
||||||
case ONIGERR_UNDEFINED_GROUP_REFERENCE:
|
case ONIGERR_UNDEFINED_GROUP_REFERENCE:
|
||||||
|
@ -174,6 +168,12 @@ onig_error_code_to_format(int code)
|
||||||
p = "group number is too big for capture history"; break;
|
p = "group number is too big for capture history"; break;
|
||||||
case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
|
case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
|
||||||
p = "invalid character property name {%n}"; break;
|
p = "invalid character property name {%n}"; break;
|
||||||
|
case ONIGERR_INVALID_IF_ELSE_SYNTAX:
|
||||||
|
p = "invalid if-else syntax"; break;
|
||||||
|
case ONIGERR_INVALID_ABSENT_GROUP_PATTERN:
|
||||||
|
p = "invalid absent group pattern"; break;
|
||||||
|
case ONIGERR_INVALID_ABSENT_GROUP_GENERATOR_PATTERN:
|
||||||
|
p = "invalid absent group generator pattern"; break;
|
||||||
case ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION:
|
case ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION:
|
||||||
p = "not supported encoding combination"; break;
|
p = "not supported encoding combination"; break;
|
||||||
case ONIGERR_INVALID_COMBINATION_OF_OPTIONS:
|
case ONIGERR_INVALID_COMBINATION_OF_OPTIONS:
|
||||||
|
@ -211,24 +211,24 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
|
||||||
while (p < end) {
|
while (p < end) {
|
||||||
code = ONIGENC_MBC_TO_CODE(enc, p, end);
|
code = ONIGENC_MBC_TO_CODE(enc, p, end);
|
||||||
if (code >= 0x80) {
|
if (code >= 0x80) {
|
||||||
if (code > 0xffff && len + 10 <= buf_size) {
|
if (code > 0xffff && len + 10 <= buf_size) {
|
||||||
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 24));
|
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 24));
|
||||||
sprint_byte((char*)(&(buf[len+4])), (unsigned int)(code >> 16));
|
sprint_byte((char*)(&(buf[len+4])), (unsigned int)(code >> 16));
|
||||||
sprint_byte((char*)(&(buf[len+6])), (unsigned int)(code >> 8));
|
sprint_byte((char*)(&(buf[len+6])), (unsigned int)(code >> 8));
|
||||||
sprint_byte((char*)(&(buf[len+8])), (unsigned int)code);
|
sprint_byte((char*)(&(buf[len+8])), (unsigned int)code);
|
||||||
len += 10;
|
len += 10;
|
||||||
}
|
}
|
||||||
else if (len + 6 <= buf_size) {
|
else if (len + 6 <= buf_size) {
|
||||||
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 8));
|
sprint_byte_with_x((char*)(&(buf[len])), (unsigned int)(code >> 8));
|
||||||
sprint_byte((char*)(&(buf[len+4])), (unsigned int)code);
|
sprint_byte((char*)(&(buf[len+4])), (unsigned int)code);
|
||||||
len += 6;
|
len += 6;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buf[len++] = (UChar )code;
|
buf[len++] = (UChar )code;
|
||||||
}
|
}
|
||||||
|
|
||||||
p += enclen(enc, p);
|
p += enclen(enc, p);
|
||||||
|
@ -238,7 +238,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
|
||||||
*is_over = ((p < end) ? 1 : 0);
|
*is_over = ((p < end) ? 1 : 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
len = MIN((end - s), buf_size);
|
len = MIN((int )(end - s), buf_size);
|
||||||
xmemcpy(buf, s, (size_t )len);
|
xmemcpy(buf, s, (size_t )len);
|
||||||
*is_over = ((buf_size < (end - s)) ? 1 : 0);
|
*is_over = ((buf_size < (end - s)) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ onig_error_code_to_str(UChar* s, int code, ...)
|
||||||
onig_error_code_to_str(s, code, va_alist)
|
onig_error_code_to_str(s, code, va_alist)
|
||||||
UChar* s;
|
UChar* s;
|
||||||
int code;
|
int code;
|
||||||
va_dcl
|
va_dcl
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
UChar *p, *q;
|
UChar *p, *q;
|
||||||
|
@ -278,31 +278,31 @@ onig_error_code_to_str(s, code, va_alist)
|
||||||
case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
|
case ONIGERR_INVALID_CHAR_PROPERTY_NAME:
|
||||||
einfo = va_arg(vargs, OnigErrorInfo*);
|
einfo = va_arg(vargs, OnigErrorInfo*);
|
||||||
len = to_ascii(einfo->enc, einfo->par, einfo->par_end,
|
len = to_ascii(einfo->enc, einfo->par, einfo->par_end,
|
||||||
parbuf, MAX_ERROR_PAR_LEN - 3, &is_over);
|
parbuf, MAX_ERROR_PAR_LEN - 3, &is_over);
|
||||||
q = onig_error_code_to_format(code);
|
q = onig_error_code_to_format(code);
|
||||||
p = s;
|
p = s;
|
||||||
while (*q != '\0') {
|
while (*q != '\0') {
|
||||||
if (*q == '%') {
|
if (*q == '%') {
|
||||||
q++;
|
q++;
|
||||||
if (*q == 'n') { /* '%n': name */
|
if (*q == 'n') { /* '%n': name */
|
||||||
xmemcpy(p, parbuf, len);
|
xmemcpy(p, parbuf, len);
|
||||||
p += len;
|
p += len;
|
||||||
if (is_over != 0) {
|
if (is_over != 0) {
|
||||||
xmemcpy(p, "...", 3);
|
xmemcpy(p, "...", 3);
|
||||||
p += 3;
|
p += 3;
|
||||||
}
|
}
|
||||||
q++;
|
q++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto normal_char;
|
goto normal_char;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
normal_char:
|
normal_char:
|
||||||
*p++ = *q++;
|
*p++ = *q++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
len = p - s;
|
len = (int )(p - s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -342,7 +342,7 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
|
||||||
n = xvsnprintf((char* )buf, bufsize, (const char* )fmt, args);
|
n = xvsnprintf((char* )buf, bufsize, (const char* )fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
need = (pat_end - pat) * 4 + 4;
|
need = (int )(pat_end - pat) * 4 + 4;
|
||||||
|
|
||||||
if (n + need < bufsize) {
|
if (n + need < bufsize) {
|
||||||
xstrcat((char* )buf, ": /", bufsize);
|
xstrcat((char* )buf, ": /", bufsize);
|
||||||
|
@ -359,7 +359,7 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
|
||||||
int blen;
|
int blen;
|
||||||
|
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
|
sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
|
||||||
blen = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
blen = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
||||||
bp = bs;
|
bp = bs;
|
||||||
while (blen-- > 0) *s++ = *bp++;
|
while (blen-- > 0) *s++ = *bp++;
|
||||||
|
@ -367,23 +367,23 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (*p == '\\') {
|
else if (*p == '\\') {
|
||||||
*s++ = *p++;
|
*s++ = *p++;
|
||||||
len = enclen(enc, p);
|
len = enclen(enc, p);
|
||||||
while (len-- > 0) *s++ = *p++;
|
while (len-- > 0) *s++ = *p++;
|
||||||
}
|
}
|
||||||
else if (*p == '/') {
|
else if (*p == '/') {
|
||||||
*s++ = (unsigned char )'\\';
|
*s++ = (unsigned char )'\\';
|
||||||
*s++ = *p++;
|
*s++ = *p++;
|
||||||
}
|
}
|
||||||
else if (!ONIGENC_IS_CODE_PRINT(enc, *p) &&
|
else if (!ONIGENC_IS_CODE_PRINT(enc, *p) &&
|
||||||
!ONIGENC_IS_CODE_SPACE(enc, *p)) {
|
!ONIGENC_IS_CODE_SPACE(enc, *p)) {
|
||||||
sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
|
sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
|
||||||
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
||||||
bp = bs;
|
bp = bs;
|
||||||
while (len-- > 0) *s++ = *bp++;
|
while (len-- > 0) *s++ = *bp++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*s++ = *p++;
|
*s++ = *p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,7 +2,7 @@
|
||||||
regext.c - Oniguruma (regular expression library)
|
regext.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -95,7 +95,7 @@ static int
|
||||||
conv_encoding(OnigEncoding from, OnigEncoding to, const UChar* s, const UChar* end,
|
conv_encoding(OnigEncoding from, OnigEncoding to, const UChar* s, const UChar* end,
|
||||||
UChar** conv, UChar** conv_end)
|
UChar** conv, UChar** conv_end)
|
||||||
{
|
{
|
||||||
int len = end - s;
|
int len = (int )(end - s);
|
||||||
|
|
||||||
if (to == ONIG_ENCODING_UTF16_BE) {
|
if (to == ONIG_ENCODING_UTF16_BE) {
|
||||||
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
||||||
|
@ -171,7 +171,7 @@ onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
||||||
if (ci->pattern_enc != ci->target_enc) {
|
if (ci->pattern_enc != ci->target_enc) {
|
||||||
r = conv_encoding(ci->pattern_enc, ci->target_enc, pattern, pattern_end,
|
r = conv_encoding(ci->pattern_enc, ci->target_enc, pattern, pattern_end,
|
||||||
&cpat, &cpat_end);
|
&cpat, &cpat_end);
|
||||||
if (r) return r;
|
if (r != 0) return r;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cpat = (UChar* )pattern;
|
cpat = (UChar* )pattern;
|
||||||
|
@ -186,10 +186,10 @@ onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
||||||
|
|
||||||
r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc,
|
r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc,
|
||||||
ci->syntax);
|
ci->syntax);
|
||||||
if (r) goto err;
|
if (r != 0) goto err;
|
||||||
|
|
||||||
r = onig_compile(*reg, cpat, cpat_end, einfo);
|
r = onig_compile(*reg, cpat, cpat_end, einfo);
|
||||||
if (r) {
|
if (r != 0) {
|
||||||
err:
|
err:
|
||||||
onig_free(*reg);
|
onig_free(*reg);
|
||||||
*reg = NULL;
|
*reg = NULL;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
reggnu.c - Oniguruma (regular expression library)
|
reggnu.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -54,7 +54,7 @@ re_adjust_startpos(regex_t* reg, const char* string, int size,
|
||||||
else {
|
else {
|
||||||
p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, (UChar* )string, s);
|
p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, (UChar* )string, s);
|
||||||
}
|
}
|
||||||
return p - (UChar* )string;
|
return (int )(p - (UChar* )string);
|
||||||
}
|
}
|
||||||
|
|
||||||
return startpos;
|
return startpos;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
regint.h - Oniguruma (regular expression library)
|
regint.h - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2013 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* for debug */
|
/* for debug */
|
||||||
/* #define ONIG_DEBUG_PARSE_TREE */
|
/* #define ONIG_DEBUG_PARSE */
|
||||||
/* #define ONIG_DEBUG_COMPILE */
|
/* #define ONIG_DEBUG_COMPILE */
|
||||||
/* #define ONIG_DEBUG_SEARCH */
|
/* #define ONIG_DEBUG_SEARCH */
|
||||||
/* #define ONIG_DEBUG_MATCH */
|
/* #define ONIG_DEBUG_MATCH */
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
/* for byte-code statistical data. */
|
/* for byte-code statistical data. */
|
||||||
/* #define ONIG_DEBUG_STATISTICS */
|
/* #define ONIG_DEBUG_STATISTICS */
|
||||||
|
|
||||||
#if defined(ONIG_DEBUG_PARSE_TREE) || defined(ONIG_DEBUG_MATCH) || \
|
#if defined(ONIG_DEBUG_PARSE) || defined(ONIG_DEBUG_MATCH) || \
|
||||||
defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) || \
|
defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) || \
|
||||||
defined(ONIG_DEBUG_STATISTICS)
|
defined(ONIG_DEBUG_STATISTICS)
|
||||||
#ifndef ONIG_DEBUG
|
#ifndef ONIG_DEBUG
|
||||||
|
@ -47,6 +47,12 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EXPORT
|
||||||
|
#ifndef ONIGURUMA_EXPORT
|
||||||
|
#define ONIGURUMA_EXPORT
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
|
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
|
||||||
(defined(__ppc__) && defined(__APPLE__)) || \
|
(defined(__ppc__) && defined(__APPLE__)) || \
|
||||||
defined(__x86_64) || defined(__x86_64__) || \
|
defined(__x86_64) || defined(__x86_64__) || \
|
||||||
|
@ -56,21 +62,27 @@
|
||||||
|
|
||||||
/* config */
|
/* config */
|
||||||
/* spec. config */
|
/* spec. config */
|
||||||
#define USE_NAMED_GROUP
|
#define USE_CALL
|
||||||
#define USE_SUBEXP_CALL
|
|
||||||
#define USE_BACKREF_WITH_LEVEL /* \k<name+n>, \k<name-n> */
|
#define USE_BACKREF_WITH_LEVEL /* \k<name+n>, \k<name-n> */
|
||||||
#define USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT /* /(?:()|())*\2/ */
|
#define USE_INSISTENT_CHECK_CAPTURES_STATUS_IN_ENDLESS_REPEAT /* /(?:()|())*\2/ */
|
||||||
#define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */
|
#define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */
|
||||||
#define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
|
#define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
|
||||||
/* !!! moved to regenc.h. */ /* #define USE_CRNL_AS_LINE_TERMINATOR */
|
|
||||||
|
//#define USE_TRY_IN_MATCH_LIMIT
|
||||||
|
#ifdef USE_COMBINATION_EXPLOSION_CHECK
|
||||||
|
#ifndef USE_TRY_IN_MATCH_LIMIT
|
||||||
|
#define USE_TRY_IN_MATCH_LIMIT
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* internal config */
|
/* internal config */
|
||||||
#define USE_OP_PUSH_OR_JUMP_EXACT
|
#define USE_OP_PUSH_OR_JUMP_EXACT
|
||||||
#define USE_QTFR_PEEK_NEXT
|
#define USE_QUANT_PEEK_NEXT
|
||||||
#define USE_ST_LIBRARY
|
#define USE_ST_LIBRARY
|
||||||
|
|
||||||
#define INIT_MATCH_STACK_SIZE 160
|
#define INIT_MATCH_STACK_SIZE 160
|
||||||
#define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
|
#define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
|
||||||
|
#define DEFAULT_TRY_IN_MATCH_LIMIT 10000000
|
||||||
#define DEFAULT_PARSE_DEPTH_LIMIT 4096
|
#define DEFAULT_PARSE_DEPTH_LIMIT 4096
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
@ -91,15 +103,12 @@
|
||||||
#define USE_VARIABLE_META_CHARS
|
#define USE_VARIABLE_META_CHARS
|
||||||
#define USE_POSIX_API_REGION_OPTION
|
#define USE_POSIX_API_REGION_OPTION
|
||||||
#define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
|
#define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
|
||||||
/* #define USE_COMBINATION_EXPLOSION_CHECK */ /* (X*)* */
|
|
||||||
|
|
||||||
#define xmalloc malloc
|
#define xmalloc malloc
|
||||||
#define xrealloc realloc
|
#define xrealloc realloc
|
||||||
#define xcalloc calloc
|
#define xcalloc calloc
|
||||||
#define xfree free
|
#define xfree free
|
||||||
|
|
||||||
#define CHECK_INTERRUPT_IN_MATCH_AT
|
|
||||||
|
|
||||||
#define st_init_table onig_st_init_table
|
#define st_init_table onig_st_init_table
|
||||||
#define st_init_table_with_size onig_st_init_table_with_size
|
#define st_init_table_with_size onig_st_init_table_with_size
|
||||||
#define st_init_numtable onig_st_init_numtable
|
#define st_init_numtable onig_st_init_numtable
|
||||||
|
@ -120,9 +129,6 @@
|
||||||
/* */
|
/* */
|
||||||
#define onig_st_is_member st_is_member
|
#define onig_st_is_member st_is_member
|
||||||
|
|
||||||
#define STATE_CHECK_STRING_THRESHOLD_LEN 7
|
|
||||||
#define STATE_CHECK_BUFF_MAX_SIZE 0x4000
|
|
||||||
|
|
||||||
#define xmemset memset
|
#define xmemset memset
|
||||||
#define xmemcpy memcpy
|
#define xmemcpy memcpy
|
||||||
#define xmemmove memmove
|
#define xmemmove memmove
|
||||||
|
@ -140,10 +146,20 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LIMITS_H
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDINT_H
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
|
#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -161,6 +177,10 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_INTTYPES_H
|
||||||
|
#include <inttypes.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -169,6 +189,13 @@
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#if defined(_MSC_VER) && (_MSC_VER < 1300)
|
||||||
|
typedef int intptr_t;
|
||||||
|
typedef unsigned int uintptr_t;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "regenc.h"
|
#include "regenc.h"
|
||||||
|
|
||||||
#ifdef MIN
|
#ifdef MIN
|
||||||
|
@ -177,6 +204,7 @@
|
||||||
#ifdef MAX
|
#ifdef MAX
|
||||||
#undef MAX
|
#undef MAX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MIN(a,b) (((a)>(b))?(b):(a))
|
#define MIN(a,b) (((a)>(b))?(b):(a))
|
||||||
#define MAX(a,b) (((a)<(b))?(b):(a))
|
#define MAX(a,b) (((a)<(b))?(b):(a))
|
||||||
|
|
||||||
|
@ -186,6 +214,8 @@
|
||||||
#define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY
|
#define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY
|
||||||
#define NULL_UCHARP ((UChar* )0)
|
#define NULL_UCHARP ((UChar* )0)
|
||||||
|
|
||||||
|
#define INFINITE_LEN ONIG_INFINITE_DISTANCE
|
||||||
|
|
||||||
#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
|
#ifdef PLATFORM_UNALIGNED_WORD_ACCESS
|
||||||
|
|
||||||
#define PLATFORM_GET_INC(val,p,type) do{\
|
#define PLATFORM_GET_INC(val,p,type) do{\
|
||||||
|
@ -208,59 +238,81 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\
|
#define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\
|
||||||
(pad_size) = WORD_ALIGNMENT_SIZE \
|
(pad_size) = WORD_ALIGNMENT_SIZE - ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
|
||||||
- ((size_t)(addr) % WORD_ALIGNMENT_SIZE);\
|
|
||||||
if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\
|
if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ALIGNMENT_RIGHT(addr) do {\
|
#define ALIGNMENT_RIGHT(addr) do {\
|
||||||
(addr) += (WORD_ALIGNMENT_SIZE - 1);\
|
(addr) += (WORD_ALIGNMENT_SIZE - 1);\
|
||||||
(addr) -= ((size_t)(addr) % WORD_ALIGNMENT_SIZE);\
|
(addr) -= ((uintptr_t )(addr) % WORD_ALIGNMENT_SIZE);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif /* PLATFORM_UNALIGNED_WORD_ACCESS */
|
#endif /* PLATFORM_UNALIGNED_WORD_ACCESS */
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int num_keeper;
|
||||||
|
int* keepers;
|
||||||
|
} RegExt;
|
||||||
|
|
||||||
|
#define REG_EXTP(reg) (RegExt* )((reg)->chain)
|
||||||
|
#define REG_EXTPL(reg) ((reg)->chain)
|
||||||
|
|
||||||
/* stack pop level */
|
/* stack pop level */
|
||||||
#define STACK_POP_LEVEL_FREE 0
|
enum StackPopLevel {
|
||||||
#define STACK_POP_LEVEL_MEM_START 1
|
STACK_POP_LEVEL_FREE = 0,
|
||||||
#define STACK_POP_LEVEL_ALL 2
|
STACK_POP_LEVEL_MEM_START = 1,
|
||||||
|
STACK_POP_LEVEL_ALL = 2
|
||||||
|
};
|
||||||
|
|
||||||
/* optimize flags */
|
/* optimize flags */
|
||||||
#define ONIG_OPTIMIZE_NONE 0
|
enum OptimizeType {
|
||||||
#define ONIG_OPTIMIZE_EXACT 1 /* Slow Search */
|
OPTIMIZE_NONE = 0,
|
||||||
#define ONIG_OPTIMIZE_EXACT_BM 2 /* Boyer Moore Search */
|
OPTIMIZE_EXACT = 1, /* Slow Search */
|
||||||
#define ONIG_OPTIMIZE_EXACT_BM_NOT_REV 3 /* BM (but not simple match) */
|
OPTIMIZE_EXACT_BM = 2, /* Boyer Moore Search */
|
||||||
#define ONIG_OPTIMIZE_EXACT_IC 4 /* Slow Search (ignore case) */
|
OPTIMIZE_EXACT_BM_NO_REV = 3, /* BM (but not simple match) */
|
||||||
#define ONIG_OPTIMIZE_MAP 5 /* char map */
|
OPTIMIZE_EXACT_IC = 4, /* Slow Search (ignore case) */
|
||||||
|
OPTIMIZE_MAP = 5 /* char map */
|
||||||
|
};
|
||||||
|
|
||||||
/* bit status */
|
/* bit status */
|
||||||
typedef unsigned int BitStatusType;
|
typedef unsigned int MemStatusType;
|
||||||
|
|
||||||
#define BIT_STATUS_BITS_NUM (sizeof(BitStatusType) * 8)
|
#define MEM_STATUS_BITS_NUM (sizeof(MemStatusType) * 8)
|
||||||
#define BIT_STATUS_CLEAR(stats) (stats) = 0
|
#define MEM_STATUS_CLEAR(stats) (stats) = 0
|
||||||
#define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0)
|
#define MEM_STATUS_ON_ALL(stats) (stats) = ~((MemStatusType )0)
|
||||||
#define BIT_STATUS_AT(stats,n) \
|
#define MEM_STATUS_AT(stats,n) \
|
||||||
((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & (1 << n)) : ((stats) & 1))
|
((n) < (int )MEM_STATUS_BITS_NUM ? ((stats) & ((MemStatusType )1 << n)) : ((stats) & 1))
|
||||||
|
#define MEM_STATUS_AT0(stats,n) \
|
||||||
|
((n) > 0 && (n) < (int )MEM_STATUS_BITS_NUM ? ((stats) & ((MemStatusType )1 << n)) : ((stats) & 1))
|
||||||
|
|
||||||
#define BIT_STATUS_ON_AT(stats,n) do {\
|
#define MEM_STATUS_ON(stats,n) do {\
|
||||||
if ((n) < (int )BIT_STATUS_BITS_NUM) \
|
if ((n) < (int )MEM_STATUS_BITS_NUM) {\
|
||||||
(stats) |= (1 << (n));\
|
if ((n) != 0)\
|
||||||
|
(stats) |= ((MemStatusType )1 << (n));\
|
||||||
|
}\
|
||||||
else\
|
else\
|
||||||
(stats) |= 1;\
|
(stats) |= 1;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\
|
#define MEM_STATUS_ON_SIMPLE(stats,n) do {\
|
||||||
if ((n) < (int )BIT_STATUS_BITS_NUM)\
|
if ((n) < (int )MEM_STATUS_BITS_NUM)\
|
||||||
(stats) |= (1 << (n));\
|
(stats) |= ((MemStatusType )1 << (n));\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1)
|
#define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1)
|
||||||
|
|
||||||
|
#define IS_CODE_WORD_ASCII(enc,code) \
|
||||||
|
(ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code))
|
||||||
|
#define IS_CODE_DIGIT_ASCII(enc, code) \
|
||||||
|
(ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_DIGIT(enc,code))
|
||||||
|
#define IS_CODE_XDIGIT_ASCII(enc, code) \
|
||||||
|
(ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_XDIGIT(enc,code))
|
||||||
|
|
||||||
#define DIGITVAL(code) ((code) - '0')
|
#define DIGITVAL(code) ((code) - '0')
|
||||||
#define ODIGITVAL(code) DIGITVAL(code)
|
#define ODIGITVAL(code) DIGITVAL(code)
|
||||||
#define XDIGITVAL(enc,code) \
|
#define XDIGITVAL(enc,code) \
|
||||||
(ONIGENC_IS_CODE_DIGIT(enc,code) ? DIGITVAL(code) \
|
(IS_CODE_DIGIT_ASCII(enc,code) ? DIGITVAL(code) \
|
||||||
: (ONIGENC_IS_CODE_UPPER(enc,code) ? (code) - 'A' + 10 : (code) - 'a' + 10))
|
: (ONIGENC_IS_CODE_UPPER(enc,code) ? (code) - 'A' + 10 : (code) - 'a' + 10))
|
||||||
|
|
||||||
#define IS_SINGLELINE(option) ((option) & ONIG_OPTION_SINGLELINE)
|
#define IS_SINGLELINE(option) ((option) & ONIG_OPTION_SINGLELINE)
|
||||||
|
@ -275,6 +327,21 @@ typedef unsigned int BitStatusType;
|
||||||
#define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
|
#define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
|
||||||
#define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION)
|
#define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION)
|
||||||
|
|
||||||
|
#define IS_WORD_ASCII(option) \
|
||||||
|
((option) & (ONIG_OPTION_WORD_IS_ASCII | ONIG_OPTION_POSIX_IS_ASCII))
|
||||||
|
#define IS_DIGIT_ASCII(option) \
|
||||||
|
((option) & (ONIG_OPTION_DIGIT_IS_ASCII | ONIG_OPTION_POSIX_IS_ASCII))
|
||||||
|
#define IS_SPACE_ASCII(option) \
|
||||||
|
((option) & (ONIG_OPTION_SPACE_IS_ASCII | ONIG_OPTION_POSIX_IS_ASCII))
|
||||||
|
#define IS_POSIX_ASCII(option) ((option) & ONIG_OPTION_POSIX_IS_ASCII)
|
||||||
|
|
||||||
|
#define IS_ASCII_MODE_CTYPE_OPTION(ctype, options) \
|
||||||
|
((ctype) >= 0 && \
|
||||||
|
(((ctype) < ONIGENC_CTYPE_ASCII && IS_POSIX_ASCII(options)) ||\
|
||||||
|
((ctype) == ONIGENC_CTYPE_WORD && IS_WORD_ASCII(options)) ||\
|
||||||
|
((ctype) == ONIGENC_CTYPE_DIGIT && IS_DIGIT_ASCII(options)) ||\
|
||||||
|
((ctype) == ONIGENC_CTYPE_SPACE && IS_SPACE_ASCII(options))))
|
||||||
|
|
||||||
/* OP_SET_OPTION is required for these options.
|
/* OP_SET_OPTION is required for these options.
|
||||||
#define IS_DYNAMIC_OPTION(option) \
|
#define IS_DYNAMIC_OPTION(option) \
|
||||||
(((option) & (ONIG_OPTION_MULTILINE | ONIG_OPTION_IGNORECASE)) != 0)
|
(((option) & (ONIG_OPTION_MULTILINE | ONIG_OPTION_IGNORECASE)) != 0)
|
||||||
|
@ -306,7 +373,7 @@ typedef Bits* BitSetRef;
|
||||||
|
|
||||||
#define BITSET_CLEAR(bs) do {\
|
#define BITSET_CLEAR(bs) do {\
|
||||||
int i;\
|
int i;\
|
||||||
for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
|
for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BS_ROOM(bs,pos) (bs)[pos / BITS_IN_ROOM]
|
#define BS_ROOM(bs,pos) (bs)[pos / BITS_IN_ROOM]
|
||||||
|
@ -324,21 +391,21 @@ typedef struct _BBuf {
|
||||||
unsigned int alloc;
|
unsigned int alloc;
|
||||||
} BBuf;
|
} BBuf;
|
||||||
|
|
||||||
#define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
|
#define BB_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
|
||||||
|
|
||||||
#define BBUF_SIZE_INC(buf,inc) do{\
|
#define BB_SIZE_INC(buf,inc) do{\
|
||||||
(buf)->alloc += (inc);\
|
(buf)->alloc += (inc);\
|
||||||
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BBUF_EXPAND(buf,low) do{\
|
#define BB_EXPAND(buf,low) do{\
|
||||||
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
|
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
|
||||||
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BBUF_ENSURE_SIZE(buf,size) do{\
|
#define BB_ENSURE_SIZE(buf,size) do{\
|
||||||
unsigned int new_alloc = (buf)->alloc;\
|
unsigned int new_alloc = (buf)->alloc;\
|
||||||
while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
|
while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
|
||||||
if ((buf)->alloc != new_alloc) {\
|
if ((buf)->alloc != new_alloc) {\
|
||||||
|
@ -348,74 +415,83 @@ typedef struct _BBuf {
|
||||||
}\
|
}\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BBUF_WRITE(buf,pos,bytes,n) do{\
|
#define BB_WRITE(buf,pos,bytes,n) do{\
|
||||||
int used = (pos) + (n);\
|
int used = (pos) + (n);\
|
||||||
if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
|
if ((buf)->alloc < (unsigned int )used) BB_EXPAND((buf),used);\
|
||||||
xmemcpy((buf)->p + (pos), (bytes), (n));\
|
xmemcpy((buf)->p + (pos), (bytes), (n));\
|
||||||
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
|
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BBUF_WRITE1(buf,pos,byte) do{\
|
#define BB_WRITE1(buf,pos,byte) do{\
|
||||||
int used = (pos) + 1;\
|
int used = (pos) + 1;\
|
||||||
if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
|
if ((buf)->alloc < (unsigned int )used) BB_EXPAND((buf),used);\
|
||||||
(buf)->p[(pos)] = (byte);\
|
(buf)->p[(pos)] = (byte);\
|
||||||
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
|
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BBUF_ADD(buf,bytes,n) BBUF_WRITE((buf),(buf)->used,(bytes),(n))
|
#define BB_ADD(buf,bytes,n) BB_WRITE((buf),(buf)->used,(bytes),(n))
|
||||||
#define BBUF_ADD1(buf,byte) BBUF_WRITE1((buf),(buf)->used,(byte))
|
#define BB_ADD1(buf,byte) BB_WRITE1((buf),(buf)->used,(byte))
|
||||||
#define BBUF_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used)
|
#define BB_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used)
|
||||||
#define BBUF_GET_OFFSET_POS(buf) ((buf)->used)
|
#define BB_GET_OFFSET_POS(buf) ((buf)->used)
|
||||||
|
|
||||||
/* from < to */
|
/* from < to */
|
||||||
#define BBUF_MOVE_RIGHT(buf,from,to,n) do {\
|
#define BB_MOVE_RIGHT(buf,from,to,n) do {\
|
||||||
if ((unsigned int )((to)+(n)) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\
|
if ((unsigned int )((to)+(n)) > (buf)->alloc) BB_EXPAND((buf),(to) + (n));\
|
||||||
xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
|
xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
|
||||||
if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\
|
if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* from > to */
|
/* from > to */
|
||||||
#define BBUF_MOVE_LEFT(buf,from,to,n) do {\
|
#define BB_MOVE_LEFT(buf,from,to,n) do {\
|
||||||
xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
|
xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/* from > to */
|
/* from > to */
|
||||||
#define BBUF_MOVE_LEFT_REDUCE(buf,from,to) do {\
|
#define BB_MOVE_LEFT_REDUCE(buf,from,to) do {\
|
||||||
xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\
|
xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\
|
||||||
(buf)->used -= (from - to);\
|
(buf)->used -= (from - to);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BBUF_INSERT(buf,pos,bytes,n) do {\
|
#define BB_INSERT(buf,pos,bytes,n) do {\
|
||||||
if (pos >= (buf)->used) {\
|
if (pos >= (buf)->used) {\
|
||||||
BBUF_WRITE(buf,pos,bytes,n);\
|
BB_WRITE(buf,pos,bytes,n);\
|
||||||
}\
|
}\
|
||||||
else {\
|
else {\
|
||||||
BBUF_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\
|
BB_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\
|
||||||
xmemcpy((buf)->p + (pos), (bytes), (n));\
|
xmemcpy((buf)->p + (pos), (bytes), (n));\
|
||||||
}\
|
}\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define BBUF_GET_BYTE(buf, pos) (buf)->p[(pos)]
|
#define BB_GET_BYTE(buf, pos) (buf)->p[(pos)]
|
||||||
|
|
||||||
|
|
||||||
#define ANCHOR_BEGIN_BUF (1<<0)
|
/* has body */
|
||||||
#define ANCHOR_BEGIN_LINE (1<<1)
|
#define ANCHOR_PREC_READ (1<<0)
|
||||||
#define ANCHOR_BEGIN_POSITION (1<<2)
|
#define ANCHOR_PREC_READ_NOT (1<<1)
|
||||||
#define ANCHOR_END_BUF (1<<3)
|
#define ANCHOR_LOOK_BEHIND (1<<2)
|
||||||
#define ANCHOR_SEMI_END_BUF (1<<4)
|
#define ANCHOR_LOOK_BEHIND_NOT (1<<3)
|
||||||
#define ANCHOR_END_LINE (1<<5)
|
/* no body */
|
||||||
|
#define ANCHOR_BEGIN_BUF (1<<4)
|
||||||
#define ANCHOR_WORD_BOUND (1<<6)
|
#define ANCHOR_BEGIN_LINE (1<<5)
|
||||||
#define ANCHOR_NOT_WORD_BOUND (1<<7)
|
#define ANCHOR_BEGIN_POSITION (1<<6)
|
||||||
#define ANCHOR_WORD_BEGIN (1<<8)
|
#define ANCHOR_END_BUF (1<<7)
|
||||||
#define ANCHOR_WORD_END (1<<9)
|
#define ANCHOR_SEMI_END_BUF (1<<8)
|
||||||
#define ANCHOR_PREC_READ (1<<10)
|
#define ANCHOR_END_LINE (1<<9)
|
||||||
#define ANCHOR_PREC_READ_NOT (1<<11)
|
#define ANCHOR_WORD_BOUNDARY (1<<10)
|
||||||
#define ANCHOR_LOOK_BEHIND (1<<12)
|
#define ANCHOR_NO_WORD_BOUNDARY (1<<11)
|
||||||
#define ANCHOR_LOOK_BEHIND_NOT (1<<13)
|
#define ANCHOR_WORD_BEGIN (1<<12)
|
||||||
|
#define ANCHOR_WORD_END (1<<13)
|
||||||
#define ANCHOR_ANYCHAR_STAR (1<<14) /* ".*" optimize info */
|
#define ANCHOR_ANYCHAR_STAR (1<<14) /* ".*" optimize info */
|
||||||
#define ANCHOR_ANYCHAR_STAR_ML (1<<15) /* ".*" optimize info (multi-line) */
|
#define ANCHOR_ANYCHAR_STAR_ML (1<<15) /* ".*" optimize info (multi-line) */
|
||||||
|
#define ANCHOR_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY (1<<16)
|
||||||
|
#define ANCHOR_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY (1<<17)
|
||||||
|
|
||||||
|
|
||||||
|
#define ANCHOR_HAS_BODY(a) ((a)->type < ANCHOR_BEGIN_BUF)
|
||||||
|
|
||||||
|
#define IS_WORD_ANCHOR_TYPE(type) \
|
||||||
|
((type) == ANCHOR_WORD_BOUNDARY || (type) == ANCHOR_NO_WORD_BOUNDARY || \
|
||||||
|
(type) == ANCHOR_WORD_BEGIN || (type) == ANCHOR_WORD_END)
|
||||||
|
|
||||||
/* operation code */
|
/* operation code */
|
||||||
enum OpCode {
|
enum OpCode {
|
||||||
|
@ -444,7 +520,9 @@ enum OpCode {
|
||||||
OP_CCLASS_NOT,
|
OP_CCLASS_NOT,
|
||||||
OP_CCLASS_MB_NOT,
|
OP_CCLASS_MB_NOT,
|
||||||
OP_CCLASS_MIX_NOT,
|
OP_CCLASS_MIX_NOT,
|
||||||
|
#ifdef USE_OP_CCLASS_NODE
|
||||||
OP_CCLASS_NODE, /* pointer to CClassNode node */
|
OP_CCLASS_NODE, /* pointer to CClassNode node */
|
||||||
|
#endif
|
||||||
|
|
||||||
OP_ANYCHAR, /* "." */
|
OP_ANYCHAR, /* "." */
|
||||||
OP_ANYCHAR_ML, /* "." multi-line */
|
OP_ANYCHAR_ML, /* "." multi-line */
|
||||||
|
@ -454,12 +532,17 @@ enum OpCode {
|
||||||
OP_ANYCHAR_ML_STAR_PEEK_NEXT,
|
OP_ANYCHAR_ML_STAR_PEEK_NEXT,
|
||||||
|
|
||||||
OP_WORD,
|
OP_WORD,
|
||||||
OP_NOT_WORD,
|
OP_WORD_ASCII,
|
||||||
OP_WORD_BOUND,
|
OP_NO_WORD,
|
||||||
OP_NOT_WORD_BOUND,
|
OP_NO_WORD_ASCII,
|
||||||
|
OP_WORD_BOUNDARY,
|
||||||
|
OP_NO_WORD_BOUNDARY,
|
||||||
OP_WORD_BEGIN,
|
OP_WORD_BEGIN,
|
||||||
OP_WORD_END,
|
OP_WORD_END,
|
||||||
|
|
||||||
|
OP_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY,
|
||||||
|
OP_NO_EXTENDED_GRAPHEME_CLUSTER_BOUNDARY,
|
||||||
|
|
||||||
OP_BEGIN_BUF,
|
OP_BEGIN_BUF,
|
||||||
OP_END_BUF,
|
OP_END_BUF,
|
||||||
OP_BEGIN_LINE,
|
OP_BEGIN_LINE,
|
||||||
|
@ -469,11 +552,13 @@ enum OpCode {
|
||||||
|
|
||||||
OP_BACKREF1,
|
OP_BACKREF1,
|
||||||
OP_BACKREF2,
|
OP_BACKREF2,
|
||||||
OP_BACKREFN,
|
OP_BACKREF_N,
|
||||||
OP_BACKREFN_IC,
|
OP_BACKREF_N_IC,
|
||||||
OP_BACKREF_MULTI,
|
OP_BACKREF_MULTI,
|
||||||
OP_BACKREF_MULTI_IC,
|
OP_BACKREF_MULTI_IC,
|
||||||
OP_BACKREF_WITH_LEVEL, /* \k<xxx+n>, \k<xxx-n> */
|
OP_BACKREF_WITH_LEVEL, /* \k<xxx+n>, \k<xxx-n> */
|
||||||
|
OP_BACKREF_CHECK, /* (?(n)), (?('name')) */
|
||||||
|
OP_BACKREF_CHECK_WITH_LEVEL, /* (?(n-level)), (?('name-level')) */
|
||||||
|
|
||||||
OP_MEMORY_START,
|
OP_MEMORY_START,
|
||||||
OP_MEMORY_START_PUSH, /* push back-tracker to stack */
|
OP_MEMORY_START_PUSH, /* push back-tracker to stack */
|
||||||
|
@ -485,6 +570,7 @@ enum OpCode {
|
||||||
OP_FAIL, /* pop stack and move */
|
OP_FAIL, /* pop stack and move */
|
||||||
OP_JUMP,
|
OP_JUMP,
|
||||||
OP_PUSH,
|
OP_PUSH,
|
||||||
|
OP_PUSH_SUPER,
|
||||||
OP_POP,
|
OP_POP,
|
||||||
OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
|
OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
|
||||||
OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */
|
OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */
|
||||||
|
@ -494,35 +580,45 @@ enum OpCode {
|
||||||
OP_REPEAT_INC_NG, /* non greedy */
|
OP_REPEAT_INC_NG, /* non greedy */
|
||||||
OP_REPEAT_INC_SG, /* search and get in stack */
|
OP_REPEAT_INC_SG, /* search and get in stack */
|
||||||
OP_REPEAT_INC_NG_SG, /* search and get in stack (non greedy) */
|
OP_REPEAT_INC_NG_SG, /* search and get in stack (non greedy) */
|
||||||
OP_NULL_CHECK_START, /* null loop checker start */
|
OP_EMPTY_CHECK_START, /* null loop checker start */
|
||||||
OP_NULL_CHECK_END, /* null loop checker end */
|
OP_EMPTY_CHECK_END, /* null loop checker end */
|
||||||
OP_NULL_CHECK_END_MEMST, /* null loop checker end (with capture status) */
|
OP_EMPTY_CHECK_END_MEMST, /* null loop checker end (with capture status) */
|
||||||
OP_NULL_CHECK_END_MEMST_PUSH, /* with capture status and push check-end */
|
OP_EMPTY_CHECK_END_MEMST_PUSH, /* with capture status and push check-end */
|
||||||
|
|
||||||
OP_PUSH_POS, /* (?=...) start */
|
OP_PREC_READ_START, /* (?=...) start */
|
||||||
OP_POP_POS, /* (?=...) end */
|
OP_PREC_READ_END, /* (?=...) end */
|
||||||
OP_PUSH_POS_NOT, /* (?!...) start */
|
OP_PREC_READ_NOT_START, /* (?!...) start */
|
||||||
OP_FAIL_POS, /* (?!...) end */
|
OP_PREC_READ_NOT_END, /* (?!...) end */
|
||||||
OP_PUSH_STOP_BT, /* (?>...) start */
|
OP_ATOMIC_START, /* (?>...) start */
|
||||||
OP_POP_STOP_BT, /* (?>...) end */
|
OP_ATOMIC_END, /* (?>...) end */
|
||||||
OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */
|
OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */
|
||||||
OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */
|
OP_LOOK_BEHIND_NOT_START, /* (?<!...) start */
|
||||||
OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end */
|
OP_LOOK_BEHIND_NOT_END, /* (?<!...) end */
|
||||||
|
|
||||||
OP_CALL, /* \g<name> */
|
OP_CALL, /* \g<name> */
|
||||||
OP_RETURN,
|
OP_RETURN,
|
||||||
|
OP_PUSH_SAVE_VAL,
|
||||||
OP_STATE_CHECK_PUSH, /* combination explosion check and push */
|
OP_UPDATE_VAR,
|
||||||
OP_STATE_CHECK_PUSH_OR_JUMP, /* check ok -> push, else jump */
|
|
||||||
OP_STATE_CHECK, /* check only */
|
|
||||||
OP_STATE_CHECK_ANYCHAR_STAR,
|
|
||||||
OP_STATE_CHECK_ANYCHAR_ML_STAR,
|
|
||||||
|
|
||||||
/* no need: IS_DYNAMIC_OPTION() == 0 */
|
/* no need: IS_DYNAMIC_OPTION() == 0 */
|
||||||
OP_SET_OPTION_PUSH, /* set option and push recover option */
|
OP_SET_OPTION_PUSH, /* set option and push recover option */
|
||||||
OP_SET_OPTION /* set option */
|
OP_SET_OPTION /* set option */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum SaveType {
|
||||||
|
SAVE_KEEP = 0, /* SAVE S */
|
||||||
|
SAVE_S = 1,
|
||||||
|
SAVE_RIGHT_RANGE = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum UpdateVarType {
|
||||||
|
UPDATE_VAR_KEEP_FROM_STACK_LAST = 0,
|
||||||
|
UPDATE_VAR_S_FROM_STACK = 1,
|
||||||
|
UPDATE_VAR_RIGHT_RANGE_FROM_STACK = 2,
|
||||||
|
UPDATE_VAR_RIGHT_RANGE_FROM_S_STACK = 3,
|
||||||
|
UPDATE_VAR_RIGHT_RANGE_INIT = 4,
|
||||||
|
};
|
||||||
|
|
||||||
typedef int RelAddrType;
|
typedef int RelAddrType;
|
||||||
typedef int AbsAddrType;
|
typedef int AbsAddrType;
|
||||||
typedef int LengthType;
|
typedef int LengthType;
|
||||||
|
@ -530,18 +626,22 @@ typedef int RepeatNumType;
|
||||||
typedef int MemNumType;
|
typedef int MemNumType;
|
||||||
typedef short int StateCheckNumType;
|
typedef short int StateCheckNumType;
|
||||||
typedef void* PointerType;
|
typedef void* PointerType;
|
||||||
|
typedef int SaveType;
|
||||||
|
typedef int UpdateVarType;
|
||||||
|
typedef int ModeType;
|
||||||
|
|
||||||
#define SIZE_OPCODE 1
|
#define SIZE_OPCODE 1
|
||||||
#define SIZE_RELADDR sizeof(RelAddrType)
|
#define SIZE_RELADDR sizeof(RelAddrType)
|
||||||
#define SIZE_ABSADDR sizeof(AbsAddrType)
|
#define SIZE_ABSADDR sizeof(AbsAddrType)
|
||||||
#define SIZE_LENGTH sizeof(LengthType)
|
#define SIZE_LENGTH sizeof(LengthType)
|
||||||
#define SIZE_MEMNUM sizeof(MemNumType)
|
#define SIZE_MEMNUM sizeof(MemNumType)
|
||||||
#define SIZE_STATE_CHECK_NUM sizeof(StateCheckNumType)
|
|
||||||
#define SIZE_REPEATNUM sizeof(RepeatNumType)
|
#define SIZE_REPEATNUM sizeof(RepeatNumType)
|
||||||
#define SIZE_OPTION sizeof(OnigOptionType)
|
#define SIZE_OPTION sizeof(OnigOptionType)
|
||||||
#define SIZE_CODE_POINT sizeof(OnigCodePoint)
|
#define SIZE_CODE_POINT sizeof(OnigCodePoint)
|
||||||
#define SIZE_POINTER sizeof(PointerType)
|
#define SIZE_POINTER sizeof(PointerType)
|
||||||
|
#define SIZE_SAVE_TYPE sizeof(SaveType)
|
||||||
|
#define SIZE_UPDATE_VAR_TYPE sizeof(UpdateVarType)
|
||||||
|
#define SIZE_MODE sizeof(ModeType)
|
||||||
|
|
||||||
#define GET_RELADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, RelAddrType)
|
#define GET_RELADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, RelAddrType)
|
||||||
#define GET_ABSADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, AbsAddrType)
|
#define GET_ABSADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, AbsAddrType)
|
||||||
|
@ -550,7 +650,9 @@ typedef void* PointerType;
|
||||||
#define GET_REPEATNUM_INC(num,p) PLATFORM_GET_INC(num, p, RepeatNumType)
|
#define GET_REPEATNUM_INC(num,p) PLATFORM_GET_INC(num, p, RepeatNumType)
|
||||||
#define GET_OPTION_INC(option,p) PLATFORM_GET_INC(option, p, OnigOptionType)
|
#define GET_OPTION_INC(option,p) PLATFORM_GET_INC(option, p, OnigOptionType)
|
||||||
#define GET_POINTER_INC(ptr,p) PLATFORM_GET_INC(ptr, p, PointerType)
|
#define GET_POINTER_INC(ptr,p) PLATFORM_GET_INC(ptr, p, PointerType)
|
||||||
#define GET_STATE_CHECK_NUM_INC(num,p) PLATFORM_GET_INC(num, p, StateCheckNumType)
|
#define GET_SAVE_TYPE_INC(type,p) PLATFORM_GET_INC(type, p, SaveType)
|
||||||
|
#define GET_UPDATE_VAR_TYPE_INC(type,p) PLATFORM_GET_INC(type, p, UpdateVarType)
|
||||||
|
#define GET_MODE_INC(mode,p) PLATFORM_GET_INC(mode, p, ModeType)
|
||||||
|
|
||||||
/* code point's address must be aligned address. */
|
/* code point's address must be aligned address. */
|
||||||
#define GET_CODE_POINT(code,p) code = *((OnigCodePoint* )(p))
|
#define GET_CODE_POINT(code,p) code = *((OnigCodePoint* )(p))
|
||||||
|
@ -565,15 +667,17 @@ typedef void* PointerType;
|
||||||
#define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT (SIZE_OPCODE + 1)
|
#define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT (SIZE_OPCODE + 1)
|
||||||
#define SIZE_OP_JUMP (SIZE_OPCODE + SIZE_RELADDR)
|
#define SIZE_OP_JUMP (SIZE_OPCODE + SIZE_RELADDR)
|
||||||
#define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR)
|
#define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR)
|
||||||
|
#define SIZE_OP_PUSH_SUPER (SIZE_OPCODE + SIZE_RELADDR)
|
||||||
#define SIZE_OP_POP SIZE_OPCODE
|
#define SIZE_OP_POP SIZE_OPCODE
|
||||||
#define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1)
|
#define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1)
|
||||||
#define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1)
|
#define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1)
|
||||||
#define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM)
|
#define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM)
|
||||||
#define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM)
|
#define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM)
|
||||||
#define SIZE_OP_PUSH_POS SIZE_OPCODE
|
#define SIZE_OP_WORD_BOUNDARY (SIZE_OPCODE + SIZE_MODE)
|
||||||
#define SIZE_OP_PUSH_POS_NOT (SIZE_OPCODE + SIZE_RELADDR)
|
#define SIZE_OP_PREC_READ_START SIZE_OPCODE
|
||||||
#define SIZE_OP_POP_POS SIZE_OPCODE
|
#define SIZE_OP_PREC_READ_NOT_START (SIZE_OPCODE + SIZE_RELADDR)
|
||||||
#define SIZE_OP_FAIL_POS SIZE_OPCODE
|
#define SIZE_OP_PREC_READ_END SIZE_OPCODE
|
||||||
|
#define SIZE_OP_PREC_READ_NOT_END SIZE_OPCODE
|
||||||
#define SIZE_OP_SET_OPTION (SIZE_OPCODE + SIZE_OPTION)
|
#define SIZE_OP_SET_OPTION (SIZE_OPCODE + SIZE_OPTION)
|
||||||
#define SIZE_OP_SET_OPTION_PUSH (SIZE_OPCODE + SIZE_OPTION)
|
#define SIZE_OP_SET_OPTION_PUSH (SIZE_OPCODE + SIZE_OPTION)
|
||||||
#define SIZE_OP_FAIL SIZE_OPCODE
|
#define SIZE_OP_FAIL SIZE_OPCODE
|
||||||
|
@ -583,22 +687,17 @@ typedef void* PointerType;
|
||||||
#define SIZE_OP_MEMORY_END_PUSH_REC (SIZE_OPCODE + SIZE_MEMNUM)
|
#define SIZE_OP_MEMORY_END_PUSH_REC (SIZE_OPCODE + SIZE_MEMNUM)
|
||||||
#define SIZE_OP_MEMORY_END (SIZE_OPCODE + SIZE_MEMNUM)
|
#define SIZE_OP_MEMORY_END (SIZE_OPCODE + SIZE_MEMNUM)
|
||||||
#define SIZE_OP_MEMORY_END_REC (SIZE_OPCODE + SIZE_MEMNUM)
|
#define SIZE_OP_MEMORY_END_REC (SIZE_OPCODE + SIZE_MEMNUM)
|
||||||
#define SIZE_OP_PUSH_STOP_BT SIZE_OPCODE
|
#define SIZE_OP_ATOMIC_START SIZE_OPCODE
|
||||||
#define SIZE_OP_POP_STOP_BT SIZE_OPCODE
|
#define SIZE_OP_ATOMIC_END SIZE_OPCODE
|
||||||
#define SIZE_OP_NULL_CHECK_START (SIZE_OPCODE + SIZE_MEMNUM)
|
#define SIZE_OP_EMPTY_CHECK_START (SIZE_OPCODE + SIZE_MEMNUM)
|
||||||
#define SIZE_OP_NULL_CHECK_END (SIZE_OPCODE + SIZE_MEMNUM)
|
#define SIZE_OP_EMPTY_CHECK_END (SIZE_OPCODE + SIZE_MEMNUM)
|
||||||
#define SIZE_OP_LOOK_BEHIND (SIZE_OPCODE + SIZE_LENGTH)
|
#define SIZE_OP_LOOK_BEHIND (SIZE_OPCODE + SIZE_LENGTH)
|
||||||
#define SIZE_OP_PUSH_LOOK_BEHIND_NOT (SIZE_OPCODE + SIZE_RELADDR + SIZE_LENGTH)
|
#define SIZE_OP_LOOK_BEHIND_NOT_START (SIZE_OPCODE + SIZE_RELADDR + SIZE_LENGTH)
|
||||||
#define SIZE_OP_FAIL_LOOK_BEHIND_NOT SIZE_OPCODE
|
#define SIZE_OP_LOOK_BEHIND_NOT_END SIZE_OPCODE
|
||||||
#define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR)
|
#define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR)
|
||||||
#define SIZE_OP_RETURN SIZE_OPCODE
|
#define SIZE_OP_RETURN SIZE_OPCODE
|
||||||
|
#define SIZE_OP_PUSH_SAVE_VAL (SIZE_OPCODE + SIZE_SAVE_TYPE + SIZE_MEMNUM)
|
||||||
#ifdef USE_COMBINATION_EXPLOSION_CHECK
|
#define SIZE_OP_UPDATE_VAR (SIZE_OPCODE + SIZE_UPDATE_VAR_TYPE + SIZE_MEMNUM)
|
||||||
#define SIZE_OP_STATE_CHECK (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
|
|
||||||
#define SIZE_OP_STATE_CHECK_PUSH (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)
|
|
||||||
#define SIZE_OP_STATE_CHECK_PUSH_OR_JUMP (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)
|
|
||||||
#define SIZE_OP_STATE_CHECK_ANYCHAR_STAR (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MC_ESC(syn) (syn)->meta_char_table.esc
|
#define MC_ESC(syn) (syn)->meta_char_table.esc
|
||||||
#define MC_ANYCHAR(syn) (syn)->meta_char_table.anychar
|
#define MC_ANYCHAR(syn) (syn)->meta_char_table.anychar
|
||||||
|
@ -648,111 +747,17 @@ typedef void* PointerType;
|
||||||
#define FLAG_NCCLASS_SHARE (1<<1)
|
#define FLAG_NCCLASS_SHARE (1<<1)
|
||||||
|
|
||||||
#define NCCLASS_SET_NOT(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_NOT)
|
#define NCCLASS_SET_NOT(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_NOT)
|
||||||
#define NCCLASS_SET_SHARE(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_SHARE)
|
|
||||||
#define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT)
|
#define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT)
|
||||||
#define IS_NCCLASS_NOT(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_NOT)
|
#define IS_NCCLASS_NOT(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_NOT)
|
||||||
#define IS_NCCLASS_SHARE(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_SHARE)
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int type;
|
|
||||||
/* struct _Node* next; */
|
|
||||||
/* unsigned int flags; */
|
|
||||||
} NodeBase;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NodeBase base;
|
|
||||||
unsigned int flags;
|
|
||||||
BitSet bs;
|
|
||||||
BBuf* mbuf; /* multi-byte info or NULL */
|
|
||||||
} CClassNode;
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
|
||||||
typedef __int64 OnigStackIndex;
|
|
||||||
#else
|
|
||||||
typedef long OnigStackIndex;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _OnigStackType {
|
|
||||||
unsigned int type;
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
UChar *pcode; /* byte code position */
|
|
||||||
UChar *pstr; /* string position */
|
|
||||||
UChar *pstr_prev; /* previous char position of pstr */
|
|
||||||
#ifdef USE_COMBINATION_EXPLOSION_CHECK
|
|
||||||
unsigned int state_check;
|
|
||||||
#endif
|
|
||||||
} state;
|
|
||||||
struct {
|
|
||||||
int count; /* for OP_REPEAT_INC, OP_REPEAT_INC_NG */
|
|
||||||
UChar *pcode; /* byte code position (head of repeated target) */
|
|
||||||
int num; /* repeat id */
|
|
||||||
} repeat;
|
|
||||||
struct {
|
|
||||||
OnigStackIndex si; /* index of stack */
|
|
||||||
} repeat_inc;
|
|
||||||
struct {
|
|
||||||
int num; /* memory num */
|
|
||||||
UChar *pstr; /* start/end position */
|
|
||||||
/* Following information is set, if this stack type is MEM-START */
|
|
||||||
OnigStackIndex start; /* prev. info (for backtrack "(...)*" ) */
|
|
||||||
OnigStackIndex end; /* prev. info (for backtrack "(...)*" ) */
|
|
||||||
} mem;
|
|
||||||
struct {
|
|
||||||
int num; /* null check id */
|
|
||||||
UChar *pstr; /* start position */
|
|
||||||
} null_check;
|
|
||||||
#ifdef USE_SUBEXP_CALL
|
|
||||||
struct {
|
|
||||||
UChar *ret_addr; /* byte code position */
|
|
||||||
int num; /* null check id */
|
|
||||||
UChar *pstr; /* string position */
|
|
||||||
} call_frame;
|
|
||||||
#endif
|
|
||||||
} u;
|
|
||||||
} OnigStackType;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
void* stack_p;
|
|
||||||
int stack_n;
|
|
||||||
OnigOptionType options;
|
|
||||||
OnigRegion* region;
|
|
||||||
int ptr_num;
|
|
||||||
const UChar* start; /* search start position (for \G: BEGIN_POSITION) */
|
|
||||||
#ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
|
|
||||||
int best_len; /* for ONIG_OPTION_FIND_LONGEST */
|
|
||||||
UChar* best_s;
|
|
||||||
#endif
|
|
||||||
#ifdef USE_COMBINATION_EXPLOSION_CHECK
|
|
||||||
void* state_check_buff;
|
|
||||||
int state_check_buff_size;
|
|
||||||
#endif
|
|
||||||
} OnigMatchArg;
|
|
||||||
|
|
||||||
|
|
||||||
#define IS_CODE_SB_WORD(enc,code) \
|
|
||||||
(ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code))
|
|
||||||
|
|
||||||
typedef struct OnigEndCallListItem {
|
|
||||||
struct OnigEndCallListItem* next;
|
|
||||||
void (*func)(void);
|
|
||||||
} OnigEndCallListItemType;
|
|
||||||
|
|
||||||
extern void onig_add_end_call(void (*func)(void));
|
extern void onig_add_end_call(void (*func)(void));
|
||||||
|
|
||||||
|
|
||||||
#ifdef ONIG_DEBUG
|
#ifdef ONIG_DEBUG
|
||||||
|
|
||||||
typedef struct {
|
#ifdef ONIG_DEBUG_COMPILE
|
||||||
short int opcode;
|
extern void onig_print_compiled_byte_code_list(FILE* f, regex_t* reg);
|
||||||
char* name;
|
#endif
|
||||||
short int arg_type;
|
|
||||||
} OnigOpInfoType;
|
|
||||||
|
|
||||||
extern OnigOpInfoType OnigOpInfo[];
|
|
||||||
|
|
||||||
|
|
||||||
extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar** nextp, OnigEncoding enc));
|
|
||||||
|
|
||||||
#ifdef ONIG_DEBUG_STATISTICS
|
#ifdef ONIG_DEBUG_STATISTICS
|
||||||
extern void onig_statistics_init P_((void));
|
extern void onig_statistics_init P_((void));
|
||||||
|
@ -760,17 +765,17 @@ extern int onig_print_statistics P_((FILE* f));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern void onig_warning(const char* s);
|
extern void onig_warning(const char* s);
|
||||||
extern UChar* onig_error_code_to_format P_((int code));
|
extern UChar* onig_error_code_to_format P_((int code));
|
||||||
extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
|
extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
|
||||||
extern int onig_bbuf_init P_((BBuf* buf, int size));
|
extern int onig_bbuf_init P_((BBuf* buf, int size));
|
||||||
extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo));
|
extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo));
|
||||||
extern void onig_transfer P_((regex_t* to, regex_t* from));
|
extern void onig_transfer P_((regex_t* to, regex_t* from));
|
||||||
extern int onig_is_code_in_cc P_((OnigEncoding enc, OnigCodePoint code, CClassNode* cc));
|
extern int onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, void* /* CClassNode* */ cc));
|
||||||
extern int onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, CClassNode* cc));
|
|
||||||
|
|
||||||
/* strend hash */
|
/* strend hash */
|
||||||
typedef void hash_table_type;
|
typedef void hash_table_type;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
typedef ULONG_PTR hash_data_type;
|
typedef ULONG_PTR hash_data_type;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@
|
||||||
regparse.h - Oniguruma (regular expression library)
|
regparse.h - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -32,172 +32,233 @@
|
||||||
#include "regint.h"
|
#include "regint.h"
|
||||||
|
|
||||||
/* node type */
|
/* node type */
|
||||||
#define NT_STR 0
|
typedef enum {
|
||||||
#define NT_CCLASS 1
|
NODE_STRING = 0,
|
||||||
#define NT_CTYPE 2
|
NODE_CCLASS = 1,
|
||||||
#define NT_CANY 3
|
NODE_CTYPE = 2,
|
||||||
#define NT_BREF 4
|
NODE_BACKREF = 3,
|
||||||
#define NT_QTFR 5
|
NODE_QUANT = 4,
|
||||||
#define NT_ENCLOSE 6
|
NODE_ENCLOSURE = 5,
|
||||||
#define NT_ANCHOR 7
|
NODE_ANCHOR = 6,
|
||||||
#define NT_LIST 8
|
NODE_LIST = 7,
|
||||||
#define NT_ALT 9
|
NODE_ALT = 8,
|
||||||
#define NT_CALL 10
|
NODE_CALL = 9,
|
||||||
|
NODE_GIMMICK = 10
|
||||||
|
} NodeType;
|
||||||
|
|
||||||
|
enum GimmickType {
|
||||||
|
GIMMICK_FAIL = 0,
|
||||||
|
GIMMICK_KEEP = 1,
|
||||||
|
GIMMICK_SAVE = 2,
|
||||||
|
GIMMICK_UPDATE_VAR = 3,
|
||||||
|
};
|
||||||
|
|
||||||
/* node type bit */
|
/* node type bit */
|
||||||
#define NTYPE2BIT(type) (1<<(type))
|
#define NODE_TYPE2BIT(type) (1<<(type))
|
||||||
|
|
||||||
#define BIT_NT_STR NTYPE2BIT(NT_STR)
|
#define BIT_NODE_STRING NODE_TYPE2BIT(NODE_STRING)
|
||||||
#define BIT_NT_CCLASS NTYPE2BIT(NT_CCLASS)
|
#define BIT_NODE_CCLASS NODE_TYPE2BIT(NODE_CCLASS)
|
||||||
#define BIT_NT_CTYPE NTYPE2BIT(NT_CTYPE)
|
#define BIT_NODE_CTYPE NODE_TYPE2BIT(NODE_CTYPE)
|
||||||
#define BIT_NT_CANY NTYPE2BIT(NT_CANY)
|
#define BIT_NODE_BACKREF NODE_TYPE2BIT(NODE_BACKREF)
|
||||||
#define BIT_NT_BREF NTYPE2BIT(NT_BREF)
|
#define BIT_NODE_QUANT NODE_TYPE2BIT(NODE_QUANT)
|
||||||
#define BIT_NT_QTFR NTYPE2BIT(NT_QTFR)
|
#define BIT_NODE_ENCLOSURE NODE_TYPE2BIT(NODE_ENCLOSURE)
|
||||||
#define BIT_NT_ENCLOSE NTYPE2BIT(NT_ENCLOSE)
|
#define BIT_NODE_ANCHOR NODE_TYPE2BIT(NODE_ANCHOR)
|
||||||
#define BIT_NT_ANCHOR NTYPE2BIT(NT_ANCHOR)
|
#define BIT_NODE_LIST NODE_TYPE2BIT(NODE_LIST)
|
||||||
#define BIT_NT_LIST NTYPE2BIT(NT_LIST)
|
#define BIT_NODE_ALT NODE_TYPE2BIT(NODE_ALT)
|
||||||
#define BIT_NT_ALT NTYPE2BIT(NT_ALT)
|
#define BIT_NODE_CALL NODE_TYPE2BIT(NODE_CALL)
|
||||||
#define BIT_NT_CALL NTYPE2BIT(NT_CALL)
|
#define BIT_NODE_GIMMICK NODE_TYPE2BIT(NODE_GIMMICK)
|
||||||
|
|
||||||
#define IS_NODE_TYPE_SIMPLE(type) \
|
#define NODE_IS_SIMPLE_TYPE(node) \
|
||||||
((NTYPE2BIT(type) & (BIT_NT_STR | BIT_NT_CCLASS | BIT_NT_CTYPE |\
|
((NODE_TYPE2BIT(NODE_TYPE(node)) & \
|
||||||
BIT_NT_CANY | BIT_NT_BREF)) != 0)
|
(BIT_NODE_STRING | BIT_NODE_CCLASS | BIT_NODE_CTYPE | BIT_NODE_BACKREF)) != 0)
|
||||||
|
|
||||||
#define NTYPE(node) ((node)->u.base.type)
|
#define NODE_TYPE(node) ((node)->u.base.node_type)
|
||||||
#define SET_NTYPE(node, ntype) (node)->u.base.type = (ntype)
|
#define NODE_SET_TYPE(node, ntype) (node)->u.base.node_type = (ntype)
|
||||||
|
|
||||||
#define NSTR(node) (&((node)->u.str))
|
#define STR_(node) (&((node)->u.str))
|
||||||
#define NCCLASS(node) (&((node)->u.cclass))
|
#define CCLASS_(node) (&((node)->u.cclass))
|
||||||
#define NCTYPE(node) (&((node)->u.ctype))
|
#define CTYPE_(node) (&((node)->u.ctype))
|
||||||
#define NBREF(node) (&((node)->u.bref))
|
#define BACKREF_(node) (&((node)->u.backref))
|
||||||
#define NQTFR(node) (&((node)->u.qtfr))
|
#define QUANT_(node) (&((node)->u.quant))
|
||||||
#define NENCLOSE(node) (&((node)->u.enclose))
|
#define ENCLOSURE_(node) (&((node)->u.enclosure))
|
||||||
#define NANCHOR(node) (&((node)->u.anchor))
|
#define ANCHOR_(node) (&((node)->u.anchor))
|
||||||
#define NCONS(node) (&((node)->u.cons))
|
#define CONS_(node) (&((node)->u.cons))
|
||||||
#define NCALL(node) (&((node)->u.call))
|
#define CALL_(node) (&((node)->u.call))
|
||||||
|
#define GIMMICK_(node) (&((node)->u.gimmick))
|
||||||
|
|
||||||
#define NCAR(node) (NCONS(node)->car)
|
#define NODE_CAR(node) (CONS_(node)->car)
|
||||||
#define NCDR(node) (NCONS(node)->cdr)
|
#define NODE_CDR(node) (CONS_(node)->cdr)
|
||||||
|
|
||||||
|
#define CTYPE_ANYCHAR -1
|
||||||
|
#define NODE_IS_ANYCHAR(node) \
|
||||||
|
(NODE_TYPE(node) == NODE_CTYPE && CTYPE_(node)->ctype == CTYPE_ANYCHAR)
|
||||||
|
|
||||||
|
#define CTYPE_OPTION(node, reg) \
|
||||||
|
(NODE_IS_FIXED_OPTION(node) ? CTYPE_(node)->options : reg->options)
|
||||||
|
|
||||||
|
|
||||||
#define ANCHOR_ANYCHAR_STAR_MASK (ANCHOR_ANYCHAR_STAR | ANCHOR_ANYCHAR_STAR_ML)
|
#define ANCHOR_ANYCHAR_STAR_MASK (ANCHOR_ANYCHAR_STAR | ANCHOR_ANYCHAR_STAR_ML)
|
||||||
#define ANCHOR_END_BUF_MASK (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF)
|
#define ANCHOR_END_BUF_MASK (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF)
|
||||||
|
|
||||||
#define ENCLOSE_MEMORY (1<<0)
|
enum EnclosureType {
|
||||||
#define ENCLOSE_OPTION (1<<1)
|
ENCLOSURE_MEMORY = 0,
|
||||||
#define ENCLOSE_STOP_BACKTRACK (1<<2)
|
ENCLOSURE_OPTION = 1,
|
||||||
|
ENCLOSURE_STOP_BACKTRACK = 2,
|
||||||
|
ENCLOSURE_IF_ELSE = 3,
|
||||||
|
};
|
||||||
|
|
||||||
#define NODE_STR_MARGIN 16
|
#define NODE_STRING_MARGIN 16
|
||||||
#define NODE_STR_BUF_SIZE 24 /* sizeof(CClassNode) - sizeof(int)*4 */
|
#define NODE_STRING_BUF_SIZE 24 /* sizeof(CClassNode) - sizeof(int)*4 */
|
||||||
#define NODE_BACKREFS_SIZE 6
|
#define NODE_BACKREFS_SIZE 6
|
||||||
|
|
||||||
#define NSTR_RAW (1<<0) /* by backslashed number */
|
#define STRING_RAW (1<<0) /* by backslashed number */
|
||||||
#define NSTR_AMBIG (1<<1)
|
#define STRING_AMBIG (1<<1)
|
||||||
#define NSTR_DONT_GET_OPT_INFO (1<<2)
|
#define STRING_DONT_GET_OPT_INFO (1<<2)
|
||||||
|
|
||||||
#define NSTRING_LEN(node) ((node)->u.str.end - (node)->u.str.s)
|
#define NODE_STRING_LEN(node) (int )((node)->u.str.end - (node)->u.str.s)
|
||||||
#define NSTRING_SET_RAW(node) (node)->u.str.flag |= NSTR_RAW
|
#define NODE_STRING_SET_RAW(node) (node)->u.str.flag |= STRING_RAW
|
||||||
#define NSTRING_CLEAR_RAW(node) (node)->u.str.flag &= ~NSTR_RAW
|
#define NODE_STRING_CLEAR_RAW(node) (node)->u.str.flag &= ~STRING_RAW
|
||||||
#define NSTRING_SET_AMBIG(node) (node)->u.str.flag |= NSTR_AMBIG
|
#define NODE_STRING_SET_AMBIG(node) (node)->u.str.flag |= STRING_AMBIG
|
||||||
#define NSTRING_SET_DONT_GET_OPT_INFO(node) \
|
#define NODE_STRING_SET_DONT_GET_OPT_INFO(node) \
|
||||||
(node)->u.str.flag |= NSTR_DONT_GET_OPT_INFO
|
(node)->u.str.flag |= STRING_DONT_GET_OPT_INFO
|
||||||
#define NSTRING_IS_RAW(node) (((node)->u.str.flag & NSTR_RAW) != 0)
|
#define NODE_STRING_IS_RAW(node) (((node)->u.str.flag & STRING_RAW) != 0)
|
||||||
#define NSTRING_IS_AMBIG(node) (((node)->u.str.flag & NSTR_AMBIG) != 0)
|
#define NODE_STRING_IS_AMBIG(node) (((node)->u.str.flag & STRING_AMBIG) != 0)
|
||||||
#define NSTRING_IS_DONT_GET_OPT_INFO(node) \
|
#define NODE_STRING_IS_DONT_GET_OPT_INFO(node) \
|
||||||
(((node)->u.str.flag & NSTR_DONT_GET_OPT_INFO) != 0)
|
(((node)->u.str.flag & STRING_DONT_GET_OPT_INFO) != 0)
|
||||||
|
|
||||||
#define BACKREFS_P(br) \
|
#define BACKREFS_P(br) \
|
||||||
(IS_NOT_NULL((br)->back_dynamic) ? (br)->back_dynamic : (br)->back_static);
|
(IS_NOT_NULL((br)->back_dynamic) ? (br)->back_dynamic : (br)->back_static)
|
||||||
|
|
||||||
#define NQ_TARGET_ISNOT_EMPTY 0
|
enum QuantBodyEmpty {
|
||||||
#define NQ_TARGET_IS_EMPTY 1
|
QUANT_BODY_IS_NOT_EMPTY = 0,
|
||||||
#define NQ_TARGET_IS_EMPTY_MEM 2
|
QUANT_BODY_IS_EMPTY = 1,
|
||||||
#define NQ_TARGET_IS_EMPTY_REC 3
|
QUANT_BODY_IS_EMPTY_MEM = 2,
|
||||||
|
QUANT_BODY_IS_EMPTY_REC = 3
|
||||||
|
};
|
||||||
|
|
||||||
/* status bits */
|
/* node status bits */
|
||||||
#define NST_MIN_FIXED (1<<0)
|
#define NST_MIN_FIXED (1<<0)
|
||||||
#define NST_MAX_FIXED (1<<1)
|
#define NST_MAX_FIXED (1<<1)
|
||||||
#define NST_CLEN_FIXED (1<<2)
|
#define NST_CLEN_FIXED (1<<2)
|
||||||
#define NST_MARK1 (1<<3)
|
#define NST_MARK1 (1<<3)
|
||||||
#define NST_MARK2 (1<<4)
|
#define NST_MARK2 (1<<4)
|
||||||
#define NST_MEM_BACKREFED (1<<5)
|
#define NST_STOP_BT_SIMPLE_REPEAT (1<<5)
|
||||||
#define NST_STOP_BT_SIMPLE_REPEAT (1<<6)
|
#define NST_RECURSION (1<<6)
|
||||||
#define NST_RECURSION (1<<7)
|
#define NST_CALLED (1<<7)
|
||||||
#define NST_CALLED (1<<8)
|
#define NST_ADDR_FIXED (1<<8)
|
||||||
#define NST_ADDR_FIXED (1<<9)
|
#define NST_NAMED_GROUP (1<<9)
|
||||||
#define NST_NAMED_GROUP (1<<10)
|
#define NST_IN_REAL_REPEAT (1<<10) /* STK_REPEAT is nested in stack. */
|
||||||
#define NST_NAME_REF (1<<11)
|
#define NST_IN_ZERO_REPEAT (1<<11) /* (....){0} */
|
||||||
#define NST_IN_REPEAT (1<<12) /* STK_REPEAT is nested in stack. */
|
#define NST_IN_MULTI_ENTRY (1<<12)
|
||||||
#define NST_NEST_LEVEL (1<<13)
|
#define NST_NEST_LEVEL (1<<13)
|
||||||
#define NST_BY_NUMBER (1<<14) /* {n,m} */
|
#define NST_BY_NUMBER (1<<14) /* {n,m} */
|
||||||
|
#define NST_BY_NAME (1<<15) /* backref by name */
|
||||||
|
#define NST_BACKREF (1<<16)
|
||||||
|
#define NST_CHECKER (1<<17)
|
||||||
|
#define NST_FIXED_OPTION (1<<18)
|
||||||
|
#define NST_PROHIBIT_RECURSION (1<<19)
|
||||||
|
#define NST_SUPER (1<<20)
|
||||||
|
|
||||||
#define SET_ENCLOSE_STATUS(node,f) (node)->u.enclose.state |= (f)
|
|
||||||
#define CLEAR_ENCLOSE_STATUS(node,f) (node)->u.enclose.state &= ~(f)
|
|
||||||
|
|
||||||
#define IS_ENCLOSE_CALLED(en) (((en)->state & NST_CALLED) != 0)
|
#define NODE_STATUS(node) (((Node* )node)->u.base.status)
|
||||||
#define IS_ENCLOSE_ADDR_FIXED(en) (((en)->state & NST_ADDR_FIXED) != 0)
|
#define NODE_STATUS_ADD(node,f) (NODE_STATUS(node) |= (f))
|
||||||
#define IS_ENCLOSE_RECURSION(en) (((en)->state & NST_RECURSION) != 0)
|
#define NODE_STATUS_REMOVE(node,f) (NODE_STATUS(node) &= ~(f))
|
||||||
#define IS_ENCLOSE_MARK1(en) (((en)->state & NST_MARK1) != 0)
|
|
||||||
#define IS_ENCLOSE_MARK2(en) (((en)->state & NST_MARK2) != 0)
|
|
||||||
#define IS_ENCLOSE_MIN_FIXED(en) (((en)->state & NST_MIN_FIXED) != 0)
|
|
||||||
#define IS_ENCLOSE_MAX_FIXED(en) (((en)->state & NST_MAX_FIXED) != 0)
|
|
||||||
#define IS_ENCLOSE_CLEN_FIXED(en) (((en)->state & NST_CLEN_FIXED) != 0)
|
|
||||||
#define IS_ENCLOSE_STOP_BT_SIMPLE_REPEAT(en) \
|
|
||||||
(((en)->state & NST_STOP_BT_SIMPLE_REPEAT) != 0)
|
|
||||||
#define IS_ENCLOSE_NAMED_GROUP(en) (((en)->state & NST_NAMED_GROUP) != 0)
|
|
||||||
|
|
||||||
#define SET_CALL_RECURSION(node) (node)->u.call.state |= NST_RECURSION
|
#define NODE_IS_BY_NUMBER(node) ((NODE_STATUS(node) & NST_BY_NUMBER) != 0)
|
||||||
#define IS_CALL_RECURSION(cn) (((cn)->state & NST_RECURSION) != 0)
|
#define NODE_IS_IN_REAL_REPEAT(node) ((NODE_STATUS(node) & NST_IN_REAL_REPEAT) != 0)
|
||||||
#define IS_CALL_NAME_REF(cn) (((cn)->state & NST_NAME_REF) != 0)
|
#define NODE_IS_CALLED(node) ((NODE_STATUS(node) & NST_CALLED) != 0)
|
||||||
#define IS_BACKREF_NAME_REF(bn) (((bn)->state & NST_NAME_REF) != 0)
|
#define NODE_IS_IN_MULTI_ENTRY(node) ((NODE_STATUS(node) & NST_IN_MULTI_ENTRY) != 0)
|
||||||
#define IS_BACKREF_NEST_LEVEL(bn) (((bn)->state & NST_NEST_LEVEL) != 0)
|
#define NODE_IS_RECURSION(node) ((NODE_STATUS(node) & NST_RECURSION) != 0)
|
||||||
#define IS_QUANTIFIER_IN_REPEAT(qn) (((qn)->state & NST_IN_REPEAT) != 0)
|
#define NODE_IS_IN_ZERO_REPEAT(node) ((NODE_STATUS(node) & NST_IN_ZERO_REPEAT) != 0)
|
||||||
#define IS_QUANTIFIER_BY_NUMBER(qn) (((qn)->state & NST_BY_NUMBER) != 0)
|
#define NODE_IS_NAMED_GROUP(node) ((NODE_STATUS(node) & NST_NAMED_GROUP) != 0)
|
||||||
|
#define NODE_IS_ADDR_FIXED(node) ((NODE_STATUS(node) & NST_ADDR_FIXED) != 0)
|
||||||
|
#define NODE_IS_CLEN_FIXED(node) ((NODE_STATUS(node) & NST_CLEN_FIXED) != 0)
|
||||||
|
#define NODE_IS_MIN_FIXED(node) ((NODE_STATUS(node) & NST_MIN_FIXED) != 0)
|
||||||
|
#define NODE_IS_MAX_FIXED(node) ((NODE_STATUS(node) & NST_MAX_FIXED) != 0)
|
||||||
|
#define NODE_IS_MARK1(node) ((NODE_STATUS(node) & NST_MARK1) != 0)
|
||||||
|
#define NODE_IS_MARK2(node) ((NODE_STATUS(node) & NST_MARK2) != 0)
|
||||||
|
#define NODE_IS_NEST_LEVEL(node) ((NODE_STATUS(node) & NST_NEST_LEVEL) != 0)
|
||||||
|
#define NODE_IS_BY_NAME(node) ((NODE_STATUS(node) & NST_BY_NAME) != 0)
|
||||||
|
#define NODE_IS_BACKREF(node) ((NODE_STATUS(node) & NST_BACKREF) != 0)
|
||||||
|
#define NODE_IS_CHECKER(node) ((NODE_STATUS(node) & NST_CHECKER) != 0)
|
||||||
|
#define NODE_IS_FIXED_OPTION(node) ((NODE_STATUS(node) & NST_FIXED_OPTION) != 0)
|
||||||
|
#define NODE_IS_SUPER(node) ((NODE_STATUS(node) & NST_SUPER) != 0)
|
||||||
|
#define NODE_IS_PROHIBIT_RECURSION(node) \
|
||||||
|
((NODE_STATUS(node) & NST_PROHIBIT_RECURSION) != 0)
|
||||||
|
#define NODE_IS_STOP_BT_SIMPLE_REPEAT(node) \
|
||||||
|
((NODE_STATUS(node) & NST_STOP_BT_SIMPLE_REPEAT) != 0)
|
||||||
|
|
||||||
|
#define NODE_BODY(node) ((node)->u.base.body)
|
||||||
|
#define NODE_QUANT_BODY(node) ((node)->body)
|
||||||
|
#define NODE_ENCLOSURE_BODY(node) ((node)->body)
|
||||||
|
#define NODE_CALL_BODY(node) ((node)->body)
|
||||||
|
#define NODE_ANCHOR_BODY(node) ((node)->body)
|
||||||
|
|
||||||
#define CALLNODE_REFNUM_UNDEF -1
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NodeBase base;
|
NodeType node_type;
|
||||||
|
int status;
|
||||||
|
|
||||||
UChar* s;
|
UChar* s;
|
||||||
UChar* end;
|
UChar* end;
|
||||||
unsigned int flag;
|
unsigned int flag;
|
||||||
int capa; /* (allocated size - 1) or 0: use buf[] */
|
int capa; /* (allocated size - 1) or 0: use buf[] */
|
||||||
UChar buf[NODE_STR_BUF_SIZE];
|
UChar buf[NODE_STRING_BUF_SIZE];
|
||||||
} StrNode;
|
} StrNode;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NodeBase base;
|
NodeType node_type;
|
||||||
int state;
|
int status;
|
||||||
struct _Node* target;
|
|
||||||
|
unsigned int flags;
|
||||||
|
BitSet bs;
|
||||||
|
BBuf* mbuf; /* multi-byte info or NULL */
|
||||||
|
} CClassNode;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
NodeType node_type;
|
||||||
|
int status;
|
||||||
|
struct _Node* body;
|
||||||
|
|
||||||
int lower;
|
int lower;
|
||||||
int upper;
|
int upper;
|
||||||
int greedy;
|
int greedy;
|
||||||
int target_empty_info;
|
enum QuantBodyEmpty body_empty_info;
|
||||||
struct _Node* head_exact;
|
struct _Node* head_exact;
|
||||||
struct _Node* next_head_exact;
|
struct _Node* next_head_exact;
|
||||||
int is_refered; /* include called node. don't eliminate even if {0} */
|
int is_refered; /* include called node. don't eliminate even if {0} */
|
||||||
#ifdef USE_COMBINATION_EXPLOSION_CHECK
|
} QuantNode;
|
||||||
int comb_exp_check_num; /* 1,2,3...: check, 0: no check */
|
|
||||||
#endif
|
|
||||||
} QtfrNode;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NodeBase base;
|
NodeType node_type;
|
||||||
int state;
|
int status;
|
||||||
int type;
|
struct _Node* body;
|
||||||
int regnum;
|
|
||||||
OnigOptionType option;
|
|
||||||
struct _Node* target;
|
|
||||||
AbsAddrType call_addr;
|
|
||||||
/* for multiple call reference */
|
|
||||||
OnigLen min_len; /* min length (byte) */
|
|
||||||
OnigLen max_len; /* max length (byte) */
|
|
||||||
int char_len; /* character length */
|
|
||||||
int opt_count; /* referenced count in optimize_node_left() */
|
|
||||||
} EncloseNode;
|
|
||||||
|
|
||||||
#ifdef USE_SUBEXP_CALL
|
enum EnclosureType type;
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
int regnum;
|
||||||
|
AbsAddrType called_addr;
|
||||||
|
int entry_count;
|
||||||
|
int called_state;
|
||||||
|
} m;
|
||||||
|
struct {
|
||||||
|
OnigOptionType options;
|
||||||
|
} o;
|
||||||
|
struct {
|
||||||
|
/* body is condition */
|
||||||
|
struct _Node* Then;
|
||||||
|
struct _Node* Else;
|
||||||
|
} te;
|
||||||
|
};
|
||||||
|
/* for multiple call reference */
|
||||||
|
OnigLen min_len; /* min length (byte) */
|
||||||
|
OnigLen max_len; /* max length (byte) */
|
||||||
|
int char_len; /* character length */
|
||||||
|
int opt_count; /* referenced count in optimize_nodes() */
|
||||||
|
} EnclosureNode;
|
||||||
|
|
||||||
|
#ifdef USE_CALL
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int offset;
|
int offset;
|
||||||
|
@ -211,102 +272,139 @@ typedef struct {
|
||||||
} UnsetAddrList;
|
} UnsetAddrList;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NodeBase base;
|
NodeType node_type;
|
||||||
int state;
|
int status;
|
||||||
|
struct _Node* body; /* to EnclosureNode : ENCLOSURE_MEMORY */
|
||||||
|
|
||||||
|
int by_number;
|
||||||
int group_num;
|
int group_num;
|
||||||
UChar* name;
|
UChar* name;
|
||||||
UChar* name_end;
|
UChar* name_end;
|
||||||
struct _Node* target; /* EncloseNode : ENCLOSE_MEMORY */
|
int entry_count;
|
||||||
UnsetAddrList* unset_addr_list;
|
|
||||||
} CallNode;
|
} CallNode;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NodeBase base;
|
NodeType node_type;
|
||||||
int state;
|
int status;
|
||||||
|
|
||||||
int back_num;
|
int back_num;
|
||||||
int back_static[NODE_BACKREFS_SIZE];
|
int back_static[NODE_BACKREFS_SIZE];
|
||||||
int* back_dynamic;
|
int* back_dynamic;
|
||||||
int nest_level;
|
int nest_level;
|
||||||
} BRefNode;
|
} BackRefNode;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NodeBase base;
|
NodeType node_type;
|
||||||
|
int status;
|
||||||
|
struct _Node* body;
|
||||||
|
|
||||||
int type;
|
int type;
|
||||||
struct _Node* target;
|
|
||||||
int char_len;
|
int char_len;
|
||||||
|
int ascii_mode;
|
||||||
} AnchorNode;
|
} AnchorNode;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NodeBase base;
|
NodeType node_type;
|
||||||
|
int status;
|
||||||
|
|
||||||
struct _Node* car;
|
struct _Node* car;
|
||||||
struct _Node* cdr;
|
struct _Node* cdr;
|
||||||
} ConsAltNode;
|
} ConsAltNode;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NodeBase base;
|
NodeType node_type;
|
||||||
|
int status;
|
||||||
|
|
||||||
int ctype;
|
int ctype;
|
||||||
int not;
|
int not;
|
||||||
|
OnigOptionType options;
|
||||||
|
int ascii_mode;
|
||||||
} CtypeNode;
|
} CtypeNode;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
NodeType node_type;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
enum GimmickType type;
|
||||||
|
int detail_type;
|
||||||
|
int id;
|
||||||
|
} GimmickNode;
|
||||||
|
|
||||||
typedef struct _Node {
|
typedef struct _Node {
|
||||||
union {
|
union {
|
||||||
NodeBase base;
|
struct {
|
||||||
StrNode str;
|
NodeType node_type;
|
||||||
CClassNode cclass;
|
int status;
|
||||||
QtfrNode qtfr;
|
struct _Node* body;
|
||||||
EncloseNode enclose;
|
} base;
|
||||||
BRefNode bref;
|
|
||||||
AnchorNode anchor;
|
StrNode str;
|
||||||
ConsAltNode cons;
|
CClassNode cclass;
|
||||||
CtypeNode ctype;
|
QuantNode quant;
|
||||||
#ifdef USE_SUBEXP_CALL
|
EnclosureNode enclosure;
|
||||||
CallNode call;
|
BackRefNode backref;
|
||||||
|
AnchorNode anchor;
|
||||||
|
ConsAltNode cons;
|
||||||
|
CtypeNode ctype;
|
||||||
|
#ifdef USE_CALL
|
||||||
|
CallNode call;
|
||||||
#endif
|
#endif
|
||||||
|
GimmickNode gimmick;
|
||||||
} u;
|
} u;
|
||||||
} Node;
|
} Node;
|
||||||
|
|
||||||
|
|
||||||
#define NULL_NODE ((Node* )0)
|
#define NULL_NODE ((Node* )0)
|
||||||
|
|
||||||
#define SCANENV_MEMNODES_SIZE 8
|
#define SCANENV_MEMENV_SIZE 8
|
||||||
#define SCANENV_MEM_NODES(senv) \
|
#define SCANENV_MEMENV(senv) \
|
||||||
(IS_NOT_NULL((senv)->mem_nodes_dynamic) ? \
|
(IS_NOT_NULL((senv)->mem_env_dynamic) ? \
|
||||||
(senv)->mem_nodes_dynamic : (senv)->mem_nodes_static)
|
(senv)->mem_env_dynamic : (senv)->mem_env_static)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
OnigOptionType option;
|
Node* node;
|
||||||
|
#if 0
|
||||||
|
int in;
|
||||||
|
int recursion;
|
||||||
|
#endif
|
||||||
|
} MemEnv;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
enum SaveType type;
|
||||||
|
} SaveItem;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
OnigOptionType options;
|
||||||
OnigCaseFoldType case_fold_flag;
|
OnigCaseFoldType case_fold_flag;
|
||||||
OnigEncoding enc;
|
OnigEncoding enc;
|
||||||
OnigSyntaxType* syntax;
|
OnigSyntaxType* syntax;
|
||||||
BitStatusType capture_history;
|
MemStatusType capture_history;
|
||||||
BitStatusType bt_mem_start;
|
MemStatusType bt_mem_start;
|
||||||
BitStatusType bt_mem_end;
|
MemStatusType bt_mem_end;
|
||||||
BitStatusType backrefed_mem;
|
MemStatusType backrefed_mem;
|
||||||
UChar* pattern;
|
UChar* pattern;
|
||||||
UChar* pattern_end;
|
UChar* pattern_end;
|
||||||
UChar* error;
|
UChar* error;
|
||||||
UChar* error_end;
|
UChar* error_end;
|
||||||
regex_t* reg; /* for reg->names only */
|
regex_t* reg; /* for reg->names only */
|
||||||
int num_call;
|
int num_call;
|
||||||
#ifdef USE_SUBEXP_CALL
|
#ifdef USE_CALL
|
||||||
UnsetAddrList* unset_addr_list;
|
UnsetAddrList* unset_addr_list;
|
||||||
|
int has_call_zero;
|
||||||
#endif
|
#endif
|
||||||
int num_mem;
|
int num_mem;
|
||||||
#ifdef USE_NAMED_GROUP
|
|
||||||
int num_named;
|
int num_named;
|
||||||
#endif
|
|
||||||
int mem_alloc;
|
int mem_alloc;
|
||||||
Node* mem_nodes_static[SCANENV_MEMNODES_SIZE];
|
MemEnv mem_env_static[SCANENV_MEMENV_SIZE];
|
||||||
Node** mem_nodes_dynamic;
|
MemEnv* mem_env_dynamic;
|
||||||
#ifdef USE_COMBINATION_EXPLOSION_CHECK
|
unsigned int parse_depth;
|
||||||
int num_comb_exp_check;
|
|
||||||
int comb_exp_max_regnum;
|
int keep_num;
|
||||||
int curr_max_regnum;
|
int save_num;
|
||||||
int has_recursion;
|
int save_alloc_num;
|
||||||
#endif
|
SaveItem* saves;
|
||||||
unsigned int parse_depth;
|
|
||||||
} ScanEnv;
|
} ScanEnv;
|
||||||
|
|
||||||
|
|
||||||
|
@ -314,13 +412,11 @@ typedef struct {
|
||||||
#define IS_SYNTAX_OP2(syn, opm) (((syn)->op2 & (opm)) != 0)
|
#define IS_SYNTAX_OP2(syn, opm) (((syn)->op2 & (opm)) != 0)
|
||||||
#define IS_SYNTAX_BV(syn, bvm) (((syn)->behavior & (bvm)) != 0)
|
#define IS_SYNTAX_BV(syn, bvm) (((syn)->behavior & (bvm)) != 0)
|
||||||
|
|
||||||
#ifdef USE_NAMED_GROUP
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int new_val;
|
int new_val;
|
||||||
} GroupNumRemap;
|
} GroupNumRemap;
|
||||||
|
|
||||||
extern int onig_renumber_name_table P_((regex_t* reg, GroupNumRemap* map));
|
extern int onig_renumber_name_table P_((regex_t* reg, GroupNumRemap* map));
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int onig_strncmp P_((const UChar* s1, const UChar* s2, int n));
|
extern int onig_strncmp P_((const UChar* s1, const UChar* s2, int n));
|
||||||
extern void onig_strcpy P_((UChar* dest, const UChar* src, const UChar* end));
|
extern void onig_strcpy P_((UChar* dest, const UChar* src, const UChar* end));
|
||||||
|
@ -331,21 +427,21 @@ extern void onig_node_conv_to_str_node P_((Node* node, int raw));
|
||||||
extern int onig_node_str_cat P_((Node* node, const UChar* s, const UChar* end));
|
extern int onig_node_str_cat P_((Node* node, const UChar* s, const UChar* end));
|
||||||
extern int onig_node_str_set P_((Node* node, const UChar* s, const UChar* end));
|
extern int onig_node_str_set P_((Node* node, const UChar* s, const UChar* end));
|
||||||
extern void onig_node_free P_((Node* node));
|
extern void onig_node_free P_((Node* node));
|
||||||
extern Node* onig_node_new_enclose P_((int type));
|
extern Node* onig_node_new_enclosure P_((int type));
|
||||||
extern Node* onig_node_new_anchor P_((int type));
|
extern Node* onig_node_new_anchor P_((int type, int ascii_mode));
|
||||||
extern Node* onig_node_new_str P_((const UChar* s, const UChar* end));
|
extern Node* onig_node_new_str P_((const UChar* s, const UChar* end));
|
||||||
extern Node* onig_node_new_list P_((Node* left, Node* right));
|
extern Node* onig_node_new_list P_((Node* left, Node* right));
|
||||||
extern Node* onig_node_list_add P_((Node* list, Node* x));
|
extern Node* onig_node_list_add P_((Node* list, Node* x));
|
||||||
extern Node* onig_node_new_alt P_((Node* left, Node* right));
|
extern Node* onig_node_new_alt P_((Node* left, Node* right));
|
||||||
extern void onig_node_str_clear P_((Node* node));
|
extern void onig_node_str_clear P_((Node* node));
|
||||||
extern int onig_names_free P_((regex_t* reg));
|
extern int onig_names_free P_((regex_t* reg));
|
||||||
extern int onig_parse_make_tree P_((Node** root, const UChar* pattern, const UChar* end, regex_t* reg, ScanEnv* env));
|
extern int onig_parse_tree P_((Node** root, const UChar* pattern, const UChar* end, regex_t* reg, ScanEnv* env));
|
||||||
extern int onig_free_shared_cclass_table P_((void));
|
extern int onig_free_shared_cclass_table P_((void));
|
||||||
|
extern int onig_is_code_in_cc P_((OnigEncoding enc, OnigCodePoint code, CClassNode* cc));
|
||||||
|
extern OnigLen onig_get_tiny_min_len(Node* node, unsigned int inhibit_node_types, int* invalid_node);
|
||||||
|
|
||||||
#ifdef ONIG_DEBUG
|
#ifdef ONIG_DEBUG
|
||||||
#ifdef USE_NAMED_GROUP
|
|
||||||
extern int onig_print_names(FILE*, regex_t*);
|
extern int onig_print_names(FILE*, regex_t*);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* REGPARSE_H */
|
#endif /* REGPARSE_H */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
regposix.c - Oniguruma (regular expression library)
|
regposix.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
if (ONIGENC_MBC_MINLEN(enc) == 1) { \
|
if (ONIGENC_MBC_MINLEN(enc) == 1) { \
|
||||||
UChar* tmps = (UChar* )(s); \
|
UChar* tmps = (UChar* )(s); \
|
||||||
while (*tmps != 0) tmps++; \
|
while (*tmps != 0) tmps++; \
|
||||||
len = tmps - (UChar* )(s); \
|
len = (int )(tmps - (UChar* )(s));\
|
||||||
} \
|
} \
|
||||||
else { \
|
else { \
|
||||||
len = onigenc_str_bytelen_null(enc, (UChar* )s); \
|
len = onigenc_str_bytelen_null(enc, (UChar* )s); \
|
||||||
|
@ -60,6 +60,7 @@ onig2posix_error_code(int code)
|
||||||
{ ONIG_NO_SUPPORT_CONFIG, REG_EONIG_INTERNAL },
|
{ ONIG_NO_SUPPORT_CONFIG, REG_EONIG_INTERNAL },
|
||||||
{ ONIGERR_MEMORY, REG_ESPACE },
|
{ ONIGERR_MEMORY, REG_ESPACE },
|
||||||
{ ONIGERR_MATCH_STACK_LIMIT_OVER, REG_EONIG_INTERNAL },
|
{ ONIGERR_MATCH_STACK_LIMIT_OVER, REG_EONIG_INTERNAL },
|
||||||
|
{ ONIGERR_TRY_IN_MATCH_LIMIT_OVER, REG_EONIG_INTERNAL },
|
||||||
{ ONIGERR_TYPE_BUG, REG_EONIG_INTERNAL },
|
{ ONIGERR_TYPE_BUG, REG_EONIG_INTERNAL },
|
||||||
{ ONIGERR_PARSER_BUG, REG_EONIG_INTERNAL },
|
{ ONIGERR_PARSER_BUG, REG_EONIG_INTERNAL },
|
||||||
{ ONIGERR_STACK_BUG, REG_EONIG_INTERNAL },
|
{ ONIGERR_STACK_BUG, REG_EONIG_INTERNAL },
|
||||||
|
@ -114,6 +115,9 @@ onig2posix_error_code(int code)
|
||||||
{ ONIGERR_NEVER_ENDING_RECURSION, REG_BADPAT },
|
{ ONIGERR_NEVER_ENDING_RECURSION, REG_BADPAT },
|
||||||
{ ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY, REG_BADPAT },
|
{ ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY, REG_BADPAT },
|
||||||
{ ONIGERR_INVALID_CHAR_PROPERTY_NAME, REG_BADPAT },
|
{ ONIGERR_INVALID_CHAR_PROPERTY_NAME, REG_BADPAT },
|
||||||
|
{ ONIGERR_INVALID_IF_ELSE_SYNTAX, REG_BADPAT },
|
||||||
|
{ ONIGERR_INVALID_ABSENT_GROUP_PATTERN, REG_BADPAT },
|
||||||
|
{ ONIGERR_INVALID_ABSENT_GROUP_GENERATOR_PATTERN, REG_BADPAT },
|
||||||
{ ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION, REG_EONIG_BADARG },
|
{ ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION, REG_EONIG_BADARG },
|
||||||
{ ONIGERR_LIBRARY_IS_NOT_INITIALIZED, REG_EONIG_INTERNAL }
|
{ ONIGERR_LIBRARY_IS_NOT_INITIALIZED, REG_EONIG_INTERNAL }
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
regsyntax.c - Oniguruma (regular expression library)
|
regsyntax.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2006 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -67,8 +67,8 @@ OnigSyntaxType OnigSyntaxPosixExtended = {
|
||||||
ONIG_SYN_OP_BRACE_INTERVAL |
|
ONIG_SYN_OP_BRACE_INTERVAL |
|
||||||
ONIG_SYN_OP_PLUS_ONE_INF | ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_VBAR_ALT )
|
ONIG_SYN_OP_PLUS_ONE_INF | ONIG_SYN_OP_QMARK_ZERO_ONE | ONIG_SYN_OP_VBAR_ALT )
|
||||||
, 0
|
, 0
|
||||||
, ( ONIG_SYN_CONTEXT_INDEP_ANCHORS |
|
, ( ONIG_SYN_CONTEXT_INDEP_ANCHORS |
|
||||||
ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS |
|
ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS |
|
||||||
ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP |
|
ONIG_SYN_ALLOW_UNMATCHED_CLOSE_SUBEXP |
|
||||||
ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC )
|
ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC )
|
||||||
, ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_MULTILINE )
|
, ( ONIG_OPTION_SINGLELINE | ONIG_OPTION_MULTILINE )
|
||||||
|
@ -174,8 +174,14 @@ OnigSyntaxType OnigSyntaxPerl = {
|
||||||
& ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
|
& ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
|
||||||
, ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
|
, ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
|
||||||
ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
|
ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
|
||||||
|
ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE |
|
||||||
|
ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP |
|
||||||
|
ONIG_SYN_OP2_ESC_X_Y_GRAPHEME_CLUSTER |
|
||||||
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
|
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
|
||||||
ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT )
|
ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
|
||||||
|
ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP |
|
||||||
|
ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE |
|
||||||
|
ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT )
|
||||||
, SYN_GNU_REGEX_BV
|
, SYN_GNU_REGEX_BV
|
||||||
, ONIG_OPTION_SINGLELINE
|
, ONIG_OPTION_SINGLELINE
|
||||||
,
|
,
|
||||||
|
@ -199,11 +205,18 @@ OnigSyntaxType OnigSyntaxPerl_NG = {
|
||||||
& ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
|
& ~ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END )
|
||||||
, ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
|
, ( ONIG_SYN_OP2_ESC_CAPITAL_Q_QUOTE |
|
||||||
ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
|
ONIG_SYN_OP2_QMARK_GROUP_EFFECT | ONIG_SYN_OP2_OPTION_PERL |
|
||||||
|
ONIG_SYN_OP2_QMARK_LPAREN_IF_ELSE |
|
||||||
|
ONIG_SYN_OP2_QMARK_TILDE_ABSENT_GROUP |
|
||||||
|
ONIG_SYN_OP2_ESC_X_Y_GRAPHEME_CLUSTER |
|
||||||
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
|
ONIG_SYN_OP2_ESC_P_BRACE_CHAR_PROPERTY |
|
||||||
ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
|
ONIG_SYN_OP2_ESC_P_BRACE_CIRCUMFLEX_NOT |
|
||||||
ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP |
|
ONIG_SYN_OP2_QMARK_LT_NAMED_GROUP |
|
||||||
ONIG_SYN_OP2_ESC_K_NAMED_BACKREF |
|
ONIG_SYN_OP2_ESC_K_NAMED_BACKREF |
|
||||||
ONIG_SYN_OP2_ESC_G_SUBEXP_CALL )
|
ONIG_SYN_OP2_ESC_G_SUBEXP_CALL |
|
||||||
|
ONIG_SYN_OP2_ESC_CAPITAL_K_KEEP |
|
||||||
|
ONIG_SYN_OP2_ESC_CAPITAL_R_GENERAL_NEWLINE |
|
||||||
|
ONIG_SYN_OP2_ESC_CAPITAL_N_O_SUPER_DOT |
|
||||||
|
ONIG_SYN_OP2_QMARK_PERL_SUBEXP_CALL )
|
||||||
, ( SYN_GNU_REGEX_BV |
|
, ( SYN_GNU_REGEX_BV |
|
||||||
ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP |
|
ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP |
|
||||||
ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME )
|
ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME )
|
||||||
|
@ -225,7 +238,7 @@ extern int
|
||||||
onig_set_default_syntax(OnigSyntaxType* syntax)
|
onig_set_default_syntax(OnigSyntaxType* syntax)
|
||||||
{
|
{
|
||||||
if (IS_NULL(syntax))
|
if (IS_NULL(syntax))
|
||||||
syntax = ONIG_SYNTAX_RUBY;
|
syntax = ONIG_SYNTAX_ONIGURUMA;
|
||||||
|
|
||||||
OnigDefaultSyntax = syntax;
|
OnigDefaultSyntax = syntax;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
regversion.c - Oniguruma (regular expression library)
|
regversion.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2018 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -49,7 +49,7 @@ onig_copyright(void)
|
||||||
static char s[58];
|
static char s[58];
|
||||||
|
|
||||||
xsnprintf(s, sizeof(s),
|
xsnprintf(s, sizeof(s),
|
||||||
"Oniguruma %d.%d.%d : Copyright (C) 2002-2016 K.Kosako",
|
"Oniguruma %d.%d.%d : Copyright (C) 2002-2018 K.Kosako",
|
||||||
ONIGURUMA_VERSION_MAJOR,
|
ONIGURUMA_VERSION_MAJOR,
|
||||||
ONIGURUMA_VERSION_MINOR,
|
ONIGURUMA_VERSION_MINOR,
|
||||||
ONIGURUMA_VERSION_TEENY);
|
ONIGURUMA_VERSION_TEENY);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
sjis.c - Oniguruma (regular expression library)
|
sjis.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -156,7 +156,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
|
||||||
if (enclen(ONIG_ENCODING_SJIS, buf) != (p - buf))
|
if (enclen(ONIG_ENCODING_SJIS, buf) != (p - buf))
|
||||||
return REGERR_INVALID_CODE_POINT_VALUE;
|
return REGERR_INVALID_CODE_POINT_VALUE;
|
||||||
#endif
|
#endif
|
||||||
return p - buf;
|
return (int )(p - buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -188,7 +188,7 @@ is_mbc_ambiguous(OnigCaseFoldType flag,
|
||||||
const UChar** pp, const UChar* end)
|
const UChar** pp, const UChar* end)
|
||||||
{
|
{
|
||||||
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_SJIS, flag, pp, end);
|
return onigenc_mbn_is_mbc_ambiguous(ONIG_ENCODING_SJIS, flag, pp, end);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ left_adjust_char_head(const UChar* start, const UChar* s)
|
||||||
p++;
|
p++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
len = enclen(ONIG_ENCODING_SJIS, p);
|
len = enclen(ONIG_ENCODING_SJIS, p);
|
||||||
if (p + len > s) return (UChar* )p;
|
if (p + len > s) return (UChar* )p;
|
||||||
|
@ -262,7 +262,7 @@ static int
|
||||||
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
||||||
{
|
{
|
||||||
struct PropertyNameCtype* pc;
|
struct PropertyNameCtype* pc;
|
||||||
int len = end - p;
|
int len = (int )(end - p);
|
||||||
char q[32];
|
char q[32];
|
||||||
|
|
||||||
if (len < sizeof(q) - 1) {
|
if (len < sizeof(q) - 1) {
|
||||||
|
|
|
@ -108,17 +108,16 @@ new_size(size)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
for (i=3; i<31; i++) {
|
for (i=3; i<31; i++) {
|
||||||
if ((1<<i) > size) return 1<<i;
|
if ((1<<i) > size) return 1<<i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
#else
|
#else
|
||||||
int newsize;
|
int newsize;
|
||||||
|
|
||||||
for (i = 0, newsize = MINSIZE;
|
for (i = 0, newsize = MINSIZE;
|
||||||
i < (int )(sizeof(primes)/sizeof(primes[0]));
|
i < (int )(sizeof(primes)/sizeof(primes[0]));
|
||||||
i++, newsize <<= 1)
|
i++, newsize <<= 1) {
|
||||||
{
|
if (newsize > size) return primes[i];
|
||||||
if (newsize > size) return primes[i];
|
|
||||||
}
|
}
|
||||||
/* Ran out of polynomials */
|
/* Ran out of polynomials */
|
||||||
return -1; /* should raise exception */
|
return -1; /* should raise exception */
|
||||||
|
@ -145,82 +144,82 @@ st_init_table_with_size(type, size)
|
||||||
struct st_hash_type *type;
|
struct st_hash_type *type;
|
||||||
int size;
|
int size;
|
||||||
{
|
{
|
||||||
st_table *tbl;
|
st_table *tbl;
|
||||||
|
|
||||||
#ifdef HASH_LOG
|
#ifdef HASH_LOG
|
||||||
if (init_st == 0) {
|
if (init_st == 0) {
|
||||||
init_st = 1;
|
init_st = 1;
|
||||||
atexit(stat_col);
|
atexit(stat_col);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
size = new_size(size); /* round up to prime number */
|
size = new_size(size); /* round up to prime number */
|
||||||
|
|
||||||
tbl = alloc(st_table);
|
tbl = alloc(st_table);
|
||||||
if (tbl == 0) return 0;
|
if (tbl == 0) return 0;
|
||||||
|
|
||||||
tbl->type = type;
|
tbl->type = type;
|
||||||
tbl->num_entries = 0;
|
tbl->num_entries = 0;
|
||||||
tbl->num_bins = size;
|
tbl->num_bins = size;
|
||||||
tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*));
|
tbl->bins = (st_table_entry **)Calloc(size, sizeof(st_table_entry*));
|
||||||
if (tbl->bins == 0) {
|
if (tbl->bins == 0) {
|
||||||
free(tbl);
|
free(tbl);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tbl;
|
return tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
st_table*
|
st_table*
|
||||||
st_init_table(type)
|
st_init_table(type)
|
||||||
struct st_hash_type *type;
|
struct st_hash_type *type;
|
||||||
{
|
{
|
||||||
return st_init_table_with_size(type, 0);
|
return st_init_table_with_size(type, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
st_table*
|
st_table*
|
||||||
st_init_numtable(void)
|
st_init_numtable(void)
|
||||||
{
|
{
|
||||||
return st_init_table(&type_numhash);
|
return st_init_table(&type_numhash);
|
||||||
}
|
}
|
||||||
|
|
||||||
st_table*
|
st_table*
|
||||||
st_init_numtable_with_size(size)
|
st_init_numtable_with_size(size)
|
||||||
int size;
|
int size;
|
||||||
{
|
{
|
||||||
return st_init_table_with_size(&type_numhash, size);
|
return st_init_table_with_size(&type_numhash, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
st_table*
|
st_table*
|
||||||
st_init_strtable(void)
|
st_init_strtable(void)
|
||||||
{
|
{
|
||||||
return st_init_table(&type_strhash);
|
return st_init_table(&type_strhash);
|
||||||
}
|
}
|
||||||
|
|
||||||
st_table*
|
st_table*
|
||||||
st_init_strtable_with_size(size)
|
st_init_strtable_with_size(size)
|
||||||
int size;
|
int size;
|
||||||
{
|
{
|
||||||
return st_init_table_with_size(&type_strhash, size);
|
return st_init_table_with_size(&type_strhash, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
st_free_table(table)
|
st_free_table(table)
|
||||||
st_table *table;
|
st_table *table;
|
||||||
{
|
{
|
||||||
register st_table_entry *ptr, *next;
|
register st_table_entry *ptr, *next;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < table->num_bins; i++) {
|
for(i = 0; i < table->num_bins; i++) {
|
||||||
ptr = table->bins[i];
|
ptr = table->bins[i];
|
||||||
while (ptr != 0) {
|
while (ptr != 0) {
|
||||||
next = ptr->next;
|
next = ptr->next;
|
||||||
free(ptr);
|
free(ptr);
|
||||||
ptr = next;
|
ptr = next;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
free(table->bins);
|
}
|
||||||
free(table);
|
free(table->bins);
|
||||||
|
free(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PTR_NOT_EQUAL(table, ptr, hash_val, key) \
|
#define PTR_NOT_EQUAL(table, ptr, hash_val, key) \
|
||||||
|
@ -236,187 +235,186 @@ st_free_table(table)
|
||||||
bin_pos = hash_val%(table)->num_bins;\
|
bin_pos = hash_val%(table)->num_bins;\
|
||||||
ptr = (table)->bins[bin_pos];\
|
ptr = (table)->bins[bin_pos];\
|
||||||
if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {\
|
if (PTR_NOT_EQUAL(table, ptr, hash_val, key)) {\
|
||||||
COLLISION;\
|
COLLISION;\
|
||||||
while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\
|
while (PTR_NOT_EQUAL(table, ptr->next, hash_val, key)) {\
|
||||||
ptr = ptr->next;\
|
ptr = ptr->next;\
|
||||||
}\
|
}\
|
||||||
ptr = ptr->next;\
|
ptr = ptr->next;\
|
||||||
}\
|
}\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
int
|
int
|
||||||
st_lookup(table, key, value)
|
st_lookup(table, key, value)
|
||||||
st_table *table;
|
st_table *table;
|
||||||
register st_data_t key;
|
register st_data_t key;
|
||||||
st_data_t *value;
|
st_data_t *value;
|
||||||
{
|
{
|
||||||
unsigned int hash_val, bin_pos;
|
unsigned int hash_val, bin_pos;
|
||||||
register st_table_entry *ptr;
|
register st_table_entry *ptr;
|
||||||
|
|
||||||
hash_val = do_hash(key, table);
|
hash_val = do_hash(key, table);
|
||||||
FIND_ENTRY(table, ptr, hash_val, bin_pos);
|
FIND_ENTRY(table, ptr, hash_val, bin_pos);
|
||||||
|
|
||||||
if (ptr == 0) {
|
if (ptr == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (value != 0) *value = ptr->record;
|
if (value != 0) *value = ptr->record;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ADD_DIRECT(table, key, value, hash_val, bin_pos)\
|
#define ADD_DIRECT(table, key, value, hash_val, bin_pos, ret) \
|
||||||
do {\
|
do {\
|
||||||
st_table_entry *entry;\
|
st_table_entry *entry;\
|
||||||
if (table->num_entries/(table->num_bins) > ST_DEFAULT_MAX_DENSITY) {\
|
if (table->num_entries/(table->num_bins) > ST_DEFAULT_MAX_DENSITY) {\
|
||||||
rehash(table);\
|
rehash(table);\
|
||||||
bin_pos = hash_val % table->num_bins;\
|
bin_pos = hash_val % table->num_bins;\
|
||||||
}\
|
}\
|
||||||
\
|
entry = alloc(st_table_entry);\
|
||||||
entry = alloc(st_table_entry);\
|
if (IS_NULL(entry)) return ret;\
|
||||||
\
|
entry->hash = hash_val;\
|
||||||
entry->hash = hash_val;\
|
entry->key = key;\
|
||||||
entry->key = key;\
|
entry->record = value;\
|
||||||
entry->record = value;\
|
entry->next = table->bins[bin_pos];\
|
||||||
entry->next = table->bins[bin_pos];\
|
table->bins[bin_pos] = entry;\
|
||||||
table->bins[bin_pos] = entry;\
|
table->num_entries++;\
|
||||||
table->num_entries++;\
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
int
|
int
|
||||||
st_insert(table, key, value)
|
st_insert(table, key, value)
|
||||||
register st_table *table;
|
register st_table *table;
|
||||||
register st_data_t key;
|
register st_data_t key;
|
||||||
st_data_t value;
|
st_data_t value;
|
||||||
{
|
{
|
||||||
unsigned int hash_val, bin_pos;
|
unsigned int hash_val, bin_pos;
|
||||||
register st_table_entry *ptr;
|
register st_table_entry *ptr;
|
||||||
|
|
||||||
hash_val = do_hash(key, table);
|
hash_val = do_hash(key, table);
|
||||||
FIND_ENTRY(table, ptr, hash_val, bin_pos);
|
FIND_ENTRY(table, ptr, hash_val, bin_pos);
|
||||||
|
|
||||||
if (ptr == 0) {
|
if (ptr == 0) {
|
||||||
ADD_DIRECT(table, key, value, hash_val, bin_pos);
|
ADD_DIRECT(table, key, value, hash_val, bin_pos, ONIGERR_MEMORY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ptr->record = value;
|
ptr->record = value;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
st_add_direct(table, key, value)
|
st_add_direct(table, key, value)
|
||||||
st_table *table;
|
st_table *table;
|
||||||
st_data_t key;
|
st_data_t key;
|
||||||
st_data_t value;
|
st_data_t value;
|
||||||
{
|
{
|
||||||
unsigned int hash_val, bin_pos;
|
unsigned int hash_val, bin_pos;
|
||||||
|
|
||||||
hash_val = do_hash(key, table);
|
hash_val = do_hash(key, table);
|
||||||
bin_pos = hash_val % table->num_bins;
|
bin_pos = hash_val % table->num_bins;
|
||||||
ADD_DIRECT(table, key, value, hash_val, bin_pos);
|
ADD_DIRECT(table, key, value, hash_val, bin_pos,);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rehash(table)
|
rehash(table)
|
||||||
register st_table *table;
|
register st_table *table;
|
||||||
{
|
{
|
||||||
register st_table_entry *ptr, *next, **new_bins;
|
register st_table_entry *ptr, *next, **new_bins;
|
||||||
int i, old_num_bins = table->num_bins, new_num_bins;
|
int i, old_num_bins = table->num_bins, new_num_bins;
|
||||||
unsigned int hash_val;
|
unsigned int hash_val;
|
||||||
|
|
||||||
new_num_bins = new_size(old_num_bins+1);
|
new_num_bins = new_size(old_num_bins+1);
|
||||||
new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*));
|
new_bins = (st_table_entry**)Calloc(new_num_bins, sizeof(st_table_entry*));
|
||||||
if (new_bins == 0) {
|
if (new_bins == 0) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < old_num_bins; i++) {
|
for(i = 0; i < old_num_bins; i++) {
|
||||||
ptr = table->bins[i];
|
ptr = table->bins[i];
|
||||||
while (ptr != 0) {
|
while (ptr != 0) {
|
||||||
next = ptr->next;
|
next = ptr->next;
|
||||||
hash_val = ptr->hash % new_num_bins;
|
hash_val = ptr->hash % new_num_bins;
|
||||||
ptr->next = new_bins[hash_val];
|
ptr->next = new_bins[hash_val];
|
||||||
new_bins[hash_val] = ptr;
|
new_bins[hash_val] = ptr;
|
||||||
ptr = next;
|
ptr = next;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
free(table->bins);
|
}
|
||||||
table->num_bins = new_num_bins;
|
free(table->bins);
|
||||||
table->bins = new_bins;
|
table->num_bins = new_num_bins;
|
||||||
|
table->bins = new_bins;
|
||||||
}
|
}
|
||||||
|
|
||||||
st_table*
|
st_table*
|
||||||
st_copy(old_table)
|
st_copy(old_table)
|
||||||
st_table *old_table;
|
st_table *old_table;
|
||||||
{
|
{
|
||||||
st_table *new_table;
|
st_table *new_table;
|
||||||
st_table_entry *ptr, *entry;
|
st_table_entry *ptr, *entry;
|
||||||
int i, num_bins = old_table->num_bins;
|
int i, num_bins = old_table->num_bins;
|
||||||
|
|
||||||
new_table = alloc(st_table);
|
new_table = alloc(st_table);
|
||||||
if (new_table == 0) {
|
if (new_table == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*new_table = *old_table;
|
*new_table = *old_table;
|
||||||
new_table->bins = (st_table_entry**)
|
new_table->bins = (st_table_entry**)
|
||||||
Calloc((unsigned)num_bins, sizeof(st_table_entry*));
|
Calloc((unsigned)num_bins, sizeof(st_table_entry*));
|
||||||
|
|
||||||
if (new_table->bins == 0) {
|
if (new_table->bins == 0) {
|
||||||
free(new_table);
|
free(new_table);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < num_bins; i++) {
|
for(i = 0; i < num_bins; i++) {
|
||||||
new_table->bins[i] = 0;
|
new_table->bins[i] = 0;
|
||||||
ptr = old_table->bins[i];
|
ptr = old_table->bins[i];
|
||||||
while (ptr != 0) {
|
while (ptr != 0) {
|
||||||
entry = alloc(st_table_entry);
|
entry = alloc(st_table_entry);
|
||||||
if (entry == 0) {
|
if (entry == 0) {
|
||||||
free(new_table->bins);
|
free(new_table->bins);
|
||||||
free(new_table);
|
free(new_table);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*entry = *ptr;
|
*entry = *ptr;
|
||||||
entry->next = new_table->bins[i];
|
entry->next = new_table->bins[i];
|
||||||
new_table->bins[i] = entry;
|
new_table->bins[i] = entry;
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return new_table;
|
}
|
||||||
|
return new_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
st_delete(table, key, value)
|
st_delete(table, key, value)
|
||||||
register st_table *table;
|
register st_table *table;
|
||||||
register st_data_t *key;
|
register st_data_t *key;
|
||||||
st_data_t *value;
|
st_data_t *value;
|
||||||
{
|
{
|
||||||
unsigned int hash_val;
|
unsigned int hash_val;
|
||||||
st_table_entry *tmp;
|
st_table_entry *tmp;
|
||||||
register st_table_entry *ptr;
|
register st_table_entry *ptr;
|
||||||
|
|
||||||
hash_val = do_hash_bin(*key, table);
|
hash_val = do_hash_bin(*key, table);
|
||||||
ptr = table->bins[hash_val];
|
ptr = table->bins[hash_val];
|
||||||
|
|
||||||
if (ptr == 0) {
|
if (ptr == 0) {
|
||||||
if (value != 0) *value = 0;
|
if (value != 0) *value = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EQUAL(table, *key, ptr->key)) {
|
if (EQUAL(table, *key, ptr->key)) {
|
||||||
table->bins[hash_val] = ptr->next;
|
table->bins[hash_val] = ptr->next;
|
||||||
table->num_entries--;
|
table->num_entries--;
|
||||||
if (value != 0) *value = ptr->record;
|
if (value != 0) *value = ptr->record;
|
||||||
*key = ptr->key;
|
*key = ptr->key;
|
||||||
free(ptr);
|
free(ptr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; ptr->next != 0; ptr = ptr->next) {
|
for(; ptr->next != 0; ptr = ptr->next) {
|
||||||
if (EQUAL(table, ptr->next->key, *key)) {
|
if (EQUAL(table, ptr->next->key, *key)) {
|
||||||
tmp = ptr->next;
|
tmp = ptr->next;
|
||||||
ptr->next = ptr->next->next;
|
ptr->next = ptr->next->next;
|
||||||
table->num_entries--;
|
table->num_entries--;
|
||||||
|
@ -424,41 +422,41 @@ st_delete(table, key, value)
|
||||||
*key = tmp->key;
|
*key = tmp->key;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
st_delete_safe(table, key, value, never)
|
st_delete_safe(table, key, value, never)
|
||||||
register st_table *table;
|
register st_table *table;
|
||||||
register st_data_t *key;
|
register st_data_t *key;
|
||||||
st_data_t *value;
|
st_data_t *value;
|
||||||
st_data_t never;
|
st_data_t never;
|
||||||
{
|
{
|
||||||
unsigned int hash_val;
|
unsigned int hash_val;
|
||||||
register st_table_entry *ptr;
|
register st_table_entry *ptr;
|
||||||
|
|
||||||
hash_val = do_hash_bin(*key, table);
|
hash_val = do_hash_bin(*key, table);
|
||||||
ptr = table->bins[hash_val];
|
ptr = table->bins[hash_val];
|
||||||
|
|
||||||
if (ptr == 0) {
|
if (ptr == 0) {
|
||||||
if (value != 0) *value = 0;
|
if (value != 0) *value = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; ptr != 0; ptr = ptr->next) {
|
for(; ptr != 0; ptr = ptr->next) {
|
||||||
if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) {
|
if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) {
|
||||||
table->num_entries--;
|
table->num_entries--;
|
||||||
*key = ptr->key;
|
*key = ptr->key;
|
||||||
if (value != 0) *value = ptr->record;
|
if (value != 0) *value = ptr->record;
|
||||||
ptr->key = ptr->record = never;
|
ptr->key = ptr->record = never;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -476,114 +474,114 @@ delete_never(key, value, never)
|
||||||
|
|
||||||
void
|
void
|
||||||
st_cleanup_safe(table, never)
|
st_cleanup_safe(table, never)
|
||||||
st_table *table;
|
st_table *table;
|
||||||
st_data_t never;
|
st_data_t never;
|
||||||
{
|
{
|
||||||
int num_entries = table->num_entries;
|
int num_entries = table->num_entries;
|
||||||
|
|
||||||
st_foreach(table, delete_never, never);
|
st_foreach(table, delete_never, never);
|
||||||
table->num_entries = num_entries;
|
table->num_entries = num_entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
st_foreach(table, func, arg)
|
st_foreach(table, func, arg)
|
||||||
st_table *table;
|
st_table *table;
|
||||||
int (*func)();
|
int (*func)();
|
||||||
st_data_t arg;
|
st_data_t arg;
|
||||||
{
|
{
|
||||||
st_table_entry *ptr, *last, *tmp;
|
st_table_entry *ptr, *last, *tmp;
|
||||||
enum st_retval retval;
|
enum st_retval retval;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0; i < table->num_bins; i++) {
|
for(i = 0; i < table->num_bins; i++) {
|
||||||
last = 0;
|
last = 0;
|
||||||
for(ptr = table->bins[i]; ptr != 0;) {
|
for(ptr = table->bins[i]; ptr != 0;) {
|
||||||
retval = (*func)(ptr->key, ptr->record, arg);
|
retval = (*func)(ptr->key, ptr->record, arg);
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
case ST_CHECK: /* check if hash is modified during iteration */
|
case ST_CHECK: /* check if hash is modified during iteration */
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
if (i < table->num_bins) {
|
if (i < table->num_bins) {
|
||||||
for (tmp = table->bins[i]; tmp; tmp=tmp->next) {
|
for (tmp = table->bins[i]; tmp; tmp=tmp->next) {
|
||||||
if (tmp == ptr) break;
|
if (tmp == ptr) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
/* call func with error notice */
|
/* call func with error notice */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case ST_CONTINUE:
|
case ST_CONTINUE:
|
||||||
last = ptr;
|
last = ptr;
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
break;
|
break;
|
||||||
case ST_STOP:
|
case ST_STOP:
|
||||||
return 0;
|
return 0;
|
||||||
case ST_DELETE:
|
case ST_DELETE:
|
||||||
tmp = ptr;
|
tmp = ptr;
|
||||||
if (last == 0) {
|
if (last == 0) {
|
||||||
table->bins[i] = ptr->next;
|
table->bins[i] = ptr->next;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
last->next = ptr->next;
|
last->next = ptr->next;
|
||||||
}
|
}
|
||||||
ptr = ptr->next;
|
ptr = ptr->next;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
table->num_entries--;
|
table->num_entries--;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
strhash(string)
|
strhash(string)
|
||||||
register const char *string;
|
register const char *string;
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
#ifdef HASH_ELFHASH
|
#ifdef HASH_ELFHASH
|
||||||
register unsigned int h = 0, g;
|
register unsigned int h = 0, g;
|
||||||
|
|
||||||
while ((c = *string++) != '\0') {
|
while ((c = *string++) != '\0') {
|
||||||
h = ( h << 4 ) + c;
|
h = ( h << 4 ) + c;
|
||||||
if ( g = h & 0xF0000000 )
|
if ( g = h & 0xF0000000 )
|
||||||
h ^= g >> 24;
|
h ^= g >> 24;
|
||||||
h &= ~g;
|
h &= ~g;
|
||||||
}
|
}
|
||||||
return h;
|
return h;
|
||||||
#elif HASH_PERL
|
#elif HASH_PERL
|
||||||
register int val = 0;
|
register int val = 0;
|
||||||
|
|
||||||
while ((c = *string++) != '\0') {
|
while ((c = *string++) != '\0') {
|
||||||
val += c;
|
val += c;
|
||||||
val += (val << 10);
|
val += (val << 10);
|
||||||
val ^= (val >> 6);
|
val ^= (val >> 6);
|
||||||
}
|
}
|
||||||
val += (val << 3);
|
val += (val << 3);
|
||||||
val ^= (val >> 11);
|
val ^= (val >> 11);
|
||||||
|
|
||||||
return val + (val << 15);
|
return val + (val << 15);
|
||||||
#else
|
#else
|
||||||
register int val = 0;
|
register int val = 0;
|
||||||
|
|
||||||
while ((c = *string++) != '\0') {
|
while ((c = *string++) != '\0') {
|
||||||
val = val*997 + c;
|
val = val*997 + c;
|
||||||
}
|
}
|
||||||
|
|
||||||
return val + (val>>5);
|
return val + (val>>5);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
numcmp(x, y)
|
numcmp(x, y)
|
||||||
long x, y;
|
long x, y;
|
||||||
{
|
{
|
||||||
return x != y;
|
return x != y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
numhash(n)
|
numhash(n)
|
||||||
long n;
|
long n;
|
||||||
{
|
{
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
unicode.c - Oniguruma (regular expression library)
|
unicode.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -29,6 +29,11 @@
|
||||||
|
|
||||||
#include "regint.h"
|
#include "regint.h"
|
||||||
|
|
||||||
|
struct PoolPropertyNameCtype {
|
||||||
|
short int name;
|
||||||
|
short int ctype;
|
||||||
|
};
|
||||||
|
|
||||||
#define ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE(code,ctype) \
|
#define ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE(code,ctype) \
|
||||||
((EncUNICODE_ISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
|
((EncUNICODE_ISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
|
||||||
|
|
||||||
|
@ -67,181 +72,10 @@ static const unsigned short EncUNICODE_ISO_8859_1_CtypeTable[256] = {
|
||||||
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2
|
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_UNICODE_PROPERTIES
|
|
||||||
#include "unicode_property_data.c"
|
|
||||||
#else
|
|
||||||
#include "unicode_property_data_posix.c"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "st.h"
|
#include "st.h"
|
||||||
|
|
||||||
#define USER_DEFINED_PROPERTY_MAX_NUM 20
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int ctype;
|
|
||||||
OnigCodePoint* ranges;
|
|
||||||
} UserDefinedPropertyValue;
|
|
||||||
|
|
||||||
static int UserDefinedPropertyNum;
|
|
||||||
static UserDefinedPropertyValue
|
|
||||||
UserDefinedPropertyRanges[USER_DEFINED_PROPERTY_MAX_NUM];
|
|
||||||
static st_table* UserDefinedPropertyTable;
|
|
||||||
|
|
||||||
extern int
|
|
||||||
onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)
|
|
||||||
{
|
|
||||||
UserDefinedPropertyValue* e;
|
|
||||||
int i;
|
|
||||||
int n;
|
|
||||||
int len;
|
|
||||||
int c;
|
|
||||||
char* s;
|
|
||||||
|
|
||||||
if (UserDefinedPropertyNum >= USER_DEFINED_PROPERTY_MAX_NUM)
|
|
||||||
return ONIGERR_TOO_MANY_USER_DEFINED_OBJECTS;
|
|
||||||
|
|
||||||
len = strlen(name);
|
|
||||||
if (len >= PROPERTY_NAME_MAX_SIZE)
|
|
||||||
return ONIGERR_TOO_LONG_PROPERTY_NAME;
|
|
||||||
|
|
||||||
s = (char* )xmalloc(len + 1);
|
|
||||||
if (s == 0)
|
|
||||||
return ONIGERR_MEMORY;
|
|
||||||
|
|
||||||
n = 0;
|
|
||||||
for (i = 0; i < len; i++) {
|
|
||||||
c = name[i];
|
|
||||||
if (c <= 0 || c >= 0x80) {
|
|
||||||
xfree(s);
|
|
||||||
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c != ' ' && c != '-' && c != '_') {
|
|
||||||
s[n] = c;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
s[n] = '\0';
|
|
||||||
|
|
||||||
if (UserDefinedPropertyTable == 0) {
|
|
||||||
UserDefinedPropertyTable = onig_st_init_strend_table_with_size(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
e = UserDefinedPropertyRanges + UserDefinedPropertyNum;
|
|
||||||
e->ctype = CODE_RANGES_NUM + UserDefinedPropertyNum;
|
|
||||||
e->ranges = ranges;
|
|
||||||
onig_st_insert_strend(UserDefinedPropertyTable,
|
|
||||||
(const UChar* )s, (const UChar* )s + n,
|
|
||||||
(hash_data_type )((void* )e));
|
|
||||||
|
|
||||||
UserDefinedPropertyNum++;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int
|
|
||||||
onigenc_unicode_is_code_ctype(OnigCodePoint code, unsigned int ctype)
|
|
||||||
{
|
|
||||||
if (
|
|
||||||
#ifdef USE_UNICODE_PROPERTIES
|
|
||||||
ctype <= ONIGENC_MAX_STD_CTYPE &&
|
|
||||||
#endif
|
|
||||||
code < 256) {
|
|
||||||
return ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE(code, ctype);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctype >= CODE_RANGES_NUM) {
|
|
||||||
int index = ctype - CODE_RANGES_NUM;
|
|
||||||
if (index < UserDefinedPropertyNum)
|
|
||||||
return onig_is_in_code_range((UChar* )UserDefinedPropertyRanges[index].ranges, code);
|
|
||||||
else
|
|
||||||
return ONIGERR_TYPE_BUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
return onig_is_in_code_range((UChar* )CodeRanges[ctype], code);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern int
|
|
||||||
onigenc_unicode_ctype_code_range(int ctype, const OnigCodePoint* ranges[])
|
|
||||||
{
|
|
||||||
if (ctype >= CODE_RANGES_NUM) {
|
|
||||||
int index = ctype - CODE_RANGES_NUM;
|
|
||||||
if (index < UserDefinedPropertyNum) {
|
|
||||||
*ranges = UserDefinedPropertyRanges[index].ranges;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return ONIGERR_TYPE_BUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ranges = CodeRanges[ctype];
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int
|
|
||||||
onigenc_utf16_32_get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
|
|
||||||
const OnigCodePoint* ranges[])
|
|
||||||
{
|
|
||||||
*sb_out = 0x00;
|
|
||||||
return onigenc_unicode_ctype_code_range(ctype, ranges);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int
|
|
||||||
onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
UChar *p;
|
|
||||||
OnigCodePoint code;
|
|
||||||
const struct PropertyNameCtype* pc;
|
|
||||||
char buf[PROPERTY_NAME_MAX_SIZE];
|
|
||||||
|
|
||||||
p = name;
|
|
||||||
len = 0;
|
|
||||||
while (p < end) {
|
|
||||||
code = ONIGENC_MBC_TO_CODE(enc, p, end);
|
|
||||||
if (code >= 0x80)
|
|
||||||
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
|
||||||
|
|
||||||
if (code != ' ' && code != '-' && code != '_') {
|
|
||||||
buf[len++] = (char )code;
|
|
||||||
if (len >= PROPERTY_NAME_MAX_SIZE)
|
|
||||||
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
p += enclen(enc, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
buf[len] = 0;
|
|
||||||
|
|
||||||
if (UserDefinedPropertyTable != 0) {
|
|
||||||
UserDefinedPropertyValue* e;
|
|
||||||
e = (UserDefinedPropertyValue* )NULL;
|
|
||||||
onig_st_lookup_strend(UserDefinedPropertyTable,
|
|
||||||
(const UChar* )buf, (const UChar* )buf + len,
|
|
||||||
(hash_data_type* )((void* )(&e)));
|
|
||||||
if (e != 0) {
|
|
||||||
return e->ctype;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pc = unicode_lookup_property_name(buf, len);
|
|
||||||
if (pc != 0) {
|
|
||||||
/* fprintf(stderr, "LOOKUP: %s: %d\n", buf, pc->ctype); */
|
|
||||||
#ifndef USE_UNICODE_PROPERTIES
|
|
||||||
if (pc->ctype > ONIGENC_MAX_STD_CTYPE)
|
|
||||||
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return pc->ctype;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* for use macros in unicode_fold_data.c */
|
|
||||||
#include "unicode_fold_data.c"
|
#include "unicode_fold_data.c"
|
||||||
|
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
onigenc_unicode_mbc_case_fold(OnigEncoding enc,
|
onigenc_unicode_mbc_case_fold(OnigEncoding enc,
|
||||||
OnigCaseFoldType flag ARG_UNUSED, const UChar** pp, const UChar* end,
|
OnigCaseFoldType flag ARG_UNUSED, const UChar** pp, const UChar* end,
|
||||||
|
@ -387,7 +221,7 @@ apply_case_fold3(int from, int to, OnigApplyAllCaseFoldFunc f, void* arg)
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
|
onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag,
|
||||||
OnigApplyAllCaseFoldFunc f, void* arg)
|
OnigApplyAllCaseFoldFunc f, void* arg)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -662,3 +496,390 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER
|
||||||
|
|
||||||
|
enum EGCB_BREAK_TYPE {
|
||||||
|
EGCB_NOT_BREAK = 0,
|
||||||
|
EGCB_BREAK = 1,
|
||||||
|
EGCB_BREAK_UNDEF_E_MODIFIER = 2,
|
||||||
|
EGCB_BREAK_UNDEF_RI_RI = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EGCB_TYPE {
|
||||||
|
EGCB_Other = 0,
|
||||||
|
EGCB_CR = 1,
|
||||||
|
EGCB_LF = 2,
|
||||||
|
EGCB_Control = 3,
|
||||||
|
EGCB_Extend = 4,
|
||||||
|
EGCB_Prepend = 5,
|
||||||
|
EGCB_Regional_Indicator = 6,
|
||||||
|
EGCB_SpacingMark = 7,
|
||||||
|
EGCB_ZWJ = 8,
|
||||||
|
EGCB_E_Base = 9,
|
||||||
|
EGCB_E_Base_GAZ = 10,
|
||||||
|
EGCB_E_Modifier = 11,
|
||||||
|
EGCB_Glue_After_Zwj = 12,
|
||||||
|
EGCB_L = 13,
|
||||||
|
EGCB_LV = 14,
|
||||||
|
EGCB_LVT = 15,
|
||||||
|
EGCB_T = 16,
|
||||||
|
EGCB_V = 17
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
OnigCodePoint start;
|
||||||
|
OnigCodePoint end;
|
||||||
|
enum EGCB_TYPE type;
|
||||||
|
} EGCB_RANGE_TYPE;
|
||||||
|
|
||||||
|
#include "unicode_egcb_data.c"
|
||||||
|
|
||||||
|
static enum EGCB_TYPE
|
||||||
|
egcb_get_type(OnigCodePoint code)
|
||||||
|
{
|
||||||
|
OnigCodePoint low, high, x;
|
||||||
|
enum EGCB_TYPE type;
|
||||||
|
|
||||||
|
for (low = 0, high = (OnigCodePoint )EGCB_RANGE_NUM; low < high; ) {
|
||||||
|
x = (low + high) >> 1;
|
||||||
|
if (code > EGCB_RANGES[x].end)
|
||||||
|
low = x + 1;
|
||||||
|
else
|
||||||
|
high = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
type = (low < (OnigCodePoint )EGCB_RANGE_NUM &&
|
||||||
|
code >= EGCB_RANGES[low].start) ?
|
||||||
|
EGCB_RANGES[low].type : EGCB_Other;
|
||||||
|
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define IS_CONTROL_CR_LF(code) ((code) <= EGCB_Control && (code) >= EGCB_CR)
|
||||||
|
#define IS_HANGUL(code) ((code) >= EGCB_L)
|
||||||
|
|
||||||
|
/* GB1 and GB2 are outside of this function. */
|
||||||
|
static enum EGCB_BREAK_TYPE
|
||||||
|
unicode_egcb_is_break_2code(OnigCodePoint from_code, OnigCodePoint to_code)
|
||||||
|
{
|
||||||
|
enum EGCB_TYPE from;
|
||||||
|
enum EGCB_TYPE to;
|
||||||
|
|
||||||
|
from = egcb_get_type(from_code);
|
||||||
|
to = egcb_get_type(to_code);
|
||||||
|
|
||||||
|
/* short cut */
|
||||||
|
if (from == 0 && to == 0) goto GB999;
|
||||||
|
|
||||||
|
/* GB3 */
|
||||||
|
if (from == EGCB_CR && to == EGCB_LF) return EGCB_NOT_BREAK;
|
||||||
|
/* GB4 */
|
||||||
|
if (IS_CONTROL_CR_LF(from)) return EGCB_BREAK;
|
||||||
|
/* GB5 */
|
||||||
|
if (IS_CONTROL_CR_LF(to)) return EGCB_BREAK;
|
||||||
|
|
||||||
|
if (IS_HANGUL(from) && IS_HANGUL(to)) {
|
||||||
|
/* GB6 */
|
||||||
|
if (from == EGCB_L && to != EGCB_T) return EGCB_NOT_BREAK;
|
||||||
|
/* GB7 */
|
||||||
|
if ((from == EGCB_LV || from == EGCB_V)
|
||||||
|
&& (to == EGCB_V || to == EGCB_T)) return EGCB_NOT_BREAK;
|
||||||
|
|
||||||
|
/* GB8 */
|
||||||
|
if ((from == EGCB_LVT || from == EGCB_T) && (to == EGCB_T))
|
||||||
|
return EGCB_NOT_BREAK;
|
||||||
|
|
||||||
|
goto GB999;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GB9 */
|
||||||
|
if (to == EGCB_Extend || to == EGCB_ZWJ) return EGCB_NOT_BREAK;
|
||||||
|
|
||||||
|
/* GB9a */
|
||||||
|
if (to == EGCB_SpacingMark) return EGCB_NOT_BREAK;
|
||||||
|
/* GB9b */
|
||||||
|
if (from == EGCB_Prepend) return EGCB_NOT_BREAK;
|
||||||
|
|
||||||
|
/* GB10 */
|
||||||
|
if (to == EGCB_E_Modifier) {
|
||||||
|
if (from == EGCB_E_Base || from == EGCB_E_Base_GAZ) return EGCB_NOT_BREAK;
|
||||||
|
if (from == EGCB_Extend) return EGCB_BREAK_UNDEF_E_MODIFIER;
|
||||||
|
goto GB999;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GB11 */
|
||||||
|
if (from == EGCB_ZWJ) {
|
||||||
|
if (to == EGCB_Glue_After_Zwj || to == EGCB_E_Base_GAZ) return EGCB_NOT_BREAK;
|
||||||
|
goto GB999;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* GB12, GB13 */
|
||||||
|
if (from == EGCB_Regional_Indicator && to == EGCB_Regional_Indicator) {
|
||||||
|
return EGCB_BREAK_UNDEF_RI_RI;
|
||||||
|
}
|
||||||
|
|
||||||
|
GB999:
|
||||||
|
return EGCB_BREAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER */
|
||||||
|
|
||||||
|
extern int
|
||||||
|
onigenc_egcb_is_break_position(OnigEncoding enc, UChar* p, UChar* prev,
|
||||||
|
const UChar* start, const UChar* end)
|
||||||
|
{
|
||||||
|
OnigCodePoint from;
|
||||||
|
OnigCodePoint to;
|
||||||
|
#ifdef USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER
|
||||||
|
enum EGCB_BREAK_TYPE btype;
|
||||||
|
enum EGCB_TYPE type;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* GB1 and GB2 */
|
||||||
|
if (p == start) return 1;
|
||||||
|
if (p == end) return 1;
|
||||||
|
|
||||||
|
if (IS_NULL(prev)) {
|
||||||
|
prev = onigenc_get_prev_char_head(enc, start, p);
|
||||||
|
if (IS_NULL(prev)) return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
from = ONIGENC_MBC_TO_CODE(enc, prev, end);
|
||||||
|
to = ONIGENC_MBC_TO_CODE(enc, p, end);
|
||||||
|
|
||||||
|
#ifdef USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER
|
||||||
|
if (! ONIGENC_IS_UNICODE_ENCODING(enc)) {
|
||||||
|
if (from == 0x000d && to == 0x000a) return 0;
|
||||||
|
else return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
btype = unicode_egcb_is_break_2code(from, to);
|
||||||
|
switch (btype) {
|
||||||
|
case EGCB_NOT_BREAK:
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case EGCB_BREAK:
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EGCB_BREAK_UNDEF_E_MODIFIER:
|
||||||
|
while ((prev = onigenc_get_prev_char_head(enc, start, prev)) != NULL) {
|
||||||
|
from = ONIGENC_MBC_TO_CODE(enc, prev, end);
|
||||||
|
type = egcb_get_type(from);
|
||||||
|
if (type == EGCB_E_Base || type == EGCB_E_Base_GAZ)
|
||||||
|
return 0;
|
||||||
|
if (type != EGCB_Extend)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EGCB_BREAK_UNDEF_RI_RI:
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
while ((prev = onigenc_get_prev_char_head(enc, start, prev)) != NULL) {
|
||||||
|
from = ONIGENC_MBC_TO_CODE(enc, prev, end);
|
||||||
|
type = egcb_get_type(from);
|
||||||
|
if (type != EGCB_Regional_Indicator)
|
||||||
|
break;
|
||||||
|
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
if ((n % 2) == 0) return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
#else
|
||||||
|
if (from == 0x000d && to == 0x000a) return 0;
|
||||||
|
else return 1;
|
||||||
|
#endif /* USE_UNICODE_EXTENDED_GRAPHEME_CLUSTER */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Undefine __GNUC__ for Escape warnings in Clang.
|
||||||
|
|
||||||
|
./unicode_property_data.c:26730:44: warning: static variable
|
||||||
|
'unicode_prop_name_pool_contents' is used in an inline function with
|
||||||
|
external linkage [-Wstatic-in-inline]
|
||||||
|
register const char *s = o + unicode_prop_name_pool;
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#undef __GNUC__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_UNICODE_PROPERTIES
|
||||||
|
#include "unicode_property_data.c"
|
||||||
|
#else
|
||||||
|
#include "unicode_property_data_posix.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USER_DEFINED_PROPERTY_MAX_NUM 20
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int ctype;
|
||||||
|
OnigCodePoint* ranges;
|
||||||
|
} UserDefinedPropertyValue;
|
||||||
|
|
||||||
|
static int UserDefinedPropertyNum;
|
||||||
|
static UserDefinedPropertyValue
|
||||||
|
UserDefinedPropertyRanges[USER_DEFINED_PROPERTY_MAX_NUM];
|
||||||
|
static st_table* UserDefinedPropertyTable;
|
||||||
|
|
||||||
|
extern int
|
||||||
|
onig_unicode_define_user_property(const char* name, OnigCodePoint* ranges)
|
||||||
|
{
|
||||||
|
UserDefinedPropertyValue* e;
|
||||||
|
int r;
|
||||||
|
int i;
|
||||||
|
int n;
|
||||||
|
int len;
|
||||||
|
int c;
|
||||||
|
char* s;
|
||||||
|
|
||||||
|
if (UserDefinedPropertyNum >= USER_DEFINED_PROPERTY_MAX_NUM)
|
||||||
|
return ONIGERR_TOO_MANY_USER_DEFINED_OBJECTS;
|
||||||
|
|
||||||
|
len = (int )strlen(name);
|
||||||
|
if (len >= PROPERTY_NAME_MAX_SIZE)
|
||||||
|
return ONIGERR_TOO_LONG_PROPERTY_NAME;
|
||||||
|
|
||||||
|
s = (char* )xmalloc(len + 1);
|
||||||
|
if (s == 0)
|
||||||
|
return ONIGERR_MEMORY;
|
||||||
|
|
||||||
|
n = 0;
|
||||||
|
for (i = 0; i < len; i++) {
|
||||||
|
c = name[i];
|
||||||
|
if (c <= 0 || c >= 0x80) {
|
||||||
|
xfree(s);
|
||||||
|
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c != ' ' && c != '-' && c != '_') {
|
||||||
|
s[n] = c;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s[n] = '\0';
|
||||||
|
|
||||||
|
if (UserDefinedPropertyTable == 0) {
|
||||||
|
UserDefinedPropertyTable = onig_st_init_strend_table_with_size(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
e = UserDefinedPropertyRanges + UserDefinedPropertyNum;
|
||||||
|
e->ctype = CODE_RANGES_NUM + UserDefinedPropertyNum;
|
||||||
|
e->ranges = ranges;
|
||||||
|
r = onig_st_insert_strend(UserDefinedPropertyTable,
|
||||||
|
(const UChar* )s, (const UChar* )s + n,
|
||||||
|
(hash_data_type )((void* )e));
|
||||||
|
if (r < 0) return r;
|
||||||
|
|
||||||
|
UserDefinedPropertyNum++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int
|
||||||
|
onigenc_unicode_is_code_ctype(OnigCodePoint code, unsigned int ctype)
|
||||||
|
{
|
||||||
|
if (
|
||||||
|
#ifdef USE_UNICODE_PROPERTIES
|
||||||
|
ctype <= ONIGENC_MAX_STD_CTYPE &&
|
||||||
|
#endif
|
||||||
|
code < 256) {
|
||||||
|
return ONIGENC_IS_UNICODE_ISO_8859_1_CTYPE(code, ctype);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctype >= CODE_RANGES_NUM) {
|
||||||
|
int index = ctype - CODE_RANGES_NUM;
|
||||||
|
if (index < UserDefinedPropertyNum)
|
||||||
|
return onig_is_in_code_range((UChar* )UserDefinedPropertyRanges[index].ranges, code);
|
||||||
|
else
|
||||||
|
return ONIGERR_TYPE_BUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
return onig_is_in_code_range((UChar* )CodeRanges[ctype], code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern int
|
||||||
|
onigenc_unicode_ctype_code_range(OnigCtype ctype, const OnigCodePoint* ranges[])
|
||||||
|
{
|
||||||
|
if (ctype >= CODE_RANGES_NUM) {
|
||||||
|
int index = ctype - CODE_RANGES_NUM;
|
||||||
|
if (index < UserDefinedPropertyNum) {
|
||||||
|
*ranges = UserDefinedPropertyRanges[index].ranges;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return ONIGERR_TYPE_BUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ranges = CodeRanges[ctype];
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int
|
||||||
|
onigenc_utf16_32_get_ctype_code_range(OnigCtype ctype, OnigCodePoint* sb_out,
|
||||||
|
const OnigCodePoint* ranges[])
|
||||||
|
{
|
||||||
|
*sb_out = 0x00;
|
||||||
|
return onigenc_unicode_ctype_code_range(ctype, ranges);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern int
|
||||||
|
onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end)
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
UChar *p;
|
||||||
|
OnigCodePoint code;
|
||||||
|
const struct PoolPropertyNameCtype* pc;
|
||||||
|
char buf[PROPERTY_NAME_MAX_SIZE];
|
||||||
|
|
||||||
|
p = name;
|
||||||
|
len = 0;
|
||||||
|
while (p < end) {
|
||||||
|
code = ONIGENC_MBC_TO_CODE(enc, p, end);
|
||||||
|
if (code >= 0x80)
|
||||||
|
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
||||||
|
|
||||||
|
if (code != ' ' && code != '-' && code != '_') {
|
||||||
|
buf[len++] = (char )code;
|
||||||
|
if (len >= PROPERTY_NAME_MAX_SIZE)
|
||||||
|
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
p += enclen(enc, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
buf[len] = 0;
|
||||||
|
|
||||||
|
if (UserDefinedPropertyTable != 0) {
|
||||||
|
UserDefinedPropertyValue* e;
|
||||||
|
e = (UserDefinedPropertyValue* )NULL;
|
||||||
|
onig_st_lookup_strend(UserDefinedPropertyTable,
|
||||||
|
(const UChar* )buf, (const UChar* )buf + len,
|
||||||
|
(hash_data_type* )((void* )(&e)));
|
||||||
|
if (e != 0) {
|
||||||
|
return e->ctype;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pc = unicode_lookup_property_name(buf, len);
|
||||||
|
if (pc != 0) {
|
||||||
|
/* fprintf(stderr, "LOOKUP: %s: %d\n", buf, pc->ctype); */
|
||||||
|
#ifndef USE_UNICODE_PROPERTIES
|
||||||
|
if (pc->ctype > ONIGENC_MAX_STD_CTYPE)
|
||||||
|
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (int )pc->ctype;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ONIGERR_INVALID_CHAR_PROPERTY_NAME;
|
||||||
|
}
|
||||||
|
|
1406
ext/mbstring/oniguruma/src/unicode_egcb_data.c
Normal file
1406
ext/mbstring/oniguruma/src/unicode_egcb_data.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -69,7 +69,7 @@ __attribute__ ((__gnu_inline__))
|
||||||
int
|
int
|
||||||
unicode_fold1_key(OnigCodePoint codes[])
|
unicode_fold1_key(OnigCodePoint codes[])
|
||||||
{
|
{
|
||||||
static const int wordlist[] =
|
static const short int wordlist[] =
|
||||||
{
|
{
|
||||||
-1, -1, -1, -1, -1, -1,
|
-1, -1, -1, -1, -1, -1,
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ __attribute__ ((__gnu_inline__))
|
||||||
int
|
int
|
||||||
unicode_fold2_key(OnigCodePoint codes[])
|
unicode_fold2_key(OnigCodePoint codes[])
|
||||||
{
|
{
|
||||||
static const int wordlist[] =
|
static const short int wordlist[] =
|
||||||
{
|
{
|
||||||
|
|
||||||
101,
|
101,
|
||||||
|
|
|
@ -69,7 +69,7 @@ __attribute__ ((__gnu_inline__))
|
||||||
int
|
int
|
||||||
unicode_fold3_key(OnigCodePoint codes[])
|
unicode_fold3_key(OnigCodePoint codes[])
|
||||||
{
|
{
|
||||||
static const int wordlist[] =
|
static const short int wordlist[] =
|
||||||
{
|
{
|
||||||
|
|
||||||
62,
|
62,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
||||||
/* ANSI-C code produced by gperf version 3.0.3 */
|
/* ANSI-C code produced by gperf version 3.0.4 */
|
||||||
/* Command-line: /Library/Developer/CommandLineTools/usr/bin/gperf -T -C -c -t -j1 -L ANSI-C --ignore-case -N unicode_lookup_property_name --output-file gperf.tmp unicode_property_data_posix.gperf */
|
/* Command-line: gperf -T -C -c -t -j1 -L ANSI-C --ignore-case --pic -Q unicode_prop_name_pool -N unicode_lookup_property_name --output-file gperf.tmp unicode_property_data_posix.gperf */
|
||||||
/* Computed positions: -k'1,3' */
|
/* Computed positions: -k'1,3' */
|
||||||
|
|
||||||
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
|
||||||
|
@ -4785,6 +4785,9 @@ const CodeRanges[] = {
|
||||||
CR_ASCII,
|
CR_ASCII,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define pool_offset(s) offsetof(struct unicode_prop_name_pool_t, unicode_prop_name_pool_str##s)
|
||||||
|
|
||||||
|
|
||||||
#define TOTAL_KEYWORDS 15
|
#define TOTAL_KEYWORDS 15
|
||||||
#define MIN_WORD_LENGTH 4
|
#define MIN_WORD_LENGTH 4
|
||||||
#define MAX_WORD_LENGTH 7
|
#define MAX_WORD_LENGTH 7
|
||||||
|
@ -4879,54 +4882,101 @@ hash (register const char *str, register unsigned int len)
|
||||||
return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
|
return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct PropertyNameCtype *
|
struct unicode_prop_name_pool_t
|
||||||
|
{
|
||||||
|
char unicode_prop_name_pool_str5[sizeof("print")];
|
||||||
|
char unicode_prop_name_pool_str6[sizeof("punct")];
|
||||||
|
char unicode_prop_name_pool_str7[sizeof("alpha")];
|
||||||
|
char unicode_prop_name_pool_str8[sizeof("alnum")];
|
||||||
|
char unicode_prop_name_pool_str9[sizeof("xdigit")];
|
||||||
|
char unicode_prop_name_pool_str10[sizeof("newline")];
|
||||||
|
char unicode_prop_name_pool_str11[sizeof("upper")];
|
||||||
|
char unicode_prop_name_pool_str12[sizeof("ascii")];
|
||||||
|
char unicode_prop_name_pool_str13[sizeof("cntrl")];
|
||||||
|
char unicode_prop_name_pool_str14[sizeof("space")];
|
||||||
|
char unicode_prop_name_pool_str15[sizeof("word")];
|
||||||
|
char unicode_prop_name_pool_str16[sizeof("lower")];
|
||||||
|
char unicode_prop_name_pool_str17[sizeof("graph")];
|
||||||
|
char unicode_prop_name_pool_str18[sizeof("digit")];
|
||||||
|
char unicode_prop_name_pool_str19[sizeof("blank")];
|
||||||
|
};
|
||||||
|
static const struct unicode_prop_name_pool_t unicode_prop_name_pool_contents =
|
||||||
|
{
|
||||||
|
"print",
|
||||||
|
"punct",
|
||||||
|
"alpha",
|
||||||
|
"alnum",
|
||||||
|
"xdigit",
|
||||||
|
"newline",
|
||||||
|
"upper",
|
||||||
|
"ascii",
|
||||||
|
"cntrl",
|
||||||
|
"space",
|
||||||
|
"word",
|
||||||
|
"lower",
|
||||||
|
"graph",
|
||||||
|
"digit",
|
||||||
|
"blank"
|
||||||
|
};
|
||||||
|
#define unicode_prop_name_pool ((const char *) &unicode_prop_name_pool_contents)
|
||||||
|
#ifdef __GNUC__
|
||||||
|
__inline
|
||||||
|
#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
|
||||||
|
__attribute__ ((__gnu_inline__))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
const struct PoolPropertyNameCtype *
|
||||||
unicode_lookup_property_name (register const char *str, register unsigned int len)
|
unicode_lookup_property_name (register const char *str, register unsigned int len)
|
||||||
{
|
{
|
||||||
static const struct PropertyNameCtype wordlist[] =
|
static const struct PoolPropertyNameCtype wordlist[] =
|
||||||
{
|
{
|
||||||
{""}, {""}, {""}, {""}, {""},
|
{-1}, {-1}, {-1}, {-1}, {-1},
|
||||||
|
|
||||||
{"print", 7},
|
{pool_offset(5), 7},
|
||||||
|
|
||||||
{"punct", 8},
|
{pool_offset(6), 8},
|
||||||
|
|
||||||
{"alpha", 1},
|
{pool_offset(7), 1},
|
||||||
|
|
||||||
{"alnum", 13},
|
{pool_offset(8), 13},
|
||||||
|
|
||||||
{"xdigit", 11},
|
{pool_offset(9), 11},
|
||||||
|
|
||||||
{"newline", 0},
|
{pool_offset(10), 0},
|
||||||
|
|
||||||
{"upper", 10},
|
{pool_offset(11), 10},
|
||||||
|
|
||||||
{"ascii", 14},
|
{pool_offset(12), 14},
|
||||||
|
|
||||||
{"cntrl", 3},
|
{pool_offset(13), 3},
|
||||||
|
|
||||||
{"space", 9},
|
{pool_offset(14), 9},
|
||||||
|
|
||||||
{"word", 12},
|
{pool_offset(15), 12},
|
||||||
|
|
||||||
{"lower", 6},
|
{pool_offset(16), 6},
|
||||||
|
|
||||||
{"graph", 5},
|
{pool_offset(17), 5},
|
||||||
|
|
||||||
{"digit", 4},
|
{pool_offset(18), 4},
|
||||||
|
|
||||||
{"blank", 2}
|
{pool_offset(19), 2}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
||||||
{
|
{
|
||||||
unsigned int key = hash (str, len);
|
register int key = hash (str, len);
|
||||||
|
|
||||||
if (key <= MAX_HASH_VALUE)
|
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||||
{
|
{
|
||||||
register const char *s = wordlist[key].name;
|
register int o = wordlist[key].name;
|
||||||
|
if (o >= 0)
|
||||||
|
{
|
||||||
|
register const char *s = o + unicode_prop_name_pool;
|
||||||
|
|
||||||
if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
|
if ((((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gperf_case_strncmp (str, s, len) && s[len] == '\0')
|
||||||
return &wordlist[key];
|
return &wordlist[key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
utf8.c - Oniguruma (regular expression library)
|
utf8.c - Oniguruma (regular expression library)
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2002-2016 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
* Copyright (c) 2002-2017 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -90,6 +90,7 @@ is_valid_mbc_string(const UChar* p, const UChar* end)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static int
|
static int
|
||||||
is_mbc_newline(const UChar* p, const UChar* end)
|
is_mbc_newline(const UChar* p, const UChar* end)
|
||||||
{
|
{
|
||||||
|
@ -114,6 +115,7 @@ is_mbc_newline(const UChar* p, const UChar* end)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static OnigCodePoint
|
static OnigCodePoint
|
||||||
mbc_to_code(const UChar* p, const UChar* end)
|
mbc_to_code(const UChar* p, const UChar* end)
|
||||||
|
@ -122,7 +124,7 @@ mbc_to_code(const UChar* p, const UChar* end)
|
||||||
OnigCodePoint n;
|
OnigCodePoint n;
|
||||||
|
|
||||||
len = mbc_enc_len(p);
|
len = mbc_enc_len(p);
|
||||||
if (len > end - p) len = end - p;
|
if (len > (int )(end - p)) len = (int )(end - p);
|
||||||
|
|
||||||
c = *p++;
|
c = *p++;
|
||||||
if (len > 1) {
|
if (len > 1) {
|
||||||
|
@ -214,7 +216,7 @@ code_to_mbc(OnigCodePoint code, UChar *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
*p++ = UTF8_TRAIL0(code);
|
*p++ = UTF8_TRAIL0(code);
|
||||||
return p - buf;
|
return (int )(p - buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,43 +248,6 @@ mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
static int
|
|
||||||
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
|
|
||||||
{
|
|
||||||
const UChar* p = *pp;
|
|
||||||
|
|
||||||
if (ONIGENC_IS_MBC_ASCII(p)) {
|
|
||||||
(*pp)++;
|
|
||||||
return ONIGENC_IS_ASCII_CODE_CASE_AMBIG(*p);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
(*pp) += enclen(ONIG_ENCODING_UTF8, p);
|
|
||||||
|
|
||||||
if (*p == 0xc3) {
|
|
||||||
int c = *(p + 1);
|
|
||||||
if (c >= 0x80) {
|
|
||||||
if (c <= (UChar )0x9e) { /* upper */
|
|
||||||
if (c == (UChar )0x97) return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else if (c >= (UChar )0xa0 && c <= (UChar )0xbe) { /* lower */
|
|
||||||
if (c == (UChar )'\267') return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else if (c == (UChar )0x9f &&
|
|
||||||
(flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_ctype_code_range(OnigCtype ctype, OnigCodePoint *sb_out,
|
get_ctype_code_range(OnigCtype ctype, OnigCodePoint *sb_out,
|
||||||
const OnigCodePoint* ranges[])
|
const OnigCodePoint* ranges[])
|
||||||
|
@ -317,7 +282,7 @@ OnigEncodingType OnigEncodingUTF8 = {
|
||||||
"UTF-8", /* name */
|
"UTF-8", /* name */
|
||||||
6, /* max byte length */
|
6, /* max byte length */
|
||||||
1, /* min byte length */
|
1, /* min byte length */
|
||||||
is_mbc_newline,
|
onigenc_is_mbc_newline_0x0a,
|
||||||
mbc_to_code,
|
mbc_to_code,
|
||||||
code_to_mbclen,
|
code_to_mbclen,
|
||||||
code_to_mbc,
|
code_to_mbc,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue