mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-14 21:09:05 +08:00
Merge pull request #3257 from RaiKoHoff/Dev_Lexilla
Horizontal mouse-wheel support and update to Oniguruma v6.9.7 (RC1)
This commit is contained in:
commit
474ff5feea
@ -177,18 +177,18 @@
|
||||
<ClCompile Include="oniguruma\src\utf8.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="oniguruma\src\regposerr.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="oniguruma\src\regposix.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\CharacterCategory.cxx">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\CharacterSet.cxx">
|
||||
<Filter>src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="oniguruma\src\regposerr.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="oniguruma\src\regposix.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\ILexer.h">
|
||||
|
||||
2
scintilla/oniguruma/.gitignore
vendored
2
scintilla/oniguruma/.gitignore
vendored
@ -68,7 +68,7 @@ m4/*.m4
|
||||
/sample/bug_fix
|
||||
/sample/regset
|
||||
/sample/scan
|
||||
/sample/each_match
|
||||
/sample/callback_each_match
|
||||
/sample/log*
|
||||
|
||||
/harnesses/utf16*.dict
|
||||
|
||||
@ -1,5 +1,21 @@
|
||||
History
|
||||
|
||||
2021/04/XX: Version 6.9.7
|
||||
2021/03/31: Release Candidate 1 for Version 6.9.7
|
||||
|
||||
2021/03/23: fix Issue 32340, 32345, 32355 in oss-fuzz
|
||||
2021/03/12: fix invalid optimization info for if-pattern (?(cond)...)
|
||||
2021/02/21: NEW API: ONIG_OPTION_CALLBACK_EACH_MATCH
|
||||
2021/02/02: fix Issue 30144 in oss-fuzz: Timeout
|
||||
2021/01/18: NEW API: ONIG_SYNTAX_PYTHON
|
||||
2020/12/20: fix Issue 28795 in oss-fuzz: Timeout
|
||||
2020/12/13: fix Issue 28554 in oss-fuzz: Timeout, check very inefficient patterns at tune_tree(NODE_CALL)
|
||||
2020/12/04: fix Issue 28259 in oss-fuzz: Timeout
|
||||
2020/12/03: fix invalid reduction of nested quantifiers (?:<expr>+?)* and (?:<expr>+?)+
|
||||
2020/12/01: fix Issue 28104 in oss-fuzz: Timeout
|
||||
2020/11/28: NEW API: ONIG_OPTION_IGNORECASE_IS_ASCII
|
||||
2020/11/07: fix Issue 27015 in oss-fuzz: Timeout
|
||||
|
||||
2020/11/05: Version 6.9.6
|
||||
|
||||
2020/11/01: fix Issue 26798 in oss-fuzz: Timeout
|
||||
|
||||
@ -29,16 +29,21 @@ Supported character encodings:
|
||||
* doc/SYNTAX.md: contributed by seanofw
|
||||
|
||||
|
||||
Master branch
|
||||
Notice (from 6.9.6)
|
||||
-------------------
|
||||
When using configure script, if you have the POSIX API enabled in an earlier version (disabled by default in 6.9.5) and you need application binary compatibility with the POSIX API, specify "--enable-binary-compatible-posix-api=yes" instead of "--enable-posix-api=yes". Starting in 6.9.6, "--enable-posix-api=yes" only supports source-level compatibility for 6.9.5 and earlier about POSIX API. (Issue #210)
|
||||
|
||||
|
||||
Version 6.9.7
|
||||
-------------
|
||||
* NEW API: ONIG_OPTION_CALLBACK_EACH_MATCH
|
||||
* NEW API: ONIG_OPTION_IGNORECASE_IS_ASCII
|
||||
* NEW API: ONIG_SYNTAX_PYTHON
|
||||
* Fixed some problems found by OSS-Fuzz
|
||||
|
||||
|
||||
Version 6.9.6
|
||||
-------------
|
||||
* When using configure script, if you have the POSIX API enabled in an earlier version (disabled by default in 6.9.5) and you need application binary compatibility with the POSIX API, specify "--enable-binary-compatible-posix-api=yes" instead of "--enable-posix-api=yes". Starting in 6.9.6, "--enable-posix-api=yes" only supports source-level compatibility for 6.9.5 and earlier about POSIX API. (Issue #210)
|
||||
* NEW: configure option --enable-binary-compatible-posix-api=[yes/no]
|
||||
* NEW API: Limiting the maximum number of calls of subexp-call
|
||||
* NEW API: ONIG_OPTION_NOT_BEGIN_STRING / NOT_END_STRING / NOT_BEGIN_POSITION
|
||||
@ -108,32 +113,6 @@ Version 6.9.0
|
||||
* NEW: add Emoji properties
|
||||
|
||||
|
||||
Version 6.8.2
|
||||
-------------
|
||||
|
||||
* Fix: #80 UChar in header causes issue
|
||||
* NEW API: onig_set_callout_user_data_of_match_param() (* omission in 6.8.0)
|
||||
* add doc/CALLOUTS.API and doc/CALLOUTS.API.ja
|
||||
|
||||
|
||||
Version 6.8.1
|
||||
-------------
|
||||
|
||||
* Update shared library version to 5.0.0 for API incompatible changes from 6.7.1
|
||||
|
||||
|
||||
Version 6.8.0
|
||||
-------------
|
||||
|
||||
* Retry-limit-in-match function enabled by default
|
||||
* NEW: configure option --enable-posix-api=no (* enabled by default)
|
||||
* NEW API: onig_search_with_param(), onig_match_with_param()
|
||||
* NEW: Callouts of contents (?{...contents...}) (?{...}\[tag]\[X<>]) (?{{...}})
|
||||
* NEW: Callouts of name (*name) (*name\[tag]{args...})
|
||||
* NEW: Builtin callouts (*FAIL) (*MISMATCH) (*ERROR{n}) (*COUNT) (*MAX{n}) etc..
|
||||
* Examples of Callouts program: [callout.c](sample/callout.c), [count.c](sample/count.c), [echo.c](sample/echo.c)
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
@ -174,18 +153,17 @@ Install
|
||||
|
||||
### Case 3: Windows 64/32bit platform (Visual Studio)
|
||||
|
||||
Execute make_win.bat
|
||||
* build library
|
||||
|
||||
.\make_win.bat
|
||||
|
||||
onig_s.lib: static link library
|
||||
onig.dll: dynamic link library
|
||||
|
||||
* test (ASCII/Shift_JIS)
|
||||
* make test programs
|
||||
|
||||
1. cd src
|
||||
2. copy ..\windows\testc.c .
|
||||
3. nmake -f Makefile.windows ctest
|
||||
.\make_win.bat all-test
|
||||
|
||||
(I have checked by Visual Studio Community 2015)
|
||||
|
||||
Alternatively, you can build and install oniguruma using [vcpkg](https://github.com/microsoft/vcpkg/) dependency manager:
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Callouts API Version 6.8.2 2018/06/08
|
||||
Callouts API Version 6.9.7 2021/03/21
|
||||
|
||||
#include <oniguruma.h>
|
||||
|
||||
@ -273,48 +273,51 @@ Callouts API Version 6.8.2 2018/06/08
|
||||
Returns the callout data value/type for a callout slot indicated by
|
||||
callout_num/slot.
|
||||
|
||||
normal return: ONIG_NORMAL
|
||||
1: not yet set (type is ONIG_TYPE_VOID)
|
||||
< 0: error code
|
||||
ONIG_NORMAL: normal return
|
||||
ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID
|
||||
< 0: error code
|
||||
|
||||
|
||||
# int onig_get_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val)
|
||||
|
||||
Returns self callout data value/type.
|
||||
|
||||
normal return: ONIG_NORMAL
|
||||
1: not yet set (type is ONIG_TYPE_VOID)
|
||||
< 0: error code
|
||||
ONIG_NORMAL: normal return
|
||||
ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID
|
||||
< 0: error code
|
||||
|
||||
|
||||
# int onig_set_callout_data_by_callout_args(OnigCalloutArgs* args, int callout_num, int slot, OnigType type, OnigValue* val)
|
||||
|
||||
Set the callout data value/type for a callout slot indicated by callout_num/slot.
|
||||
|
||||
normal return: ONIG_NORMAL
|
||||
< 0: error code
|
||||
ONIG_NORMAL: normal return
|
||||
< 0: error code
|
||||
|
||||
|
||||
# int onig_set_callout_data_by_callout_args_self(OnigCalloutArgs* args, int slot, OnigType type, OnigValue* val)
|
||||
|
||||
Set self callout data value/type for a callout slot indicated by slot.
|
||||
|
||||
normal return: ONIG_NORMAL
|
||||
< 0: error code
|
||||
ONIG_NORMAL: normal return
|
||||
< 0: error code
|
||||
|
||||
|
||||
# int onig_get_callout_data_by_callout_args_self_dont_clear_old(OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val)
|
||||
|
||||
This function is almost same as onig_get_callout_data_by_callout_args_self().
|
||||
But this function doesn't clear values which set in previous failed match process.
|
||||
Other onig_get_callout_data_xxxx() functions clear all values which set
|
||||
in previous failed match process.
|
||||
But this function does not clear the value set in the collation position before the current position. (dont_clear_old)
|
||||
The other onig_get_callout_data_xxxx() function clears the value set in the collation process of the previous position.
|
||||
|
||||
For example, Builtin callout (*TOTAL_COUNT) is implemented by using this
|
||||
function for accumulate count of all of match processes in a search process.
|
||||
Builtin callout (*COUNT) returns count in last success match process only,
|
||||
because it doesn't use this function.
|
||||
|
||||
ONIG_NORMAL: normal return
|
||||
ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID
|
||||
< 0: error code
|
||||
|
||||
|
||||
(8) Callout data (used in applications)
|
||||
|
||||
@ -323,34 +326,34 @@ Callouts API Version 6.8.2 2018/06/08
|
||||
Returns the callout data value/type for a callout slot indicated by
|
||||
callout_num/slot.
|
||||
|
||||
normal return: ONIG_NORMAL
|
||||
1: not yet set (type is ONIG_TYPE_VOID)
|
||||
< 0: error code
|
||||
ONIG_NORMAL: normal return
|
||||
ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID
|
||||
< 0: error code
|
||||
|
||||
|
||||
# int onig_get_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType* type, OnigValue* val)
|
||||
|
||||
Returns the callout data value/type for a callout slot indicated by tag/slot.
|
||||
|
||||
normal return: ONIG_NORMAL
|
||||
1: not yet set (type is ONIG_TYPE_VOID)
|
||||
< 0: error code
|
||||
ONIG_NORMAL: normal return
|
||||
ONIG_VALUE_IS_NOT_SET: value is not set / type is ONIG_TYPE_VOID
|
||||
< 0: error code
|
||||
|
||||
|
||||
# int onig_set_callout_data(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType type, OnigValue* val)
|
||||
|
||||
Set the callout data value/type for a callout slot indicated by callout_num/slot.
|
||||
|
||||
normal return: ONIG_NORMAL
|
||||
< 0: error code
|
||||
ONIG_NORMAL: normal return
|
||||
< 0: error code
|
||||
|
||||
|
||||
# int onig_set_callout_data_by_tag(OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType type, OnigValue* val)
|
||||
|
||||
Set the callout data value/type for a callout slot indicated by tag/slot.
|
||||
|
||||
normal return: ONIG_NORMAL
|
||||
< 0: error code
|
||||
ONIG_NORMAL: normal return
|
||||
< 0: error code
|
||||
|
||||
|
||||
# int onig_get_callout_data_dont_clear_old(OnigRegex reg, OnigMatchParam* mp, int callout_num, int slot, OnigType* type, OnigValue* val)
|
||||
@ -359,6 +362,15 @@ Callouts API Version 6.8.2 2018/06/08
|
||||
It will be abolished.
|
||||
|
||||
|
||||
# int onig_get_callout_data_by_tag_dont_clear_old(regex_t* reg, OnigMatchParam* mp, const UChar* tag, const UChar* tag_end, int slot, OnigType* type, OnigValue* val)
|
||||
|
||||
Returns the callout data value/type for a callout slot indicated by tag/slot.
|
||||
This function does not clear the value set in the collation position before the current position. (dont_clear_old)
|
||||
|
||||
ONIG_NORMAL: ????
|
||||
ONIG_VALUE_IS_NOT_SET: ?????? / ??VOID
|
||||
< 0: ??????
|
||||
|
||||
|
||||
(9) Miscellaneous functions
|
||||
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
|
||||
product_name = oniguruma
|
||||
|
||||
TEST_DIR = $(ONIG_DIR)/../test
|
||||
WIN_DIR = $(ONIG_DIR)/../windows
|
||||
TEST_DIR = $(ONIG_DIR)/../test
|
||||
SAMPLE_DIR = $(ONIG_DIR)/../sample
|
||||
WIN_DIR = $(ONIG_DIR)/../windows
|
||||
|
||||
CPPFLAGS =
|
||||
CFLAGS = -O2 -nologo /W3
|
||||
@ -15,6 +16,8 @@ ARDLL = cl
|
||||
ARDLL_FLAGS = -nologo -LD $(LINKFLAGS) -dll
|
||||
LINKFLAGS = -link -incremental:no -pdb:none
|
||||
|
||||
SAMPLE_CFLAGS = $(CFLAGS) /I$(ONIG_DIR)
|
||||
|
||||
INSTALL = install -c
|
||||
CP = copy
|
||||
CC = cl
|
||||
@ -89,11 +92,6 @@ makeargs = $(MFLAGS) CPPFLAGS='$(CPPFLAGS)' CFLAGS='$(CFLAGS)' CC='$(CC)'
|
||||
# targets
|
||||
default: all
|
||||
|
||||
setup:
|
||||
$(CP) ..\win32\config.h config.h
|
||||
$(CP) ..\win32\testc.c testc.c
|
||||
|
||||
|
||||
all: $(libname) $(dllname)
|
||||
|
||||
$(libname): $(libobjs) $(encobjs)
|
||||
@ -155,7 +153,7 @@ $(BUILD_DIR)/unicode_fold1_key.obj: $(ONIG_DIR)/unicode_fold1_key.c $(ONIG_DIR)/
|
||||
$(BUILD_DIR)/unicode_fold2_key.obj: $(ONIG_DIR)/unicode_fold2_key.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h
|
||||
$(BUILD_DIR)/unicode_fold3_key.obj: $(ONIG_DIR)/unicode_fold3_key.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h
|
||||
|
||||
all-test: test_syntax test_regset test_utf8 testc testp testu
|
||||
all-test: test_syntax test_regset test_utf8 test_options test_back testc testp testu
|
||||
|
||||
test_syntax: $(TEST_DIR)/test_syntax.c $(libname)
|
||||
$(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /utf-8 $(TEST_DIR)/test_syntax.c $(libname)
|
||||
@ -166,6 +164,12 @@ test_regset: $(TEST_DIR)/test_regset.c $(libname)
|
||||
test_utf8: $(TEST_DIR)/test_utf8.c $(libname)
|
||||
$(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /utf-8 $(TEST_DIR)/test_utf8.c $(libname)
|
||||
|
||||
test_options: $(TEST_DIR)/test_options.c $(libname)
|
||||
$(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /utf-8 $(TEST_DIR)/test_options.c $(libname)
|
||||
|
||||
test_back: $(TEST_DIR)/test_back.c $(libname)
|
||||
$(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern /utf-8 $(TEST_DIR)/test_back.c $(libname)
|
||||
|
||||
testc: $(WIN_DIR)/testc.c $(libname)
|
||||
$(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern $(WIN_DIR)/testc.c $(libname)
|
||||
|
||||
@ -176,14 +180,17 @@ testu: $(TEST_DIR)/testu.c $(libname)
|
||||
$(CC) -nologo /Fe:$@ /I. /I$(ONIG_DIR) /DONIG_EXTERN=extern $(TEST_DIR)/testu.c $(libname)
|
||||
|
||||
clean:
|
||||
del $(BUILD_DIR)\*.obj $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.exp $(BUILD_DIR)\*.dll $(BUILD_DIR)\test_regset.exe $(BUILD_DIR)\test_syntax.exe $(BUILD_DIR)\test_utf8.exe $(BUILD_DIR)\testp.exe $(BUILD_DIR)\testc.exe $(BUILD_DIR)\testu.exe
|
||||
del $(BUILD_DIR)\*.obj $(BUILD_DIR)\*.lib $(BUILD_DIR)\*.exp $(BUILD_DIR)\*.dll $(BUILD_DIR)\test_regset.exe $(BUILD_DIR)\test_syntax.exe $(BUILD_DIR)\test_utf8.exe $(BUILD_DIR)\test_options.exe $(BUILD_DIR)\test_back.exe $(BUILD_DIR)\testp.exe $(BUILD_DIR)\testc.exe $(BUILD_DIR)\testu.exe
|
||||
|
||||
|
||||
samples: all
|
||||
$(CC) $(CFLAGS) -I. /Fe:simple $(ONIG_DIR)\sample\simple.c $(dlllib)
|
||||
$(CC) $(CFLAGS) -I. /Fe:posix $(ONIG_DIR)\sample\posix.c $(dlllib)
|
||||
$(CC) $(CFLAGS) -I. /Fe:names $(ONIG_DIR)\sample\names.c $(dlllib)
|
||||
$(CC) $(CFLAGS) -I. /Fe:listcap $(ONIG_DIR)\sample\listcap.c $(dlllib)
|
||||
$(CC) $(CFLAGS) -I. /Fe:sql $(ONIG_DIR)\sample\sql.c $(dlllib)
|
||||
$(CC) $(CFLAGS) -I. /Fe:encode $(ONIG_DIR)\sample\encode.c $(dlllib)
|
||||
$(CC) $(CFLAGS) -I. /Fe:syntax $(ONIG_DIR)\sample\syntax.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:simple $(SAMPLE_DIR)\simple.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:posix $(SAMPLE_DIR)\posix.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:names $(SAMPLE_DIR)\names.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:listcap $(SAMPLE_DIR)\listcap.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:sql $(SAMPLE_DIR)\sql.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:encode $(SAMPLE_DIR)\encode.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:syntax $(SAMPLE_DIR)\syntax.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:count $(SAMPLE_DIR)\count.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:regset $(SAMPLE_DIR)\regset.c $(dlllib)
|
||||
$(CC) $(SAMPLE_CFLAGS) /Fe:callback_each_match $(SAMPLE_DIR)\callback_each_match.c $(dlllib)
|
||||
|
||||
@ -36,9 +36,9 @@ extern "C" {
|
||||
#define ONIGURUMA
|
||||
#define ONIGURUMA_VERSION_MAJOR 6
|
||||
#define ONIGURUMA_VERSION_MINOR 9
|
||||
#define ONIGURUMA_VERSION_TEENY 6
|
||||
#define ONIGURUMA_VERSION_TEENY 7
|
||||
|
||||
#define ONIGURUMA_VERSION_INT 60906
|
||||
#define ONIGURUMA_VERSION_INT 60907
|
||||
|
||||
#ifndef P_
|
||||
#if defined(__STDC__) || defined(_WIN32)
|
||||
@ -569,8 +569,10 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax;
|
||||
|
||||
/* error codes */
|
||||
#define ONIG_IS_PATTERN_ERROR(ecode) ((ecode) <= -100 && (ecode) > -1000)
|
||||
|
||||
/* normal return */
|
||||
#define ONIG_NORMAL 0
|
||||
#define ONIG_VALUE_IS_NOT_SET 1
|
||||
#define ONIG_MISMATCH -1
|
||||
#define ONIG_NO_SUPPORT_CONFIG -2
|
||||
#define ONIG_ABORT -3
|
||||
@ -1012,6 +1014,8 @@ ONIG_EXTERN
|
||||
int onig_get_callout_data_by_tag P_((OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType* type, OnigValue* val));
|
||||
ONIG_EXTERN
|
||||
int onig_set_callout_data_by_tag P_((OnigRegex reg, OnigMatchParam* mp, const OnigUChar* tag, const OnigUChar* tag_end, int slot, OnigType type, OnigValue* val));
|
||||
ONIG_EXTERN
|
||||
int onig_get_callout_data_by_tag_dont_clear_old P_((regex_t* reg, OnigMatchParam* mp, const UChar* tag, const UChar* tag_end, int slot, OnigType* type, OnigValue* val));
|
||||
|
||||
/* used in callout functions */
|
||||
ONIG_EXTERN
|
||||
|
||||
@ -662,6 +662,8 @@ mmcl_alt_merge(MinMaxCharLen* to, MinMaxCharLen* alt)
|
||||
if (to->max < alt->max) to->max = alt->max;
|
||||
}
|
||||
|
||||
#ifndef ONIG_DONT_OPTIMIZE
|
||||
|
||||
static int
|
||||
mml_is_equal(MinMaxLen* a, MinMaxLen* b)
|
||||
{
|
||||
@ -702,6 +704,8 @@ mml_alt_merge(MinMaxLen* to, MinMaxLen* alt)
|
||||
if (to->max < alt->max) to->max = alt->max;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* fixed size pattern node only */
|
||||
static int
|
||||
node_char_len1(Node* node, regex_t* reg, MinMaxCharLen* ci, ParseEnv* env,
|
||||
@ -3739,141 +3743,6 @@ node_min_byte_len(Node* node, ParseEnv* env)
|
||||
return len;
|
||||
}
|
||||
|
||||
static OnigLen
|
||||
node_max_byte_len(Node* node, ParseEnv* env)
|
||||
{
|
||||
OnigLen len;
|
||||
OnigLen tmax;
|
||||
|
||||
len = 0;
|
||||
switch (NODE_TYPE(node)) {
|
||||
case NODE_LIST:
|
||||
do {
|
||||
tmax = node_max_byte_len(NODE_CAR(node), env);
|
||||
len = distance_add(len, tmax);
|
||||
} while (IS_NOT_NULL(node = NODE_CDR(node)));
|
||||
break;
|
||||
|
||||
case NODE_ALT:
|
||||
do {
|
||||
tmax = node_max_byte_len(NODE_CAR(node), env);
|
||||
if (len < tmax) len = tmax;
|
||||
} while (IS_NOT_NULL(node = NODE_CDR(node)));
|
||||
break;
|
||||
|
||||
case NODE_STRING:
|
||||
{
|
||||
StrNode* sn = STR_(node);
|
||||
len = (OnigLen )(sn->end - sn->s);
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_CTYPE:
|
||||
case NODE_CCLASS:
|
||||
len = ONIGENC_MBC_MAXLEN_DIST(env->enc);
|
||||
break;
|
||||
|
||||
case NODE_BACKREF:
|
||||
if (! NODE_IS_CHECKER(node)) {
|
||||
int i;
|
||||
int* backs;
|
||||
MemEnv* mem_env = PARSEENV_MEMENV(env);
|
||||
BackRefNode* br = BACKREF_(node);
|
||||
if (NODE_IS_RECURSION(node)) {
|
||||
#ifdef USE_BACKREF_WITH_LEVEL
|
||||
if (NODE_IS_NEST_LEVEL(node)) {
|
||||
len = INFINITE_LEN;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
backs = BACKREFS_P(br);
|
||||
for (i = 0; i < br->back_num; i++) {
|
||||
tmax = node_max_byte_len(mem_env[backs[i]].mem_node, env);
|
||||
if (len < tmax) len = tmax;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef USE_CALL
|
||||
case NODE_CALL:
|
||||
if (! NODE_IS_RECURSION(node))
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
else
|
||||
len = INFINITE_LEN;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case NODE_QUANT:
|
||||
{
|
||||
QuantNode* qn = QUANT_(node);
|
||||
|
||||
if (qn->upper != 0) {
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
if (len != 0) {
|
||||
if (! IS_INFINITE_REPEAT(qn->upper))
|
||||
len = distance_multiply(len, qn->upper);
|
||||
else
|
||||
len = INFINITE_LEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_BAG:
|
||||
{
|
||||
BagNode* en = BAG_(node);
|
||||
switch (en->type) {
|
||||
case BAG_MEMORY:
|
||||
if (NODE_IS_FIXED_MAX(node))
|
||||
len = en->max_len;
|
||||
else {
|
||||
if (NODE_IS_MARK1(node))
|
||||
len = INFINITE_LEN;
|
||||
else {
|
||||
NODE_STATUS_ADD(node, MARK1);
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
NODE_STATUS_REMOVE(node, MARK1);
|
||||
|
||||
en->max_len = len;
|
||||
NODE_STATUS_ADD(node, FIXED_MAX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BAG_OPTION:
|
||||
case BAG_STOP_BACKTRACK:
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
break;
|
||||
case BAG_IF_ELSE:
|
||||
{
|
||||
OnigLen tlen, elen;
|
||||
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
if (IS_NOT_NULL(en->te.Then)) {
|
||||
tlen = node_max_byte_len(en->te.Then, env);
|
||||
len = distance_add(len, tlen);
|
||||
}
|
||||
if (IS_NOT_NULL(en->te.Else))
|
||||
elen = node_max_byte_len(en->te.Else, env);
|
||||
else elen = 0;
|
||||
|
||||
if (elen > len) len = elen;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_ANCHOR:
|
||||
case NODE_GIMMICK:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
static int
|
||||
check_backrefs(Node* node, ParseEnv* env)
|
||||
{
|
||||
@ -5962,6 +5831,7 @@ tune_tree(Node* node, regex_t* reg, int state, ParseEnv* env)
|
||||
return r;
|
||||
}
|
||||
|
||||
#ifndef ONIG_DONT_OPTIMIZE
|
||||
static int
|
||||
set_sunday_quick_search_or_bmh_skip_table(regex_t* reg, int case_expand,
|
||||
UChar* s, UChar* end,
|
||||
@ -6031,6 +5901,7 @@ set_sunday_quick_search_or_bmh_skip_table(regex_t* reg, int case_expand,
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define OPT_EXACT_MAXLEN 24
|
||||
@ -6076,6 +5947,8 @@ typedef struct {
|
||||
} OptNode;
|
||||
|
||||
|
||||
#ifndef ONIG_DONT_OPTIMIZE
|
||||
|
||||
static int
|
||||
map_position_value(OnigEncoding enc, int i)
|
||||
{
|
||||
@ -6564,6 +6437,140 @@ alt_merge_node_opt_info(OptNode* to, OptNode* add, OptEnv* env)
|
||||
mml_alt_merge(&to->len, &add->len);
|
||||
}
|
||||
|
||||
static OnigLen
|
||||
node_max_byte_len(Node* node, ParseEnv* env)
|
||||
{
|
||||
OnigLen len;
|
||||
OnigLen tmax;
|
||||
|
||||
len = 0;
|
||||
switch (NODE_TYPE(node)) {
|
||||
case NODE_LIST:
|
||||
do {
|
||||
tmax = node_max_byte_len(NODE_CAR(node), env);
|
||||
len = distance_add(len, tmax);
|
||||
} while (IS_NOT_NULL(node = NODE_CDR(node)));
|
||||
break;
|
||||
|
||||
case NODE_ALT:
|
||||
do {
|
||||
tmax = node_max_byte_len(NODE_CAR(node), env);
|
||||
if (len < tmax) len = tmax;
|
||||
} while (IS_NOT_NULL(node = NODE_CDR(node)));
|
||||
break;
|
||||
|
||||
case NODE_STRING:
|
||||
{
|
||||
StrNode* sn = STR_(node);
|
||||
len = (OnigLen )(sn->end - sn->s);
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_CTYPE:
|
||||
case NODE_CCLASS:
|
||||
len = ONIGENC_MBC_MAXLEN_DIST(env->enc);
|
||||
break;
|
||||
|
||||
case NODE_BACKREF:
|
||||
if (! NODE_IS_CHECKER(node)) {
|
||||
int i;
|
||||
int* backs;
|
||||
MemEnv* mem_env = PARSEENV_MEMENV(env);
|
||||
BackRefNode* br = BACKREF_(node);
|
||||
if (NODE_IS_RECURSION(node)) {
|
||||
#ifdef USE_BACKREF_WITH_LEVEL
|
||||
if (NODE_IS_NEST_LEVEL(node)) {
|
||||
len = INFINITE_LEN;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
backs = BACKREFS_P(br);
|
||||
for (i = 0; i < br->back_num; i++) {
|
||||
tmax = node_max_byte_len(mem_env[backs[i]].mem_node, env);
|
||||
if (len < tmax) len = tmax;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef USE_CALL
|
||||
case NODE_CALL:
|
||||
if (! NODE_IS_RECURSION(node))
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
else
|
||||
len = INFINITE_LEN;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case NODE_QUANT:
|
||||
{
|
||||
QuantNode* qn = QUANT_(node);
|
||||
|
||||
if (qn->upper != 0) {
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
if (len != 0) {
|
||||
if (! IS_INFINITE_REPEAT(qn->upper))
|
||||
len = distance_multiply(len, qn->upper);
|
||||
else
|
||||
len = INFINITE_LEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_BAG:
|
||||
{
|
||||
BagNode* en = BAG_(node);
|
||||
switch (en->type) {
|
||||
case BAG_MEMORY:
|
||||
if (NODE_IS_FIXED_MAX(node))
|
||||
len = en->max_len;
|
||||
else {
|
||||
if (NODE_IS_MARK1(node))
|
||||
len = INFINITE_LEN;
|
||||
else {
|
||||
NODE_STATUS_ADD(node, MARK1);
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
NODE_STATUS_REMOVE(node, MARK1);
|
||||
|
||||
en->max_len = len;
|
||||
NODE_STATUS_ADD(node, FIXED_MAX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BAG_OPTION:
|
||||
case BAG_STOP_BACKTRACK:
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
break;
|
||||
case BAG_IF_ELSE:
|
||||
{
|
||||
OnigLen tlen, elen;
|
||||
|
||||
len = node_max_byte_len(NODE_BODY(node), env);
|
||||
if (IS_NOT_NULL(en->te.Then)) {
|
||||
tlen = node_max_byte_len(en->te.Then, env);
|
||||
len = distance_add(len, tlen);
|
||||
}
|
||||
if (IS_NOT_NULL(en->te.Else))
|
||||
elen = node_max_byte_len(en->te.Else, env);
|
||||
else elen = 0;
|
||||
|
||||
if (elen > len) len = elen;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NODE_ANCHOR:
|
||||
case NODE_GIMMICK:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
#define MAX_NODE_OPT_INFO_REF_COUNT 5
|
||||
|
||||
@ -6846,22 +6853,22 @@ optimize_nodes(Node* node, OptNode* opt, OptEnv* env)
|
||||
{
|
||||
OptEnv nenv;
|
||||
|
||||
copy_opt_env(&nenv, env);
|
||||
r = optimize_nodes(NODE_BAG_BODY(en), &xo, &nenv);
|
||||
if (r == 0) {
|
||||
mml_add(&nenv.mm, &xo.len);
|
||||
concat_left_node_opt_info(enc, opt, &xo);
|
||||
if (IS_NOT_NULL(en->te.Then)) {
|
||||
r = optimize_nodes(en->te.Then, &xo, &nenv);
|
||||
if (r == 0) {
|
||||
concat_left_node_opt_info(enc, opt, &xo);
|
||||
if (IS_NOT_NULL(en->te.Else)) {
|
||||
copy_opt_env(&nenv, env);
|
||||
r = optimize_nodes(NODE_BAG_BODY(en), &xo, &nenv);
|
||||
if (r == 0) {
|
||||
mml_add(&nenv.mm, &xo.len);
|
||||
concat_left_node_opt_info(enc, opt, &xo);
|
||||
if (IS_NOT_NULL(en->te.Then)) {
|
||||
r = optimize_nodes(en->te.Then, &xo, &nenv);
|
||||
if (r == 0) {
|
||||
concat_left_node_opt_info(enc, opt, &xo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_NOT_NULL(en->te.Else)) {
|
||||
r = optimize_nodes(en->te.Else, &xo, env);
|
||||
if (r == 0)
|
||||
alt_merge_node_opt_info(opt, &xo, env);
|
||||
r = optimize_nodes(en->te.Else, &xo, env);
|
||||
if (r == 0)
|
||||
alt_merge_node_opt_info(opt, &xo, env);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7009,6 +7016,7 @@ set_optimize_info_from_tree(Node* node, regex_t* reg, ParseEnv* scan_env)
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
#endif /* ONIG_DONT_OPTIMIZE */
|
||||
|
||||
static void
|
||||
clear_optimize_info(regex_t* reg)
|
||||
@ -7090,6 +7098,8 @@ print_options(FILE* fp, OnigOptionType o)
|
||||
|
||||
#if defined(ONIG_DEBUG_COMPILE) || defined(ONIG_DEBUG_MATCH)
|
||||
|
||||
#ifndef ONIG_DONT_OPTIMIZE
|
||||
|
||||
static void
|
||||
print_distance_range(FILE* f, OnigLen a, OnigLen b)
|
||||
{
|
||||
@ -7212,7 +7222,8 @@ print_optimize_info(FILE* f, regex_t* reg)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* ONIG_DONT_OPTIMIZE */
|
||||
#endif /* defined(ONIG_DEBUG_COMPILE) || defined(ONIG_DEBUG_MATCH) */
|
||||
|
||||
|
||||
extern RegexExt*
|
||||
|
||||
@ -61,6 +61,13 @@ const OnigUChar* const _CRLF = "\r\n\0";
|
||||
(MEM_STATUS_AT((reg)->push_mem_end, (idx)) != 0 ? \
|
||||
STACK_AT(mem_end_stk[idx].i)->u.mem.pstr : mem_end_stk[idx].s)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define DIST_CAST(d) (size_t )(d)
|
||||
#else
|
||||
#define DIST_CAST(d) (d)
|
||||
#endif
|
||||
|
||||
|
||||
static int forward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* start, UChar* range, UChar** low, UChar** high);
|
||||
|
||||
static int
|
||||
@ -83,11 +90,12 @@ struct OnigMatchParamStruct {
|
||||
unsigned long retry_limit_in_match;
|
||||
unsigned long retry_limit_in_search;
|
||||
#endif
|
||||
|
||||
void* callout_user_data; /* used in callback each match */
|
||||
#ifdef USE_CALLOUT
|
||||
OnigCalloutFunc progress_callout_of_contents;
|
||||
OnigCalloutFunc retraction_callout_of_contents;
|
||||
int match_at_call_counter;
|
||||
void* callout_user_data;
|
||||
CalloutData* callout_data;
|
||||
int callout_data_alloc_num;
|
||||
#endif
|
||||
@ -150,12 +158,8 @@ onig_set_retraction_callout_of_match_param(OnigMatchParam* param, OnigCalloutFun
|
||||
extern int
|
||||
onig_set_callout_user_data_of_match_param(OnigMatchParam* param, void* user_data)
|
||||
{
|
||||
#ifdef USE_CALLOUT
|
||||
param->callout_user_data = user_data;
|
||||
return ONIG_NORMAL;
|
||||
#else
|
||||
return ONIG_NO_SUPPORT_CONFIG;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1477,11 +1481,12 @@ onig_initialize_match_param(OnigMatchParam* mp)
|
||||
mp->retry_limit_in_search = RetryLimitInSearch;
|
||||
#endif
|
||||
|
||||
mp->callout_user_data = 0;
|
||||
|
||||
#ifdef USE_CALLOUT
|
||||
mp->progress_callout_of_contents = DefaultProgressCallout;
|
||||
mp->retraction_callout_of_contents = DefaultRetractionCallout;
|
||||
mp->match_at_call_counter = 0;
|
||||
mp->callout_user_data = 0;
|
||||
mp->callout_data = 0;
|
||||
mp->callout_data_alloc_num = 0;
|
||||
#endif
|
||||
@ -1557,13 +1562,26 @@ onig_get_callout_data_dont_clear_old(regex_t* reg, OnigMatchParam* mp,
|
||||
t = d->slot[slot].type;
|
||||
if (IS_NOT_NULL(type)) *type = t;
|
||||
if (IS_NOT_NULL(val)) *val = d->slot[slot].val;
|
||||
return (t == ONIG_TYPE_VOID ? 1 : ONIG_NORMAL);
|
||||
return (t == ONIG_TYPE_VOID ? ONIG_VALUE_IS_NOT_SET : ONIG_NORMAL);
|
||||
}
|
||||
|
||||
extern int
|
||||
onig_get_callout_data_by_callout_args_self_dont_clear_old(OnigCalloutArgs* args,
|
||||
int slot, OnigType* type,
|
||||
OnigValue* val)
|
||||
onig_get_callout_data_by_tag_dont_clear_old(regex_t* reg,
|
||||
OnigMatchParam* mp, const UChar* tag, const UChar* tag_end, int slot,
|
||||
OnigType* type, OnigValue* val)
|
||||
{
|
||||
int num;
|
||||
|
||||
num = onig_get_callout_num_by_tag(reg, tag, tag_end);
|
||||
if (num < 0) return num;
|
||||
if (num == 0) return ONIGERR_INVALID_CALLOUT_TAG_NAME;
|
||||
|
||||
return onig_get_callout_data_dont_clear_old(reg, mp, num, slot, type, val);
|
||||
}
|
||||
|
||||
extern int
|
||||
onig_get_callout_data_by_callout_args_self_dont_clear_old(
|
||||
OnigCalloutArgs* args, int slot, OnigType* type, OnigValue* val)
|
||||
{
|
||||
return onig_get_callout_data_dont_clear_old(args->regex, args->msa->mp,
|
||||
args->num, slot, type, val);
|
||||
@ -1588,7 +1606,7 @@ onig_get_callout_data(regex_t* reg, OnigMatchParam* mp,
|
||||
t = d->slot[slot].type;
|
||||
if (IS_NOT_NULL(type)) *type = t;
|
||||
if (IS_NOT_NULL(val)) *val = d->slot[slot].val;
|
||||
return (t == ONIG_TYPE_VOID ? 1 : ONIG_NORMAL);
|
||||
return (t == ONIG_TYPE_VOID ? ONIG_VALUE_IS_NOT_SET : ONIG_NORMAL);
|
||||
}
|
||||
|
||||
extern int
|
||||
@ -4495,7 +4513,7 @@ regset_search_body_position_lead(OnigRegSet* set,
|
||||
sr[i].state = SRS_DEAD;
|
||||
if (reg->optimize != OPTIMIZE_NONE) {
|
||||
if (reg->dist_max != INFINITE_LEN) {
|
||||
if (end - range > reg->dist_max)
|
||||
if (DIST_CAST(end - range) > reg->dist_max)
|
||||
sch_range = (UChar* )range + reg->dist_max;
|
||||
else
|
||||
sch_range = (UChar* )end;
|
||||
@ -5158,7 +5176,7 @@ forward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* start,
|
||||
|
||||
p = start;
|
||||
if (reg->dist_min != 0) {
|
||||
if (end - p <= reg->dist_min)
|
||||
if (DIST_CAST(end - p) <= reg->dist_min)
|
||||
return 0; /* fail */
|
||||
|
||||
if (ONIGENC_IS_SINGLEBYTE(reg->enc)) {
|
||||
@ -5191,7 +5209,7 @@ forward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* start,
|
||||
}
|
||||
|
||||
if (p && p < range) {
|
||||
if (p - start < reg->dist_min) {
|
||||
if (DIST_CAST(p - start) < reg->dist_min) {
|
||||
retry_gate:
|
||||
pprev = p;
|
||||
p += enclen(reg->enc, p);
|
||||
@ -5243,7 +5261,7 @@ forward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* start,
|
||||
}
|
||||
else {
|
||||
if (reg->dist_max != INFINITE_LEN) {
|
||||
if (p - str < reg->dist_max) {
|
||||
if (DIST_CAST(p - str) < reg->dist_max) {
|
||||
*low = (UChar* )str;
|
||||
}
|
||||
else {
|
||||
@ -5254,7 +5272,7 @@ forward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* start,
|
||||
}
|
||||
}
|
||||
/* no needs to adjust *high, *high is used as range check only */
|
||||
if (p - str < reg->dist_min)
|
||||
if (DIST_CAST(p - str) < reg->dist_min)
|
||||
*high = (UChar* )str;
|
||||
else
|
||||
*high = p - reg->dist_min;
|
||||
@ -5347,13 +5365,13 @@ backward_search(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
|
||||
}
|
||||
|
||||
if (reg->dist_max != INFINITE_LEN) {
|
||||
if (p - str < reg->dist_max)
|
||||
if (DIST_CAST(p - str) < reg->dist_max)
|
||||
*low = (UChar* )str;
|
||||
else
|
||||
*low = p - reg->dist_max;
|
||||
|
||||
if (reg->dist_min != 0) {
|
||||
if (p - str < reg->dist_min)
|
||||
if (DIST_CAST(p - str) < reg->dist_min)
|
||||
*high = (UChar* )str;
|
||||
else
|
||||
*high = p - reg->dist_min;
|
||||
@ -5497,13 +5515,13 @@ search_in_range(regex_t* reg, const UChar* str, const UChar* end,
|
||||
|
||||
if (range > start) {
|
||||
if (reg->anc_dist_max != INFINITE_LEN &&
|
||||
min_semi_end - start > reg->anc_dist_max) {
|
||||
DIST_CAST(min_semi_end - start) > reg->anc_dist_max) {
|
||||
start = min_semi_end - reg->anc_dist_max;
|
||||
if (start < end)
|
||||
start = onigenc_get_right_adjust_char_head(reg->enc, str, start);
|
||||
}
|
||||
if (max_semi_end - (range - 1) < reg->anc_dist_min) {
|
||||
if (max_semi_end - str + 1 < reg->anc_dist_min)
|
||||
if (DIST_CAST(max_semi_end - (range - 1)) < reg->anc_dist_min) {
|
||||
if (DIST_CAST(max_semi_end - str + 1) < reg->anc_dist_min)
|
||||
goto mismatch_no_msa;
|
||||
else
|
||||
range = max_semi_end - reg->anc_dist_min + 1;
|
||||
@ -5515,11 +5533,11 @@ search_in_range(regex_t* reg, const UChar* str, const UChar* end,
|
||||
}
|
||||
else {
|
||||
if (reg->anc_dist_max != INFINITE_LEN &&
|
||||
min_semi_end - range > reg->anc_dist_max) {
|
||||
DIST_CAST(min_semi_end - range) > reg->anc_dist_max) {
|
||||
range = min_semi_end - reg->anc_dist_max;
|
||||
}
|
||||
if (max_semi_end - start < reg->anc_dist_min) {
|
||||
if (max_semi_end - str < reg->anc_dist_min)
|
||||
if (DIST_CAST(max_semi_end - start) < reg->anc_dist_min) {
|
||||
if (DIST_CAST(max_semi_end - str) < reg->anc_dist_min)
|
||||
goto mismatch_no_msa;
|
||||
else {
|
||||
start = max_semi_end - reg->anc_dist_min;
|
||||
@ -5590,7 +5608,7 @@ search_in_range(regex_t* reg, const UChar* str, const UChar* end,
|
||||
if (reg->dist_max == INFINITE_LEN)
|
||||
sch_range = (UChar* )end;
|
||||
else {
|
||||
if ((end - range) < reg->dist_max)
|
||||
if (DIST_CAST(end - range) < reg->dist_max)
|
||||
sch_range = (UChar* )end;
|
||||
else {
|
||||
sch_range = (UChar* )range + reg->dist_max;
|
||||
@ -5666,14 +5684,14 @@ search_in_range(regex_t* reg, const UChar* str, const UChar* end,
|
||||
else
|
||||
adjrange = (UChar* )end;
|
||||
|
||||
if (end - range > reg->dist_min)
|
||||
if (DIST_CAST(end - range) > reg->dist_min)
|
||||
min_range = range + reg->dist_min;
|
||||
else
|
||||
min_range = end;
|
||||
|
||||
if (reg->dist_max != INFINITE_LEN) {
|
||||
do {
|
||||
if (end - s > reg->dist_max)
|
||||
if (DIST_CAST(end - s) > reg->dist_max)
|
||||
sch_start = s + reg->dist_max;
|
||||
else {
|
||||
sch_start = onigenc_get_prev_char_head(reg->enc, str, end);
|
||||
@ -6664,7 +6682,7 @@ onig_builtin_monitor(OnigCalloutArgs* args, void* user_data)
|
||||
|
||||
tag_len = tag_end - tag_start;
|
||||
if (tag_len >= sizeof(buf)) tag_len = sizeof(buf) - 1;
|
||||
for (i = 0; i < tag_len; i++) buf[i] = tag_start[i];
|
||||
for (i = 0; i < (int )tag_len; i++) buf[i] = tag_start[i];
|
||||
buf[tag_len] = '\0';
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
regint.h - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2020 K.Kosako
|
||||
* Copyright (c) 2002-2021 K.Kosako
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -437,81 +437,6 @@ typedef Bits* BitSetRef;
|
||||
#define BITSET_CLEAR_BIT(bs, pos) BS_ROOM(bs,pos) &= ~(BS_BIT(pos))
|
||||
#define BITSET_INVERT_BIT(bs, pos) BS_ROOM(bs,pos) ^= BS_BIT(pos)
|
||||
|
||||
/* bytes buffer */
|
||||
typedef struct _BBuf {
|
||||
UChar* p;
|
||||
unsigned int used;
|
||||
unsigned int alloc;
|
||||
} BBuf;
|
||||
|
||||
#define BB_INIT(buf,size) bbuf_init((BBuf* )(buf), (size))
|
||||
|
||||
#define BB_EXPAND(buf,low) do{\
|
||||
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
|
||||
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
||||
} while (0)
|
||||
|
||||
#define BB_ENSURE_SIZE(buf,size) do{\
|
||||
unsigned int new_alloc = (buf)->alloc;\
|
||||
while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
|
||||
if ((buf)->alloc != new_alloc) {\
|
||||
(buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
|
||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
||||
(buf)->alloc = new_alloc;\
|
||||
}\
|
||||
} while (0)
|
||||
|
||||
#define BB_WRITE(buf,pos,bytes,n) do{\
|
||||
int used = (pos) + (n);\
|
||||
if ((buf)->alloc < (unsigned int )used) BB_EXPAND((buf),used);\
|
||||
xmemcpy((buf)->p + (pos), (bytes), (n));\
|
||||
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
|
||||
} while (0)
|
||||
|
||||
#define BB_WRITE1(buf,pos,byte) do{\
|
||||
int used = (pos) + 1;\
|
||||
if ((buf)->alloc < (unsigned int )used) BB_EXPAND((buf),used);\
|
||||
(buf)->p[(pos)] = (byte);\
|
||||
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
|
||||
} while (0)
|
||||
|
||||
#define BB_ADD(buf,bytes,n) BB_WRITE((buf),(buf)->used,(bytes),(n))
|
||||
#define BB_ADD1(buf,byte) BB_WRITE1((buf),(buf)->used,(byte))
|
||||
#define BB_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used)
|
||||
#define BB_GET_OFFSET_POS(buf) ((buf)->used)
|
||||
|
||||
/* from < to */
|
||||
#define BB_MOVE_RIGHT(buf,from,to,n) do {\
|
||||
if ((unsigned int )((to)+(n)) > (buf)->alloc) BB_EXPAND((buf),(to) + (n));\
|
||||
xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
|
||||
if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\
|
||||
} while (0)
|
||||
|
||||
/* from > to */
|
||||
#define BB_MOVE_LEFT(buf,from,to,n) do {\
|
||||
xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
|
||||
} while (0)
|
||||
|
||||
/* from > to */
|
||||
#define BB_MOVE_LEFT_REDUCE(buf,from,to) do {\
|
||||
xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\
|
||||
(buf)->used -= (from - to);\
|
||||
} while (0)
|
||||
|
||||
#define BB_INSERT(buf,pos,bytes,n) do {\
|
||||
if (pos >= (buf)->used) {\
|
||||
BB_WRITE(buf,pos,bytes,n);\
|
||||
}\
|
||||
else {\
|
||||
BB_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\
|
||||
xmemcpy((buf)->p + (pos), (bytes), (n));\
|
||||
}\
|
||||
} while (0)
|
||||
|
||||
#define BB_GET_BYTE(buf, pos) (buf)->p[(pos)]
|
||||
|
||||
|
||||
/* has body */
|
||||
#define ANCR_PREC_READ (1<<0)
|
||||
#define ANCR_PREC_READ_NOT (1<<1)
|
||||
|
||||
@ -159,6 +159,75 @@ OnigSyntaxType OnigSyntaxRuby = {
|
||||
|
||||
OnigSyntaxType* OnigDefaultSyntax = ONIG_SYNTAX_ONIGURUMA;
|
||||
|
||||
|
||||
#define BB_INIT(buf,size) bbuf_init((BBuf* )(buf), (size))
|
||||
|
||||
#define BB_EXPAND(buf,low) do{\
|
||||
do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
|
||||
(buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
|
||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
||||
} while (0)
|
||||
|
||||
#define BB_ENSURE_SIZE(buf,size) do{\
|
||||
unsigned int new_alloc = (buf)->alloc;\
|
||||
while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
|
||||
if ((buf)->alloc != new_alloc) {\
|
||||
(buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
|
||||
if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
|
||||
(buf)->alloc = new_alloc;\
|
||||
}\
|
||||
} while (0)
|
||||
|
||||
#define BB_WRITE(buf,pos,bytes,n) do{\
|
||||
int used = (pos) + (n);\
|
||||
if ((buf)->alloc < (unsigned int )used) BB_EXPAND((buf),used);\
|
||||
xmemcpy((buf)->p + (pos), (bytes), (n));\
|
||||
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
|
||||
} while (0)
|
||||
|
||||
#define BB_WRITE1(buf,pos,byte) do{\
|
||||
int used = (pos) + 1;\
|
||||
if ((buf)->alloc < (unsigned int )used) BB_EXPAND((buf),used);\
|
||||
(buf)->p[(pos)] = (byte);\
|
||||
if ((buf)->used < (unsigned int )used) (buf)->used = used;\
|
||||
} while (0)
|
||||
|
||||
#define BB_ADD(buf,bytes,n) BB_WRITE((buf),(buf)->used,(bytes),(n))
|
||||
#define BB_ADD1(buf,byte) BB_WRITE1((buf),(buf)->used,(byte))
|
||||
#define BB_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used)
|
||||
#define BB_GET_OFFSET_POS(buf) ((buf)->used)
|
||||
|
||||
/* from < to */
|
||||
#define BB_MOVE_RIGHT(buf,from,to,n) do {\
|
||||
if ((unsigned int )((to)+(n)) > (buf)->alloc) BB_EXPAND((buf),(to) + (n));\
|
||||
xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
|
||||
if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\
|
||||
} while (0)
|
||||
|
||||
/* from > to */
|
||||
#define BB_MOVE_LEFT(buf,from,to,n) do {\
|
||||
xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
|
||||
} while (0)
|
||||
|
||||
/* from > to */
|
||||
#define BB_MOVE_LEFT_REDUCE(buf,from,to) do {\
|
||||
xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\
|
||||
(buf)->used -= (from - to);\
|
||||
} while (0)
|
||||
|
||||
#define BB_INSERT(buf,pos,bytes,n) do {\
|
||||
if (pos >= (buf)->used) {\
|
||||
BB_WRITE(buf,pos,bytes,n);\
|
||||
}\
|
||||
else {\
|
||||
BB_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\
|
||||
xmemcpy((buf)->p + (pos), (bytes), (n));\
|
||||
}\
|
||||
} while (0)
|
||||
|
||||
#define BB_GET_BYTE(buf, pos) (buf)->p[(pos)]
|
||||
|
||||
|
||||
typedef enum {
|
||||
CS_VALUE,
|
||||
CS_RANGE,
|
||||
|
||||
@ -73,6 +73,14 @@ enum BodyEmptyType {
|
||||
BODY_MAY_BE_EMPTY_REC = 3
|
||||
};
|
||||
|
||||
/* bytes buffer */
|
||||
typedef struct _BBuf {
|
||||
UChar* p;
|
||||
unsigned int used;
|
||||
unsigned int alloc;
|
||||
} BBuf;
|
||||
|
||||
|
||||
struct _Node;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@ -436,7 +436,8 @@ class ScintillaWin final :
|
||||
|
||||
UINT linesPerScroll; ///< Intellimouse support
|
||||
UINT charsPerScroll; ///< Intellimouse support
|
||||
int wheelDelta; ///< Wheel delta from roll
|
||||
int wheelDelta; ///< Wheel delta from roll
|
||||
int wheelDeltaH; ///< Wheel delta from horizontal wheel roll
|
||||
|
||||
DPI_T dpi = { USER_DEFAULT_SCREEN_DPI, USER_DEFAULT_SCREEN_DPI };
|
||||
ReverseArrowCursor reverseArrowCursor;
|
||||
@ -677,7 +678,8 @@ ScintillaWin::ScintillaWin(HWND hwnd) noexcept {
|
||||
|
||||
linesPerScroll = 0;
|
||||
charsPerScroll = 0;
|
||||
wheelDelta = 0; // Wheel delta from roll
|
||||
wheelDelta = 0; // Wheel delta from roll
|
||||
wheelDeltaH = 0; // H-Wheel delta from roll
|
||||
|
||||
dpi = GetWindowDPI(hwnd);
|
||||
|
||||
@ -1776,6 +1778,49 @@ sptr_t ScintillaWin::MouseMessage(unsigned int iMessage, uptr_t wParam, sptr_t l
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_MOUSEHWHEEL:
|
||||
if (!mouseWheelCaptures) {
|
||||
// if the mouse wheel is not captured, test if the mouse
|
||||
// pointer is over the editor window and if not, don't
|
||||
// handle the message but pass it on.
|
||||
RECT rc;
|
||||
GetWindowRect(MainHWND(), &rc);
|
||||
const POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
if (!PtInRect(&rc, pt)) {
|
||||
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
wheelDeltaH += GET_WHEEL_DELTA_WPARAM(wParam);
|
||||
if (std::abs(wheelDeltaH) < WHEEL_DELTA) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (vs.wrapState != WrapMode::none || charsPerScroll == 0) {
|
||||
return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam);
|
||||
}
|
||||
else {
|
||||
int charsToScroll = charsPerScroll;
|
||||
if (charsPerScroll == WHEEL_PAGESCROLL) {
|
||||
const PRectangle rcText = GetTextRectangle();
|
||||
const int pageWidth = static_cast<int>(rcText.Width() * 2 / 3);
|
||||
charsToScroll = pageWidth;
|
||||
}
|
||||
else {
|
||||
charsToScroll = 1 + static_cast<int>(std::max(charsToScroll, 1) * vs.aveCharWidth);
|
||||
}
|
||||
charsToScroll *= (wheelDeltaH / WHEEL_DELTA);
|
||||
if (wheelDeltaH >= 0) {
|
||||
wheelDeltaH = wheelDeltaH % WHEEL_DELTA;
|
||||
}
|
||||
else {
|
||||
wheelDeltaH = -(-wheelDeltaH % WHEEL_DELTA);
|
||||
}
|
||||
HorizontalScrollTo(xOffset + charsToScroll);
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -2255,6 +2300,7 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam
|
||||
case WM_MOUSEMOVE:
|
||||
case WM_MOUSELEAVE:
|
||||
case WM_MOUSEWHEEL:
|
||||
case WM_MOUSEHWHEEL:
|
||||
return MouseMessage(iMessage, wParam, lParam);
|
||||
|
||||
case WM_SETCURSOR:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user