From: K.Kosako Date: Fri, 29 Mar 2019 11:36:17 +0000 (+0900) Subject: {n,m}? (n > m) is not a reluctant quantifier X-Git-Tag: v6.9.2_rc1~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d582f92887e9ea5b99a1a28be1dc352e25d2e90a;p=onig {n,m}? (n > m) is not a reluctant quantifier --- diff --git a/src/regparse.c b/src/regparse.c index 37f180e..099f55d 100644 --- a/src/regparse.c +++ b/src/regparse.c @@ -4980,7 +4980,8 @@ fetch_token(PToken* tok, UChar** src, UChar* end, ScanEnv* env) tok->u.repeat.possessive = 0; greedy_check2: if (!PEND && PPEEK_IS('?') && - IS_SYNTAX_OP(syn, ONIG_SYN_OP_QMARK_NON_GREEDY)) { + IS_SYNTAX_OP(syn, ONIG_SYN_OP_QMARK_NON_GREEDY) && + tok->u.repeat.possessive == 0) { PFETCH(c); tok->u.repeat.greedy = 0; tok->u.repeat.possessive = 0; @@ -4992,7 +4993,8 @@ fetch_token(PToken* tok, UChar** src, UChar* end, ScanEnv* env) ((IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_PLUS_POSSESSIVE_REPEAT) && tok->type != TK_INTERVAL) || (IS_SYNTAX_OP2(syn, ONIG_SYN_OP2_PLUS_POSSESSIVE_INTERVAL) && - tok->type == TK_INTERVAL))) { + tok->type == TK_INTERVAL)) && + tok->u.repeat.possessive == 0) { PFETCH(c); tok->u.repeat.possessive = 1; }