mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+upd: Oniguruma v7.0.0 (beta)
This commit is contained in:
parent
0a8aba1654
commit
a67b54826d
@ -3,7 +3,7 @@
|
||||
<assemblyIdentity
|
||||
name="Rizonesoft.Notepad3"
|
||||
processorArchitecture="*"
|
||||
version="5.21.702.2"
|
||||
version="5.21.702.3"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Notepad3 beta</description>
|
||||
|
||||
@ -359,12 +359,10 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="oniguruma\src\ascii.c" />
|
||||
<ClCompile Include="oniguruma\src\mktable.c" />
|
||||
<ClCompile Include="oniguruma\src\onig_init.c" />
|
||||
<ClCompile Include="oniguruma\src\regcomp.c" />
|
||||
<ClCompile Include="oniguruma\src\regenc.c" />
|
||||
<ClCompile Include="oniguruma\src\regerror.c" />
|
||||
<ClCompile Include="oniguruma\src\regexec.c" />
|
||||
<ClCompile Include="oniguruma\src\regext.c" />
|
||||
<ClCompile Include="oniguruma\src\reggnu.c" />
|
||||
<ClCompile Include="oniguruma\src\regparse.c" />
|
||||
<ClCompile Include="oniguruma\src\regsyntax.c" />
|
||||
|
||||
@ -123,9 +123,6 @@
|
||||
<ClCompile Include="oniguruma\src\mktable.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="oniguruma\src\onig_init.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="oniguruma\src\regcomp.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
@ -138,9 +135,6 @@
|
||||
<ClCompile Include="oniguruma\src\regexec.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="oniguruma\src\regext.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="oniguruma\src\reggnu.c">
|
||||
<Filter>oniguruma\src</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
README 2018/04/05
|
||||
README 2021/06/23
|
||||
|
||||
Oniguruma ---- (C) K.Kosako
|
||||
|
||||
@ -146,7 +146,6 @@ Source Files
|
||||
regcomp.c compiling and optimization functions
|
||||
regenc.c character encodings framework.
|
||||
regerror.c error message function
|
||||
regext.c extended API functions. (deluxe version API)
|
||||
regexec.c search and match functions
|
||||
regparse.c parsing functions.
|
||||
regsyntax.c pattern syntax functions and built-in syntax definitions.
|
||||
|
||||
@ -7,6 +7,9 @@
|
||||
Oniguruma
|
||||
=========
|
||||
|
||||
**For a long time, Oniguruma has been under attack on Google search.** [(Issue #234)](https://github.com/kkos/oniguruma/issues/234)
|
||||
|
||||
|
||||
https://github.com/kkos/oniguruma
|
||||
|
||||
Oniguruma is a modern and flexible regular expressions library. It
|
||||
@ -247,7 +250,6 @@ Source Files
|
||||
|regcomp.c |compiling and optimization functions |
|
||||
|regenc.c |character encodings framework |
|
||||
|regerror.c |error message function |
|
||||
|regext.c |extended API functions (deluxe version API) |
|
||||
|regexec.c |search and match functions |
|
||||
|regparse.c |parsing functions. |
|
||||
|regsyntax.c |pattern syntax functions and built-in syntax definitions|
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
Oniguruma API Version 7.0.0 2021/04/26
|
||||
Oniguruma API Version 7.0.0 2021/06/23
|
||||
|
||||
#include <oniguruma.h>
|
||||
|
||||
@ -9,8 +9,6 @@ Oniguruma API Version 7.0.0 2021/04/26
|
||||
|
||||
You have to call it explicitly.
|
||||
|
||||
* onig_init() is deprecated.
|
||||
|
||||
arguments
|
||||
1 use_encodings: array of encodings used in application.
|
||||
2 num_encodings: number of encodings.
|
||||
@ -175,54 +173,6 @@ Oniguruma API Version 7.0.0 2021/04/26
|
||||
error: error code < 0
|
||||
|
||||
|
||||
# int onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
||||
OnigCompileInfo* ci, OnigErrorInfo* einfo)
|
||||
|
||||
This function is deprecated, and it does not allow the case where
|
||||
the encoding of pattern and target is different.
|
||||
|
||||
Create a regex object.
|
||||
This function is deluxe version of onig_new().
|
||||
|
||||
return value
|
||||
normal: ONIG_NORMAL == 0
|
||||
error: error code < 0
|
||||
|
||||
arguments
|
||||
1 reg: return address of regex object.
|
||||
2 pattern: regex pattern string.
|
||||
3 pattern_end: terminate address of pattern. (pattern + pattern length)
|
||||
4 ci: compile time info.
|
||||
|
||||
ci->num_of_elements: number of elements in ci. (current version: 5)
|
||||
ci->pattern_enc: pattern string character encoding.
|
||||
ci->target_enc: target string character encoding.
|
||||
ci->syntax: address of pattern syntax definition.
|
||||
ci->option: compile time option.
|
||||
ci->case_fold_flag: character matching case fold bit flag for
|
||||
ONIG_OPTION_IGNORECASE mode.
|
||||
|
||||
ONIGENC_CASE_FOLD_MIN: minimum
|
||||
ONIGENC_CASE_FOLD_DEFAULT: minimum
|
||||
onig_set_default_case_fold_flag()
|
||||
|
||||
5 err_info: address for return optional error info.
|
||||
Use this value as 3rd argument of onig_error_code_to_str().
|
||||
|
||||
|
||||
Different character encoding combination is allowed for
|
||||
the following cases only.
|
||||
|
||||
pattern_enc: ASCII, ISO_8859_1
|
||||
target_enc: UTF16_BE, UTF16_LE, UTF32_BE, UTF32_LE
|
||||
|
||||
pattern_enc: UTF16_BE/LE
|
||||
target_enc: UTF16_LE/BE
|
||||
|
||||
pattern_enc: UTF32_BE/LE
|
||||
target_enc: UTF32_LE/BE
|
||||
|
||||
|
||||
# void onig_free(regex_t* reg)
|
||||
|
||||
Free memory used by regex object.
|
||||
@ -700,15 +650,6 @@ Oniguruma API Version 7.0.0 2021/04/26
|
||||
1 reg: regex object.
|
||||
|
||||
|
||||
# OnigCaseFoldType onig_get_case_fold_flag(regex_t* reg)
|
||||
|
||||
Return the case_fold_flag of the regex object.
|
||||
This function is deprecated.
|
||||
|
||||
arguments
|
||||
1 reg: regex object.
|
||||
|
||||
|
||||
# int onig_number_of_captures(regex_t* reg)
|
||||
|
||||
Return the number of capture group in the pattern.
|
||||
@ -929,20 +870,6 @@ Oniguruma API Version 7.0.0 2021/04/26
|
||||
3 code: meta character or ONIG_INEFFECTIVE_META_CHAR.
|
||||
|
||||
|
||||
# OnigCaseFoldType onig_get_default_case_fold_flag()
|
||||
|
||||
Get default case fold flag.
|
||||
This function is deprecated.
|
||||
|
||||
|
||||
# int onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
|
||||
|
||||
Set default case fold flag.
|
||||
This function is deprecated.
|
||||
|
||||
1 case_fold_flag: case fold flag
|
||||
|
||||
|
||||
# unsigned int onig_get_match_stack_limit_size(void)
|
||||
|
||||
Return the maximum number of stack size.
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
CHANGES_7.0 2021/05/17
|
||||
CHANGES_7.0 2021/06/23
|
||||
|
||||
The changes from 6.9 to 7.0 are shown below.
|
||||
|
||||
@ -14,7 +14,7 @@ The changes from 6.9 to 7.0 are shown below.
|
||||
|
||||
+ Move the definition of OnigEncodingType structure from oniguruma.h to regenc.h
|
||||
|
||||
+ Removed from oniguruma.h
|
||||
+ Removed macros from oniguruma.h
|
||||
ONIGENC_IS_MBC_WORD_ASCII()
|
||||
ONIGENC_MBC_CASE_FOLD()
|
||||
ONIGENC_LEFT_ADJUST_CHAR_HEAD()
|
||||
@ -45,13 +45,19 @@ The changes from 6.9 to 7.0 are shown below.
|
||||
ONIGENC_CODE_TO_MBC() -> onigenc_code_to_mbc()
|
||||
ONIGENC_IS_CODE_CTYPE() -> onigenc_is_code_ctype()
|
||||
|
||||
+ Removed deprecated functions
|
||||
onig_init()
|
||||
onig_new_deluxe()
|
||||
onig_get_case_fold_flag()
|
||||
onig_get_default_case_fold_flag()
|
||||
onig_set_default_case_fold_flag()
|
||||
|
||||
|
||||
* Will change
|
||||
|
||||
+ Increase the size of the ONIG_SYN_OP/OP2_XXX flag area.
|
||||
+ Improve the API of syntax-op.
|
||||
(Eliminate the distinction between OP and OP2)
|
||||
+ Eliminate deprecated functions.
|
||||
+ update LTVERSION
|
||||
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ headers = $(posixheaders) $(onigheaders)
|
||||
|
||||
onigobjs = $(BUILD_DIR)/reggnu.obj $(BUILD_DIR)/regerror.obj $(BUILD_DIR)/regparse.obj $(BUILD_DIR)/regext.obj $(BUILD_DIR)/regcomp.obj \
|
||||
$(BUILD_DIR)/regexec.obj $(BUILD_DIR)/regenc.obj $(BUILD_DIR)/regsyntax.obj $(BUILD_DIR)/regtrav.obj \
|
||||
$(BUILD_DIR)/regversion.obj $(BUILD_DIR)/st.obj $(BUILD_DIR)/onig_init.obj
|
||||
$(BUILD_DIR)/regversion.obj $(BUILD_DIR)/st.obj
|
||||
libobjs = $(onigobjs) $(posixobjs)
|
||||
|
||||
jp_objs = $(BUILD_DIR)/euc_jp.obj $(BUILD_DIR)/sjis.obj
|
||||
@ -68,7 +68,7 @@ encobjs = $(BUILD_DIR)/ascii.obj $(BUILD_DIR)/utf8.obj \
|
||||
$(BUILD_DIR)/unicode_unfold_key.obj $(BUILD_DIR)/unicode_fold1_key.obj \
|
||||
$(BUILD_DIR)/unicode_fold2_key.obj $(BUILD_DIR)/unicode_fold3_key.obj # $(BUILD_DIR)/koi8.obj
|
||||
|
||||
onigsources = $(ONIG_DIR)/regerror.c $(ONIG_DIR)/regparse.c $(ONIG_DIR)/regext.c $(ONIG_DIR)/regcomp.c $(ONIG_DIR)/regexec.c $(ONIG_DIR)/regenc.c \
|
||||
onigsources = $(ONIG_DIR)/regerror.c $(ONIG_DIR)/regparse.c $(ONIG_DIR)/regcomp.c $(ONIG_DIR)/regexec.c $(ONIG_DIR)/regenc.c \
|
||||
$(ONIG_DIR)/regsyntax.c $(ONIG_DIR)/regtrav.c $(ONIG_DIR)/regversion.c $(ONIG_DIR)/reggnu.c $(ONIG_DIR)/st.c
|
||||
posixsources = $(ONIG_DIR)/regposix.c $(ONIG_DIR)/regposerr.c
|
||||
libsources = $(posixsources) $(onigsources)
|
||||
@ -101,7 +101,6 @@ $(dllname): $(libobjs) $(encobjs)
|
||||
$(ARDLL) $(libobjs) $(encobjs) -Fe$@ $(ARDLL_FLAGS)
|
||||
|
||||
$(BUILD_DIR)/regparse.obj: $(ONIG_DIR)/regparse.c $(onigheaders) $(BUILD_DIR)/config.h
|
||||
$(BUILD_DIR)/regext.obj: $(ONIG_DIR)/regext.c $(onigheaders) $(BUILD_DIR)/config.h
|
||||
$(BUILD_DIR)/regtrav.obj: $(ONIG_DIR)/regtrav.c $(onigheaders) $(BUILD_DIR)/config.h
|
||||
$(BUILD_DIR)/regcomp.obj: $(ONIG_DIR)/regcomp.c $(onigheaders) $(BUILD_DIR)/config.h
|
||||
$(BUILD_DIR)/regexec.obj: $(ONIG_DIR)/regexec.c $(ONIG_DIR)/regint.h $(ONIG_DIR)/regenc.h $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h
|
||||
@ -113,7 +112,6 @@ $(BUILD_DIR)/regversion.obj: $(ONIG_DIR)/regversion.c $(ONIG_DIR)/oniguruma.h $(
|
||||
$(BUILD_DIR)/regposix.obj: $(ONIG_DIR)/regposix.c $(posixheaders) $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h
|
||||
$(BUILD_DIR)/regposerr.obj: $(ONIG_DIR)/regposerr.c $(posixheaders) $(BUILD_DIR)/config.h
|
||||
$(BUILD_DIR)/st.obj: $(ONIG_DIR)/st.c $(ONIG_DIR)/regint.h $(ONIG_DIR)/oniguruma.h $(BUILD_DIR)/config.h $(ONIG_DIR)/st.h
|
||||
$(BUILD_DIR)/onig_init.obj: $(ONIG_DIR)/onig_init.c $(ONIG_DIR)/oniguruma.h
|
||||
|
||||
$(BUILD_DIR)/ascii.obj: $(ONIG_DIR)/ascii.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h
|
||||
$(BUILD_DIR)/unicode.obj: $(ONIG_DIR)/unicode.c $(ONIG_DIR)/unicode_fold_data.c $(ONIG_DIR)/unicode_property_data.c $(ONIG_DIR)/regenc.h $(BUILD_DIR)/config.h
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
/**********************************************************************
|
||||
onig_init.c - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2016-2019 K.Kosako
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "regint.h"
|
||||
|
||||
/* onig_init(): deprecated function */
|
||||
extern int
|
||||
onig_init(void)
|
||||
{
|
||||
#if 0
|
||||
OnigEncoding encs[] = {
|
||||
ONIG_ENCODING_UTF8
|
||||
};
|
||||
|
||||
return onig_initialize(encs, sizeof(encs)/sizeof(encs[0]));
|
||||
#else
|
||||
return onig_initialize(0, 0);
|
||||
#endif
|
||||
}
|
||||
@ -104,7 +104,6 @@ ONIG_EXTERN OnigCaseFoldType OnigDefaultCaseFoldFlag;
|
||||
#define INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR (1<<30)
|
||||
|
||||
#define ONIGENC_CASE_FOLD_MIN INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR
|
||||
#define ONIGENC_CASE_FOLD_DEFAULT OnigDefaultCaseFoldFlag
|
||||
|
||||
|
||||
#define ONIGENC_MAX_COMP_CASE_FOLD_CODE_LEN 3
|
||||
@ -781,7 +780,6 @@ typedef struct OnigMatchParamStruct OnigMatchParam;
|
||||
|
||||
ONIG_EXTERN
|
||||
int onig_initialize P_((OnigEncoding encodings[], int number_of_encodings));
|
||||
/* onig_init(): deprecated function. Use onig_initialize(). */
|
||||
ONIG_EXTERN
|
||||
int onig_init P_((void));
|
||||
ONIG_EXTERN
|
||||
@ -798,8 +796,6 @@ ONIG_EXTERN
|
||||
int onig_reg_init P_((OnigRegex reg, OnigOptionType option, OnigCaseFoldType case_fold_flag, OnigEncoding enc, OnigSyntaxType* syntax));
|
||||
int onig_new_without_alloc P_((OnigRegex, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigOptionType option, OnigEncoding enc, OnigSyntaxType* syntax, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
int onig_new_deluxe P_((OnigRegex* reg, const OnigUChar* pattern, const OnigUChar* pattern_end, OnigCompileInfo* ci, OnigErrorInfo* einfo));
|
||||
ONIG_EXTERN
|
||||
void onig_free P_((OnigRegex));
|
||||
ONIG_EXTERN
|
||||
void onig_free_body P_((OnigRegex));
|
||||
@ -870,8 +866,6 @@ OnigEncoding onig_get_encoding P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigOptionType onig_get_options P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigCaseFoldType onig_get_case_fold_flag P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
OnigSyntaxType* onig_get_syntax P_((OnigRegex reg));
|
||||
ONIG_EXTERN
|
||||
int onig_set_default_syntax P_((OnigSyntaxType* syntax));
|
||||
@ -898,10 +892,6 @@ int onig_set_meta_char P_((OnigSyntaxType* syntax, unsigned int what, OnigCodePo
|
||||
ONIG_EXTERN
|
||||
void onig_copy_encoding P_((OnigEncoding to, OnigEncoding from));
|
||||
ONIG_EXTERN
|
||||
OnigCaseFoldType onig_get_default_case_fold_flag P_((void));
|
||||
ONIG_EXTERN
|
||||
int onig_set_default_case_fold_flag P_((OnigCaseFoldType case_fold_flag));
|
||||
ONIG_EXTERN
|
||||
unsigned int onig_get_match_stack_limit_size P_((void));
|
||||
ONIG_EXTERN
|
||||
int onig_set_match_stack_limit_size P_((unsigned int size));
|
||||
|
||||
@ -45,87 +45,9 @@ typedef struct {
|
||||
int min_is_sure;
|
||||
} MinMaxCharLen;
|
||||
|
||||
OnigCaseFoldType OnigDefaultCaseFoldFlag = ONIGENC_CASE_FOLD_MIN;
|
||||
|
||||
static OnigLen node_min_byte_len(Node* node, ParseEnv* env);
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
int n;
|
||||
int alloc;
|
||||
int* v;
|
||||
} int_stack;
|
||||
|
||||
static int
|
||||
make_int_stack(int_stack** rs, int init_size)
|
||||
{
|
||||
int_stack* s;
|
||||
int* v;
|
||||
|
||||
*rs = 0;
|
||||
|
||||
s = xmalloc(sizeof(*s));
|
||||
if (IS_NULL(s)) return ONIGERR_MEMORY;
|
||||
|
||||
v = (int* )xmalloc(sizeof(int) * init_size);
|
||||
if (IS_NULL(v)) {
|
||||
xfree(s);
|
||||
return ONIGERR_MEMORY;
|
||||
}
|
||||
|
||||
s->n = 0;
|
||||
s->alloc = init_size;
|
||||
s->v = v;
|
||||
|
||||
*rs = s;
|
||||
return ONIG_NORMAL;
|
||||
}
|
||||
|
||||
static void
|
||||
free_int_stack(int_stack* s)
|
||||
{
|
||||
if (IS_NOT_NULL(s)) {
|
||||
if (IS_NOT_NULL(s->v))
|
||||
xfree(s->v);
|
||||
xfree(s);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
int_stack_push(int_stack* s, int v)
|
||||
{
|
||||
if (s->n >= s->alloc) {
|
||||
int new_size = s->alloc * 2;
|
||||
int* nv = (int* )xrealloc(s->v, sizeof(int) * new_size);
|
||||
if (IS_NULL(nv)) return ONIGERR_MEMORY;
|
||||
|
||||
s->alloc = new_size;
|
||||
s->v = nv;
|
||||
}
|
||||
|
||||
s->v[s->n] = v;
|
||||
s->n++;
|
||||
return ONIG_NORMAL;
|
||||
}
|
||||
|
||||
static int
|
||||
int_stack_pop(int_stack* s)
|
||||
{
|
||||
int v;
|
||||
|
||||
#ifdef ONIG_DEBUG
|
||||
if (s->n <= 0) {
|
||||
fprintf(DBGFP, "int_stack_pop: fail empty. %p\n", s);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
v = s->v[s->n];
|
||||
s->n--;
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
ops_init(regex_t* reg, int init_alloc_size)
|
||||
{
|
||||
@ -388,19 +310,6 @@ ops_make_string_pool(regex_t* reg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern OnigCaseFoldType
|
||||
onig_get_default_case_fold_flag(void)
|
||||
{
|
||||
return OnigDefaultCaseFoldFlag;
|
||||
}
|
||||
|
||||
extern int
|
||||
onig_set_default_case_fold_flag(OnigCaseFoldType case_fold_flag)
|
||||
{
|
||||
OnigDefaultCaseFoldFlag = case_fold_flag;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
len_multiply_cmp(OnigLen x, int y, OnigLen v)
|
||||
{
|
||||
@ -7667,7 +7576,7 @@ onig_new_without_alloc(regex_t* reg,
|
||||
{
|
||||
int r;
|
||||
|
||||
r = onig_reg_init(reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax);
|
||||
r = onig_reg_init(reg, option, ONIGENC_CASE_FOLD_MIN, enc, syntax);
|
||||
if (r != 0) return r;
|
||||
|
||||
r = onig_compile(reg, pattern, pattern_end, einfo);
|
||||
@ -7684,7 +7593,7 @@ onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
||||
*reg = (regex_t* )xmalloc(sizeof(regex_t));
|
||||
if (IS_NULL(*reg)) return ONIGERR_MEMORY;
|
||||
|
||||
r = onig_reg_init(*reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax);
|
||||
r = onig_reg_init(*reg, option, ONIGENC_CASE_FOLD_MIN, enc, syntax);
|
||||
if (r != 0) {
|
||||
xfree(*reg);
|
||||
*reg = NULL;
|
||||
@ -8130,7 +8039,7 @@ onig_detect_can_be_slow_pattern(const UChar* pattern,
|
||||
reg = (regex_t* )xmalloc(sizeof(regex_t));
|
||||
if (IS_NULL(reg)) return ONIGERR_MEMORY;
|
||||
|
||||
r = onig_reg_init(reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax);
|
||||
r = onig_reg_init(reg, option, ONIGENC_CASE_FOLD_MIN, enc, syntax);
|
||||
if (r != 0) {
|
||||
xfree(reg);
|
||||
return r;
|
||||
@ -8161,9 +8070,15 @@ onig_detect_can_be_slow_pattern(const UChar* pattern,
|
||||
|
||||
r = detect_can_be_slow(root, &count, 0, calls);
|
||||
if (r == 0) {
|
||||
int n = count.prec_read + count.look_behind
|
||||
+ count.backref + count.backref_with_level + count.call
|
||||
+ count.anychar_reluctant_many;
|
||||
int n;
|
||||
|
||||
n = count.prec_read + count.look_behind
|
||||
+ count.backref + count.backref_with_level + count.call
|
||||
+ count.anychar_reluctant_many;
|
||||
|
||||
if (count.max_empty_check_nest_level > 2)
|
||||
n += count.max_empty_check_nest_level - 2;
|
||||
|
||||
if (count.heavy_element != 0)
|
||||
n += count.heavy_element << 8;
|
||||
|
||||
@ -8177,6 +8092,7 @@ onig_detect_can_be_slow_pattern(const UChar* pattern,
|
||||
fprintf(DBGFP, " backref_with_level: %d\n", count.backref_with_level);
|
||||
fprintf(DBGFP, " call: %d\n", count.call);
|
||||
fprintf(DBGFP, " any_reluctant_many: %d\n", count.anychar_reluctant_many);
|
||||
fprintf(DBGFP, " max_empty_check_nest_level: %d\n", count.max_empty_check_nest_level);
|
||||
fprintf(DBGFP, " heavy_element: %d\n", count.heavy_element);
|
||||
fprintf(DBGFP, " r: %d\n", r);
|
||||
fprintf(DBGFP, "\n");
|
||||
|
||||
@ -3060,6 +3060,9 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
|
||||
if (n > msa->best_len) {
|
||||
msa->best_len = n;
|
||||
msa->best_s = (UChar* )sstart;
|
||||
if (s >= in_right_range) {
|
||||
best_len = msa->best_len; /* end of find */
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (s >= in_right_range && msa->best_s == sstart) {
|
||||
@ -5891,12 +5894,6 @@ onig_get_options(regex_t* reg)
|
||||
return reg->options;
|
||||
}
|
||||
|
||||
extern OnigCaseFoldType
|
||||
onig_get_case_fold_flag(regex_t* reg)
|
||||
{
|
||||
return reg->case_fold_flag;
|
||||
}
|
||||
|
||||
extern OnigSyntaxType*
|
||||
onig_get_syntax(regex_t* reg)
|
||||
{
|
||||
|
||||
@ -1,202 +0,0 @@
|
||||
/**********************************************************************
|
||||
regext.c - Oniguruma (regular expression library)
|
||||
**********************************************************************/
|
||||
/*-
|
||||
* Copyright (c) 2002-2019 K.Kosako
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "regint.h"
|
||||
|
||||
#if 0
|
||||
static void
|
||||
conv_ext0be32(const UChar* s, const UChar* end, UChar* conv)
|
||||
{
|
||||
while (s < end) {
|
||||
*conv++ = '\0';
|
||||
*conv++ = '\0';
|
||||
*conv++ = '\0';
|
||||
*conv++ = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_ext0le32(const UChar* s, const UChar* end, UChar* conv)
|
||||
{
|
||||
while (s < end) {
|
||||
*conv++ = *s++;
|
||||
*conv++ = '\0';
|
||||
*conv++ = '\0';
|
||||
*conv++ = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_ext0be(const UChar* s, const UChar* end, UChar* conv)
|
||||
{
|
||||
while (s < end) {
|
||||
*conv++ = '\0';
|
||||
*conv++ = *s++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_ext0le(const UChar* s, const UChar* end, UChar* conv)
|
||||
{
|
||||
while (s < end) {
|
||||
*conv++ = *s++;
|
||||
*conv++ = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_swap4bytes(const UChar* s, const UChar* end, UChar* conv)
|
||||
{
|
||||
while (s < end) {
|
||||
*conv++ = s[3];
|
||||
*conv++ = s[2];
|
||||
*conv++ = s[1];
|
||||
*conv++ = s[0];
|
||||
s += 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
conv_swap2bytes(const UChar* s, const UChar* end, UChar* conv)
|
||||
{
|
||||
while (s < end) {
|
||||
*conv++ = s[1];
|
||||
*conv++ = s[0];
|
||||
s += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
conv_encoding(OnigEncoding from, OnigEncoding to, const UChar* s, const UChar* end,
|
||||
UChar** conv, UChar** conv_end)
|
||||
{
|
||||
int len = (int )(end - s);
|
||||
|
||||
if (to == ONIG_ENCODING_UTF16_BE) {
|
||||
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
||||
*conv = (UChar* )xmalloc(len * 2);
|
||||
CHECK_NULL_RETURN_MEMERR(*conv);
|
||||
*conv_end = *conv + (len * 2);
|
||||
conv_ext0be(s, end, *conv);
|
||||
return 0;
|
||||
}
|
||||
else if (from == ONIG_ENCODING_UTF16_LE) {
|
||||
swap16:
|
||||
*conv = (UChar* )xmalloc(len);
|
||||
CHECK_NULL_RETURN_MEMERR(*conv);
|
||||
*conv_end = *conv + len;
|
||||
conv_swap2bytes(s, end, *conv);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (to == ONIG_ENCODING_UTF16_LE) {
|
||||
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
||||
*conv = (UChar* )xmalloc(len * 2);
|
||||
CHECK_NULL_RETURN_MEMERR(*conv);
|
||||
*conv_end = *conv + (len * 2);
|
||||
conv_ext0le(s, end, *conv);
|
||||
return 0;
|
||||
}
|
||||
else if (from == ONIG_ENCODING_UTF16_BE) {
|
||||
goto swap16;
|
||||
}
|
||||
}
|
||||
if (to == ONIG_ENCODING_UTF32_BE) {
|
||||
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
||||
*conv = (UChar* )xmalloc(len * 4);
|
||||
CHECK_NULL_RETURN_MEMERR(*conv);
|
||||
*conv_end = *conv + (len * 4);
|
||||
conv_ext0be32(s, end, *conv);
|
||||
return 0;
|
||||
}
|
||||
else if (from == ONIG_ENCODING_UTF32_LE) {
|
||||
swap32:
|
||||
*conv = (UChar* )xmalloc(len);
|
||||
CHECK_NULL_RETURN_MEMERR(*conv);
|
||||
*conv_end = *conv + len;
|
||||
conv_swap4bytes(s, end, *conv);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (to == ONIG_ENCODING_UTF32_LE) {
|
||||
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
||||
*conv = (UChar* )xmalloc(len * 4);
|
||||
CHECK_NULL_RETURN_MEMERR(*conv);
|
||||
*conv_end = *conv + (len * 4);
|
||||
conv_ext0le32(s, end, *conv);
|
||||
return 0;
|
||||
}
|
||||
else if (from == ONIG_ENCODING_UTF32_BE) {
|
||||
goto swap32;
|
||||
}
|
||||
}
|
||||
|
||||
return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int
|
||||
onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
||||
OnigCompileInfo* ci, OnigErrorInfo* einfo)
|
||||
{
|
||||
int r;
|
||||
UChar *cpat, *cpat_end;
|
||||
|
||||
if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL;
|
||||
|
||||
if (ci->pattern_enc != ci->target_enc) {
|
||||
return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION;
|
||||
}
|
||||
else {
|
||||
cpat = (UChar* )pattern;
|
||||
cpat_end = (UChar* )pattern_end;
|
||||
}
|
||||
|
||||
*reg = (regex_t* )xmalloc(sizeof(regex_t));
|
||||
if (IS_NULL(*reg)) {
|
||||
r = ONIGERR_MEMORY;
|
||||
goto err2;
|
||||
}
|
||||
|
||||
r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc,
|
||||
ci->syntax);
|
||||
if (r != 0) goto err;
|
||||
|
||||
r = onig_compile(*reg, cpat, cpat_end, einfo);
|
||||
if (r != 0) {
|
||||
err:
|
||||
onig_free(*reg);
|
||||
*reg = NULL;
|
||||
}
|
||||
|
||||
err2:
|
||||
if (cpat != pattern) xfree(cpat);
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -103,7 +103,7 @@ re_alloc_pattern(regex_t** reg)
|
||||
if (IS_NULL(*reg)) return ONIGERR_MEMORY;
|
||||
|
||||
return onig_reg_init(*reg, ONIG_OPTION_DEFAULT,
|
||||
ONIGENC_CASE_FOLD_DEFAULT,
|
||||
ONIGENC_CASE_FOLD_MIN,
|
||||
OnigEncDefaultCharEncoding,
|
||||
OnigDefaultSyntax);
|
||||
}
|
||||
|
||||
@ -3535,9 +3535,10 @@ scan_number(UChar** src, const UChar* end, OnigEncoding enc)
|
||||
{
|
||||
int num, val;
|
||||
OnigCodePoint c;
|
||||
UChar* p = *src;
|
||||
UChar* p;
|
||||
PFETCH_READY;
|
||||
|
||||
p = *src;
|
||||
num = 0;
|
||||
while (! PEND) {
|
||||
PFETCH(c);
|
||||
@ -3565,9 +3566,10 @@ scan_hexadecimal_number(UChar** src, UChar* end, int minlen, int maxlen,
|
||||
OnigCodePoint c;
|
||||
unsigned int val;
|
||||
int n;
|
||||
UChar* p = *src;
|
||||
UChar* p;
|
||||
PFETCH_READY;
|
||||
|
||||
p = *src;
|
||||
code = 0;
|
||||
n = 0;
|
||||
while (! PEND && n < maxlen) {
|
||||
@ -3602,9 +3604,10 @@ scan_octal_number(UChar** src, UChar* end, int minlen, int maxlen,
|
||||
OnigCodePoint c;
|
||||
unsigned int val;
|
||||
int n;
|
||||
UChar* p = *src;
|
||||
UChar* p;
|
||||
PFETCH_READY;
|
||||
|
||||
p = *src;
|
||||
code = 0;
|
||||
n = 0;
|
||||
while (! PEND && n < maxlen) {
|
||||
@ -3777,9 +3780,10 @@ get_next_code_point(UChar** src, UChar* end, int base, OnigEncoding enc, int in_
|
||||
{
|
||||
int r;
|
||||
OnigCodePoint c;
|
||||
UChar* p = *src;
|
||||
UChar* p;
|
||||
PFETCH_READY;
|
||||
|
||||
p = *src;
|
||||
while (! PEND) {
|
||||
PFETCH(c);
|
||||
if (! IS_CODE_POINT_DIVIDE(c)) {
|
||||
@ -4545,13 +4549,17 @@ ptoken_init(PToken* tok)
|
||||
static int
|
||||
fetch_interval(UChar** src, UChar* end, PToken* tok, ParseEnv* env)
|
||||
{
|
||||
int low, up, syn_allow, non_low = 0;
|
||||
int r = 0;
|
||||
int low, up, syn_allow, non_low;
|
||||
int r;
|
||||
OnigCodePoint c;
|
||||
OnigEncoding enc = env->enc;
|
||||
UChar* p = *src;
|
||||
OnigEncoding enc;
|
||||
UChar* p;
|
||||
PFETCH_READY;
|
||||
|
||||
p = *src;
|
||||
r = 0;
|
||||
non_low = 0;
|
||||
enc = env->enc;
|
||||
syn_allow = IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_INVALID_INTERVAL);
|
||||
|
||||
if (PEND) {
|
||||
@ -4769,13 +4777,16 @@ fetch_name_with_level(OnigCodePoint start_code, UChar** src, UChar* end,
|
||||
int r, sign, exist_level;
|
||||
int digit_count;
|
||||
OnigCodePoint end_code;
|
||||
OnigCodePoint c = 0;
|
||||
OnigEncoding enc = env->enc;
|
||||
OnigCodePoint c;
|
||||
OnigEncoding enc;
|
||||
UChar *name_end;
|
||||
UChar *pnum_head;
|
||||
UChar *p = *src;
|
||||
UChar *p;
|
||||
PFETCH_READY;
|
||||
|
||||
p = *src;
|
||||
c = 0;
|
||||
enc = env->enc;
|
||||
*rback_num = 0;
|
||||
exist_level = 0;
|
||||
*num_type = IS_NOT_NUM;
|
||||
@ -5132,12 +5143,15 @@ fetch_token_cc(PToken* tok, UChar** src, UChar* end, ParseEnv* env, int state)
|
||||
OnigCodePoint code;
|
||||
OnigCodePoint c, c2;
|
||||
int mindigits, maxdigits;
|
||||
OnigSyntaxType* syn = env->syntax;
|
||||
OnigEncoding enc = env->enc;
|
||||
OnigSyntaxType* syn;
|
||||
OnigEncoding enc;
|
||||
UChar* prev;
|
||||
UChar* p = *src;
|
||||
UChar* p;
|
||||
PFETCH_READY;
|
||||
|
||||
p = *src;
|
||||
enc = env->enc;
|
||||
syn = env->syntax;
|
||||
if (tok->code_point_continue != 0) {
|
||||
r = get_next_code_point(&p, end, tok->base_num, enc, TRUE, &code);
|
||||
if (r == 1) {
|
||||
@ -5422,12 +5436,12 @@ fetch_token(PToken* tok, UChar** src, UChar* end, ParseEnv* env)
|
||||
OnigSyntaxType* syn;
|
||||
UChar* p;
|
||||
|
||||
PFETCH_READY;
|
||||
|
||||
enc = env->enc;
|
||||
syn = env->syntax;
|
||||
p = *src;
|
||||
|
||||
PFETCH_READY;
|
||||
|
||||
if (tok->code_point_continue != 0) {
|
||||
r = get_next_code_point(&p, end, tok->base_num, enc, FALSE, &code);
|
||||
if (r == 1) {
|
||||
@ -7667,11 +7681,12 @@ prs_bag(Node** np, PToken* tok, int term, UChar** src, UChar* end,
|
||||
OnigOptionType option;
|
||||
OnigCodePoint c;
|
||||
int list_capture;
|
||||
OnigEncoding enc = env->enc;
|
||||
|
||||
UChar* p = *src;
|
||||
OnigEncoding enc;
|
||||
UChar* p;
|
||||
PFETCH_READY;
|
||||
|
||||
p = *src;
|
||||
enc = env->enc;
|
||||
*np = NULL;
|
||||
if (PEND) return ONIGERR_END_PATTERN_WITH_UNMATCHED_PARENTHESIS;
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#define VERSION_MAJOR 5
|
||||
#define VERSION_MINOR 21
|
||||
#define VERSION_REV 702
|
||||
#define VERSION_BUILD 2
|
||||
#define VERSION_BUILD 3
|
||||
#define SCINTILLA_VER 510
|
||||
#define LEXILLA_VER 502
|
||||
#define ONIGURUMA_REGEX_VER 7.0.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user