summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-09-29 20:05:24 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-29 20:05:24 +0000
commitab13f0c73a71a1ea41c4bdcd1f78f8b903cc458c (patch)
tree9671965b883a22f439da320a0724a8f40d5a5ff9 /regcomp.c
parent2d6b165414a36b2f7babc9ffdf83d659589dd9eb (diff)
downloadperl-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.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/regcomp.c b/regcomp.c
index 4455730ed9..dda273d7bd 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -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;