mirror of
https://github.com/rizonesoft/Notepad3.git
synced 2026-06-11 21:03:05 +08:00
+ upd: Oniguruma Current Dev (88043418a6507c453648ba8c60e86f74295b59fa)
This commit is contained in:
parent
ae3d5c5838
commit
7d340be6e2
65
scintilla/oniguruma/doc/CHANGES_7.0
Normal file
65
scintilla/oniguruma/doc/CHANGES_7.0
Normal file
@ -0,0 +1,65 @@
|
||||
CHANGES_7.0 2021/05/17
|
||||
|
||||
The changes from 6.9 to 7.0 are shown below.
|
||||
|
||||
* Already changed
|
||||
|
||||
+ Defined the OnigPos type (== ptrdiff_t).
|
||||
|
||||
+ Changed the return value of onig_search(), onig_search_with_param(), onig_match() and onig_match_with_param() from int to OnigPos.
|
||||
|
||||
+ Changed the argument value of onig_regset_search(), onig_regset_search_with_param() and onig_error_code_to_str() from int to OnigPos.
|
||||
|
||||
+ POSIX API: Changed the regoff_t type from int to OnigPos
|
||||
|
||||
+ Move the definition of OnigEncodingType structure from oniguruma.h to regenc.h
|
||||
|
||||
+ Removed from oniguruma.h
|
||||
ONIGENC_IS_MBC_WORD_ASCII()
|
||||
ONIGENC_MBC_CASE_FOLD()
|
||||
ONIGENC_LEFT_ADJUST_CHAR_HEAD()
|
||||
ONIGENC_IS_VALID_MBC_STRING()
|
||||
ONIGENC_APPLY_ALL_CASE_FOLD()
|
||||
ONIGENC_GET_CASE_FOLD_CODES_BY_STR()
|
||||
ONIGENC_STEP_BACK()
|
||||
ONIGENC_MBC_ENC_LEN()
|
||||
ONIGENC_MBC_MAXLEN_DIST()
|
||||
ONIGENC_PROPERTY_NAME_TO_CTYPE()
|
||||
ONIGENC_GET_CTYPE_CODE_RANGE()
|
||||
|
||||
+ change macro to function in oniguruma.h
|
||||
onig_enc_len() -> onig_enc_len()
|
||||
ONIGENC_IS_UNDEF() -> onigenc_is_undef()
|
||||
ONIGENC_IS_SINGLEBYTE() -> onigenc_is_singlebyte()
|
||||
ONIGENC_IS_MBC_HEAD() -> onigenc_is_mbc_head()
|
||||
ONIGENC_IS_MBC_ASCII() -> onigenc_is_mbc_ascii()
|
||||
ONIGENC_IS_CODE_ASCII() -> onigenc_is_code_ascii()
|
||||
ONIGENC_IS_MBC_WORD() -> onigenc_is_mbc_word()
|
||||
ONIGENC_NAME() -> onigenc_name()
|
||||
ONIGENC_IS_ALLOWED_REVERSE_MATCH() -> onigenc_is_allowed_reverse_match()
|
||||
ONIGENC_MBC_MAXLEN() -> onigenc_mbc_maxlen()
|
||||
ONIGENC_MBC_MINLEN() -> onigenc_mbc_minlen()
|
||||
ONIGENC_IS_MBC_NEWLINE() -> onigenc_is_mbc_newline()
|
||||
ONIGENC_MBC_TO_CODE() -> onigenc_mbc_to_code()
|
||||
ONIGENC_CODE_TO_MBCLEN() -> onigenc_code_to_mbclen()
|
||||
ONIGENC_CODE_TO_MBC() -> onigenc_code_to_mbc()
|
||||
ONIGENC_IS_CODE_CTYPE() -> onigenc_is_code_ctype()
|
||||
|
||||
|
||||
* 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
|
||||
|
||||
|
||||
* To Be Determined
|
||||
|
||||
+ Remove UChar from the oniguruma.h
|
||||
+ Disable Capture History (?@..) by default. (USE_CAPTURE_HISTORY)
|
||||
+ Disable Callout (*name..) (?{...}) by default. (USE_CALLOUT)
|
||||
|
||||
|
||||
//END
|
||||
@ -133,30 +133,9 @@ typedef struct {
|
||||
|
||||
typedef int (*OnigApplyAllCaseFoldFunc)(OnigCodePoint from, OnigCodePoint* to, int to_len, void* arg);
|
||||
|
||||
typedef struct OnigEncodingTypeST {
|
||||
int (*mbc_enc_len)(const OnigUChar* p);
|
||||
const char* name;
|
||||
int max_enc_len;
|
||||
int min_enc_len;
|
||||
int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end);
|
||||
OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end);
|
||||
int (*code_to_mbclen)(OnigCodePoint code);
|
||||
int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf);
|
||||
int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to);
|
||||
int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg);
|
||||
int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[]);
|
||||
int (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end);
|
||||
int (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype);
|
||||
int (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]);
|
||||
OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p);
|
||||
int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end);
|
||||
int (*init)(void);
|
||||
int (*is_initialized)(void);
|
||||
int (*is_valid_mbc_string)(const OnigUChar* s, const OnigUChar* end);
|
||||
unsigned int flag;
|
||||
OnigCodePoint sb_range;
|
||||
int index;
|
||||
} OnigEncodingType;
|
||||
struct OnigEncodingTypeST;
|
||||
|
||||
typedef struct OnigEncodingTypeST OnigEncodingType;
|
||||
|
||||
typedef OnigEncodingType* OnigEncoding;
|
||||
|
||||
@ -266,84 +245,70 @@ typedef enum {
|
||||
|
||||
#define ONIGENC_MAX_STD_CTYPE ONIGENC_CTYPE_ASCII
|
||||
|
||||
|
||||
#define onig_enc_len(enc,p,end) ONIGENC_MBC_ENC_LEN(enc,p)
|
||||
|
||||
#define ONIGENC_IS_UNDEF(enc) ((enc) == ONIG_ENCODING_UNDEF)
|
||||
#define ONIGENC_IS_SINGLEBYTE(enc) (ONIGENC_MBC_MAXLEN(enc) == 1)
|
||||
#define ONIGENC_IS_MBC_HEAD(enc,p) (ONIGENC_MBC_ENC_LEN(enc,p) != 1)
|
||||
#define ONIGENC_IS_MBC_ASCII(p) (*(p) < 128)
|
||||
#define ONIGENC_IS_CODE_ASCII(code) ((code) < 128)
|
||||
#define ONIGENC_IS_MBC_WORD(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_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
|
||||
(enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf)
|
||||
#define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \
|
||||
(enc)->is_allowed_reverse_match(s,end)
|
||||
#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s) \
|
||||
(enc)->left_adjust_char_head(start, s)
|
||||
#define ONIGENC_IS_VALID_MBC_STRING(enc,s,end) \
|
||||
(enc)->is_valid_mbc_string(s,end)
|
||||
#define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \
|
||||
(enc)->apply_all_case_fold(case_fold_flag,f,arg)
|
||||
#define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \
|
||||
(enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs)
|
||||
#define ONIGENC_STEP_BACK(enc,start,s,n) \
|
||||
onigenc_step_back((enc),(start),(s),(n))
|
||||
|
||||
#define ONIGENC_MBC_ENC_LEN(enc,p) (enc)->mbc_enc_len(p)
|
||||
#define ONIGENC_MBC_MAXLEN(enc) ((enc)->max_enc_len)
|
||||
#define ONIGENC_MBC_MAXLEN_DIST(enc) ONIGENC_MBC_MAXLEN(enc)
|
||||
#define ONIGENC_MBC_MINLEN(enc) ((enc)->min_enc_len)
|
||||
#define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end))
|
||||
#define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end))
|
||||
#define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code)
|
||||
#define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf)
|
||||
#define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \
|
||||
(enc)->property_name_to_ctype(enc,p,end)
|
||||
|
||||
#define ONIGENC_IS_CODE_CTYPE(enc,code,ctype) (enc)->is_code_ctype(code,ctype)
|
||||
|
||||
#define ONIGENC_IS_CODE_NEWLINE(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_NEWLINE)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_NEWLINE)
|
||||
#define ONIGENC_IS_CODE_GRAPH(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_GRAPH)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_GRAPH)
|
||||
#define ONIGENC_IS_CODE_PRINT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PRINT)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_PRINT)
|
||||
#define ONIGENC_IS_CODE_ALNUM(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALNUM)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_ALNUM)
|
||||
#define ONIGENC_IS_CODE_ALPHA(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_ALPHA)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_ALPHA)
|
||||
#define ONIGENC_IS_CODE_LOWER(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_LOWER)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_LOWER)
|
||||
#define ONIGENC_IS_CODE_UPPER(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_UPPER)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_UPPER)
|
||||
#define ONIGENC_IS_CODE_CNTRL(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_CNTRL)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_CNTRL)
|
||||
#define ONIGENC_IS_CODE_PUNCT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_PUNCT)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_PUNCT)
|
||||
#define ONIGENC_IS_CODE_SPACE(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_SPACE)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_SPACE)
|
||||
#define ONIGENC_IS_CODE_BLANK(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_BLANK)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_BLANK)
|
||||
#define ONIGENC_IS_CODE_DIGIT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_DIGIT)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_DIGIT)
|
||||
#define ONIGENC_IS_CODE_XDIGIT(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_XDIGIT)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_XDIGIT)
|
||||
#define ONIGENC_IS_CODE_WORD(enc,code) \
|
||||
ONIGENC_IS_CODE_CTYPE(enc,code,ONIGENC_CTYPE_WORD)
|
||||
|
||||
#define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \
|
||||
(enc)->get_ctype_code_range(ctype,sbout,ranges)
|
||||
onigenc_is_code_ctype(enc,code,ONIGENC_CTYPE_WORD)
|
||||
|
||||
ONIG_EXTERN
|
||||
int onig_enc_len P_((OnigEncoding enc, const OnigUChar* p, const OnigUChar* end));
|
||||
ONIG_EXTERN
|
||||
int onigenc_is_undef P_((OnigEncoding enc));
|
||||
ONIG_EXTERN
|
||||
int onigenc_is_singlebyte P_((OnigEncoding enc));
|
||||
ONIG_EXTERN
|
||||
int onigenc_is_mbc_head P_((OnigEncoding enc, OnigUChar* p));
|
||||
ONIG_EXTERN
|
||||
int onigenc_is_mbc_ascii P_((OnigUChar* p));
|
||||
ONIG_EXTERN
|
||||
int onigenc_is_code_ascii P_((OnigCodePoint code));
|
||||
ONIG_EXTERN
|
||||
int onigenc_is_mbc_word P_((OnigEncoding enc, OnigUChar* s, OnigUChar* end));
|
||||
ONIG_EXTERN
|
||||
const char* onigenc_name P_((OnigEncoding enc));
|
||||
ONIG_EXTERN
|
||||
int onigenc_is_allowed_reverse_match P_((OnigEncoding enc, OnigUChar* s, OnigUChar* end));
|
||||
ONIG_EXTERN
|
||||
int onigenc_mbc_maxlen P_((OnigEncoding enc));
|
||||
ONIG_EXTERN
|
||||
int onigenc_mbc_minlen P_((OnigEncoding enc));
|
||||
ONIG_EXTERN
|
||||
int onigenc_is_mbc_newline P_((OnigEncoding enc, OnigUChar* p, OnigUChar* end));
|
||||
ONIG_EXTERN
|
||||
OnigCodePoint onigenc_mbc_to_code P_((OnigEncoding enc, OnigUChar* p, OnigUChar* end));
|
||||
ONIG_EXTERN
|
||||
int onigenc_code_to_mbclen P_((OnigEncoding enc, OnigCodePoint code));
|
||||
ONIG_EXTERN
|
||||
int onigenc_code_to_mbc P_((OnigEncoding enc, OnigCodePoint code, OnigUChar buf[]));
|
||||
ONIG_EXTERN
|
||||
int onigenc_is_code_ctype P_((OnigEncoding enc, OnigCodePoint code, int ctype));
|
||||
ONIG_EXTERN
|
||||
OnigUChar* onigenc_step_back P_((OnigEncoding enc, const OnigUChar* start, const OnigUChar* s, int n));
|
||||
|
||||
|
||||
/* encoding API */
|
||||
ONIG_EXTERN
|
||||
int onigenc_init P_((void));
|
||||
|
||||
@ -6468,7 +6468,7 @@ node_max_byte_len(Node* node, ParseEnv* env)
|
||||
|
||||
case NODE_CTYPE:
|
||||
case NODE_CCLASS:
|
||||
len = ONIGENC_MBC_MAXLEN_DIST(env->enc);
|
||||
len = ONIGENC_MBC_MAXLEN(env->enc);
|
||||
break;
|
||||
|
||||
case NODE_BACKREF:
|
||||
@ -6640,7 +6640,7 @@ optimize_nodes(Node* node, OptNode* opt, OptEnv* env)
|
||||
|
||||
if (IS_NOT_NULL(cc->mbuf) || IS_NCCLASS_NOT(cc)) {
|
||||
OnigLen min = ONIGENC_MBC_MINLEN(enc);
|
||||
OnigLen max = ONIGENC_MBC_MAXLEN_DIST(enc);
|
||||
OnigLen max = ONIGENC_MBC_MAXLEN(enc);
|
||||
|
||||
mml_set_min_max(&opt->len, min, max);
|
||||
}
|
||||
@ -6661,7 +6661,7 @@ optimize_nodes(Node* node, OptNode* opt, OptEnv* env)
|
||||
int min, max;
|
||||
int range;
|
||||
|
||||
max = ONIGENC_MBC_MAXLEN_DIST(enc);
|
||||
max = ONIGENC_MBC_MAXLEN(enc);
|
||||
|
||||
if (max == 1) {
|
||||
min = 1;
|
||||
@ -7218,7 +7218,7 @@ print_optimize_info(FILE* f, regex_t* reg)
|
||||
ONIGENC_IS_CODE_PRINT(reg->enc, (OnigCodePoint )i))
|
||||
fputc(i, f);
|
||||
else
|
||||
fprintf(f, "%d", i);
|
||||
fprintf(f, "0x%02x", i);
|
||||
}
|
||||
}
|
||||
fprintf(f, "]\n");
|
||||
@ -8165,9 +8165,22 @@ onig_detect_can_be_slow_pattern(const UChar* pattern,
|
||||
+ count.backref + count.backref_with_level + count.call
|
||||
+ count.anychar_reluctant_many;
|
||||
if (count.heavy_element != 0)
|
||||
n += count.heavy_element * 10;
|
||||
n += count.heavy_element << 8;
|
||||
|
||||
r = n;
|
||||
|
||||
#ifdef ONIG_DEBUG_PARSE
|
||||
fprintf(DBGFP, "-- detect can be slow --\n");
|
||||
fprintf(DBGFP, " prec_read: %d\n", count.prec_read);
|
||||
fprintf(DBGFP, " look_behind: %d\n", count.look_behind);
|
||||
fprintf(DBGFP, " backref: %d\n", count.backref);
|
||||
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, " heavy_element: %d\n", count.heavy_element);
|
||||
fprintf(DBGFP, " r: %d\n", r);
|
||||
fprintf(DBGFP, "\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (IS_NOT_NULL(scan_env.mem_env_dynamic))
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
regenc.c - 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
|
||||
@ -132,6 +132,108 @@ onig_initialize_encoding(OnigEncoding enc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int
|
||||
onig_enc_len(OnigEncoding enc, const UChar* p, const UChar* end)
|
||||
{
|
||||
return ONIGENC_MBC_ENC_LEN(enc, p);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_undef(OnigEncoding enc)
|
||||
{
|
||||
return ONIGENC_IS_UNDEF(enc);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_singlebyte(OnigEncoding enc)
|
||||
{
|
||||
return ONIGENC_IS_SINGLEBYTE(enc);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_mbc_head(OnigEncoding enc, UChar* p)
|
||||
{
|
||||
return ONIGENC_IS_MBC_HEAD(enc, p);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_mbc_ascii(UChar* p)
|
||||
{
|
||||
return ONIGENC_IS_MBC_ASCII(p);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_code_ascii(OnigCodePoint code)
|
||||
{
|
||||
return ONIGENC_IS_CODE_ASCII(code);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_mbc_word(OnigEncoding enc, UChar* s, UChar* end)
|
||||
{
|
||||
return ONIGENC_IS_MBC_WORD(enc, s, end);
|
||||
}
|
||||
|
||||
extern const char*
|
||||
onigenc_name(OnigEncoding enc)
|
||||
{
|
||||
return ONIGENC_NAME(enc);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_allowed_reverse_match(OnigEncoding enc, UChar* s, UChar* end)
|
||||
{
|
||||
return ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc, s, end);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_mbc_maxlen(OnigEncoding enc)
|
||||
{
|
||||
return ONIGENC_MBC_MAXLEN(enc);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_mbc_minlen(OnigEncoding enc)
|
||||
{
|
||||
return ONIGENC_MBC_MINLEN(enc);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_mbc_newline(OnigEncoding enc, UChar* p, UChar* end)
|
||||
{
|
||||
return ONIGENC_IS_MBC_NEWLINE(enc, p, end);
|
||||
}
|
||||
|
||||
extern OnigCodePoint
|
||||
onigenc_mbc_to_code(OnigEncoding enc, UChar* p, UChar* end)
|
||||
{
|
||||
return ONIGENC_MBC_TO_CODE(enc, p, end);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_code_to_mbclen(OnigEncoding enc, OnigCodePoint code)
|
||||
{
|
||||
return ONIGENC_CODE_TO_MBCLEN(enc, code);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_code_to_mbc(OnigEncoding enc, OnigCodePoint code, UChar buf[])
|
||||
{
|
||||
return ONIGENC_CODE_TO_MBC(enc, code, buf);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
|
||||
{
|
||||
return ONIGENC_PROPERTY_NAME_TO_CTYPE(enc, p, end);
|
||||
}
|
||||
|
||||
extern int
|
||||
onigenc_is_code_ctype(OnigEncoding enc, OnigCodePoint code, int ctype)
|
||||
{
|
||||
return ONIGENC_IS_CODE_CTYPE(enc, code, ctype);
|
||||
}
|
||||
|
||||
extern OnigEncoding
|
||||
onigenc_get_default_encoding(void)
|
||||
{
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
regenc.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
|
||||
@ -149,6 +149,69 @@ struct PropertyNameCtype {
|
||||
#define CASE_FOLD_IS_NOT_ASCII_ONLY(flag) \
|
||||
(((flag) & ONIGENC_CASE_FOLD_ASCII_ONLY) == 0)
|
||||
|
||||
|
||||
typedef struct OnigEncodingTypeST {
|
||||
int (*mbc_enc_len)(const OnigUChar* p);
|
||||
const char* name;
|
||||
int max_enc_len;
|
||||
int min_enc_len;
|
||||
int (*is_mbc_newline)(const OnigUChar* p, const OnigUChar* end);
|
||||
OnigCodePoint (*mbc_to_code)(const OnigUChar* p, const OnigUChar* end);
|
||||
int (*code_to_mbclen)(OnigCodePoint code);
|
||||
int (*code_to_mbc)(OnigCodePoint code, OnigUChar *buf);
|
||||
int (*mbc_case_fold)(OnigCaseFoldType flag, const OnigUChar** pp, const OnigUChar* end, OnigUChar* to);
|
||||
int (*apply_all_case_fold)(OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg);
|
||||
int (*get_case_fold_codes_by_str)(OnigCaseFoldType flag, const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem acs[]);
|
||||
int (*property_name_to_ctype)(struct OnigEncodingTypeST* enc, OnigUChar* p, OnigUChar* end);
|
||||
int (*is_code_ctype)(OnigCodePoint code, OnigCtype ctype);
|
||||
int (*get_ctype_code_range)(OnigCtype ctype, OnigCodePoint* sb_out, const OnigCodePoint* ranges[]);
|
||||
OnigUChar* (*left_adjust_char_head)(const OnigUChar* start, const OnigUChar* p);
|
||||
int (*is_allowed_reverse_match)(const OnigUChar* p, const OnigUChar* end);
|
||||
int (*init)(void);
|
||||
int (*is_initialized)(void);
|
||||
int (*is_valid_mbc_string)(const OnigUChar* s, const OnigUChar* end);
|
||||
unsigned int flag;
|
||||
OnigCodePoint sb_range;
|
||||
int index;
|
||||
} OnigEncodingType;
|
||||
|
||||
#define ONIGENC_IS_UNDEF(enc) ((enc) == ONIG_ENCODING_UNDEF)
|
||||
#define ONIGENC_IS_SINGLEBYTE(enc) (ONIGENC_MBC_MAXLEN(enc) == 1)
|
||||
#define ONIGENC_IS_MBC_HEAD(enc,p) (ONIGENC_MBC_ENC_LEN(enc,p) != 1)
|
||||
#define ONIGENC_IS_MBC_ASCII(p) (*(p) < 128)
|
||||
#define ONIGENC_IS_CODE_ASCII(code) ((code) < 128)
|
||||
#define ONIGENC_IS_MBC_WORD(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_MBC_CASE_FOLD(enc,flag,pp,end,buf) \
|
||||
(enc)->mbc_case_fold(flag,(const OnigUChar** )pp,end,buf)
|
||||
#define ONIGENC_IS_ALLOWED_REVERSE_MATCH(enc,s,end) \
|
||||
(enc)->is_allowed_reverse_match(s,end)
|
||||
#define ONIGENC_LEFT_ADJUST_CHAR_HEAD(enc,start,s) \
|
||||
(enc)->left_adjust_char_head(start, s)
|
||||
#define ONIGENC_IS_VALID_MBC_STRING(enc,s,end) \
|
||||
(enc)->is_valid_mbc_string(s,end)
|
||||
#define ONIGENC_APPLY_ALL_CASE_FOLD(enc,case_fold_flag,f,arg) \
|
||||
(enc)->apply_all_case_fold(case_fold_flag,f,arg)
|
||||
#define ONIGENC_GET_CASE_FOLD_CODES_BY_STR(enc,case_fold_flag,p,end,acs) \
|
||||
(enc)->get_case_fold_codes_by_str(case_fold_flag,p,end,acs)
|
||||
#define ONIGENC_STEP_BACK(enc,start,s,n) \
|
||||
onigenc_step_back((enc),(start),(s),(n))
|
||||
#define ONIGENC_MBC_ENC_LEN(enc,p) (enc)->mbc_enc_len(p)
|
||||
#define ONIGENC_MBC_MAXLEN(enc) ((enc)->max_enc_len)
|
||||
#define ONIGENC_MBC_MINLEN(enc) ((enc)->min_enc_len)
|
||||
#define ONIGENC_IS_MBC_NEWLINE(enc,p,end) (enc)->is_mbc_newline((p),(end))
|
||||
#define ONIGENC_MBC_TO_CODE(enc,p,end) (enc)->mbc_to_code((p),(end))
|
||||
#define ONIGENC_CODE_TO_MBCLEN(enc,code) (enc)->code_to_mbclen(code)
|
||||
#define ONIGENC_CODE_TO_MBC(enc,code,buf) (enc)->code_to_mbc(code,buf)
|
||||
#define ONIGENC_PROPERTY_NAME_TO_CTYPE(enc,p,end) \
|
||||
(enc)->property_name_to_ctype(enc,p,end)
|
||||
#define ONIGENC_IS_CODE_CTYPE(enc,code,ctype) (enc)->is_code_ctype(code,ctype)
|
||||
#define ONIGENC_GET_CTYPE_CODE_RANGE(enc,ctype,sbout,ranges) \
|
||||
(enc)->get_ctype_code_range(ctype,sbout,ranges)
|
||||
|
||||
|
||||
/* for encoding system implementation (internal) */
|
||||
extern int onigenc_end(void);
|
||||
extern int onigenc_ascii_apply_all_case_fold P_((OnigCaseFoldType flag, OnigApplyAllCaseFoldFunc f, void* arg));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user