diff options
author | Karl Williamson <public@khwilliamson.com> | 2010-12-28 16:13:49 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2011-01-16 19:13:25 -0700 |
commit | 63ac0dadb1aafcf0c171d3c1422c1923b611b2fc (patch) | |
tree | e6739a7dccd9be2b3b192d6e99042702fc4f9440 /regcomp.c | |
parent | 7259d778cc13ce118e31fad7e1b91f23fc1b8e97 (diff) | |
download | perl-63ac0dadb1aafcf0c171d3c1422c1923b611b2fc.tar.gz |
regex: Use BOUNDU regnodes
This refactors one area in regexec.c to use BOUNDU, NBOUNDU for
efficiciency, and easier adding of the future BOUNDA.
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 34 |
1 files changed, 26 insertions, 8 deletions
@@ -7399,22 +7399,40 @@ tryagain: case 'b': RExC_seen_zerolen++; RExC_seen |= REG_SEEN_LOOKBEHIND; - if (LOC) { - ret = reg_node(pRExC_state, (U8)(BOUNDL)); - } else { - ret = reg_node(pRExC_state, (U8)(BOUND)); + switch (get_regex_charset(RExC_flags)) { + case REGEX_LOCALE_CHARSET: + op = BOUNDL; + break; + case REGEX_UNICODE_CHARSET: + op = BOUNDU; + break; + case REGEX_DEPENDS_CHARSET: + op = BOUND; + break; + default: + goto bad_charset; } + ret = reg_node(pRExC_state, op); FLAGS(ret) = get_regex_charset(RExC_flags); *flagp |= SIMPLE; goto finish_meta_pat; case 'B': RExC_seen_zerolen++; RExC_seen |= REG_SEEN_LOOKBEHIND; - if (LOC) { - ret = reg_node(pRExC_state, (U8)(NBOUNDL)); - } else { - ret = reg_node(pRExC_state, (U8)(NBOUND)); + switch (get_regex_charset(RExC_flags)) { + case REGEX_LOCALE_CHARSET: + op = NBOUNDL; + break; + case REGEX_UNICODE_CHARSET: + op = NBOUNDU; + break; + case REGEX_DEPENDS_CHARSET: + op = NBOUND; + break; + default: + goto bad_charset; } + ret = reg_node(pRExC_state, op); FLAGS(ret) = get_regex_charset(RExC_flags); *flagp |= SIMPLE; goto finish_meta_pat; |