diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-29 20:05:24 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-29 20:05:24 +0000 |
commit | ab13f0c73a71a1ea41c4bdcd1f78f8b903cc458c (patch) | |
tree | 9671965b883a22f439da320a0724a8f40d5a5ff9 /regcomp.c | |
parent | 2d6b165414a36b2f7babc9ffdf83d659589dd9eb (diff) | |
download | perl-ab13f0c73a71a1ea41c4bdcd1f78f8b903cc458c.tar.gz |
More leniency to the \p and \P: now can have whitespace
between the property definition and the curlies; now can
invert the property by having a caret between the open
curly and the property.
p4raw-id: //depot/perl@12269
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -3423,20 +3423,35 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state) if (*RExC_parse == '{') { e = strchr(RExC_parse++, '}'); if (!e) - vFAIL("Missing right brace on \\p{}"); + vFAIL2("Missing right brace on \\%c{}", value); + while (isSPACE(UCHARAT(RExC_parse))) + RExC_parse++; + if (e == RExC_parse) + vFAIL2("Empty \\%c{}", value); n = e - RExC_parse; + while (isSPACE(UCHARAT(RExC_parse + n - 1))) + n--; } else { e = RExC_parse; n = 1; } if (!SIZE_ONLY) { + if (UCHARAT(RExC_parse) == '^') { + RExC_parse++; + n--; + value = value == 'p' ? 'P' : 'p'; /* toggle */ + while (isSPACE(UCHARAT(RExC_parse))) { + RExC_parse++; + n--; + } + } if (value == 'p') - Perl_sv_catpvf(aTHX_ listsv, - "+utf8::%.*s\n", (int)n, RExC_parse); + Perl_sv_catpvf(aTHX_ listsv, + "+utf8::%.*s\n", (int)n, RExC_parse); else - Perl_sv_catpvf(aTHX_ listsv, - "!utf8::%.*s\n", (int)n, RExC_parse); + Perl_sv_catpvf(aTHX_ listsv, + "!utf8::%.*s\n", (int)n, RExC_parse); } RExC_parse = e + 1; ANYOF_FLAGS(ret) |= ANYOF_UNICODE; |