From 5d20809edb4de7cf408453654097cfde8b11b00e Mon Sep 17 00:00:00 2001 From: K.Takata Date: Fri, 30 Dec 2011 22:06:05 +0900 Subject: [PATCH 1/2] add ONIG_SYN_POSIX_BRACKET_ALWAYS_ALL_RANGE option --- oniguruma.h | 1 + regparse.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/oniguruma.h b/oniguruma.h index 0b2f970..c17d13e 100644 --- a/oniguruma.h +++ b/oniguruma.h @@ -532,6 +532,7 @@ ONIG_EXTERN OnigSyntaxType* OnigDefaultSyntax; #define ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME_CALL (1U<<10) /* (?)(?)(?&x) */ /* syntax (behavior) in char class [...] */ +#define ONIG_SYN_POSIX_BRACKET_ALWAYS_ALL_RANGE (1U<<19) /* (?a) doesn't affect POSIX brackets */ #define ONIG_SYN_NOT_NEWLINE_IN_NEGATIVE_CC (1U<<20) /* [^...] */ #define ONIG_SYN_BACKSLASH_ESCAPE_IN_CC (1U<<21) /* [..\w..] etc.. */ #define ONIG_SYN_ALLOW_EMPTY_RANGE_IN_CC (1U<<22) diff --git a/regparse.c b/regparse.c index aca6596..d08e913 100644 --- a/regparse.c +++ b/regparse.c @@ -63,7 +63,8 @@ OnigSyntaxType OnigSyntaxRuby = { ONIG_SYN_ALLOW_MULTIPLEX_DEFINITION_NAME | ONIG_SYN_FIXED_INTERVAL_IS_GREEDY_ONLY | ONIG_SYN_WARN_CC_OP_NOT_ESCAPED | - ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT ) + ONIG_SYN_WARN_REDUNDANT_NESTED_REPEAT | + ONIG_SYN_POSIX_BRACKET_ALWAYS_ALL_RANGE ) , ONIG_OPTION_ASCII_RANGE , { @@ -4181,7 +4182,9 @@ parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env) if (onigenc_with_ascii_strncmp(enc, p, end, (UChar* )":]", 2) != 0) return ONIGERR_INVALID_POSIX_BRACKET_TYPE; - r = add_ctype_to_cc(cc, pb->ctype, not, 0, env); + r = add_ctype_to_cc(cc, pb->ctype, not, + IS_SYNTAX_BV(env->syntax, ONIG_SYN_POSIX_BRACKET_ALWAYS_ALL_RANGE), + env); if (r != 0) return r; PINC; PINC; -- 1.7.5.1