summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-04-10 14:59:41 -0600
committerKarl Williamson <public@khwilliamson.com>2011-04-10 15:11:37 -0600
commitff3f26d2308508ca78054f72cc6eb2819386898d (patch)
tree8dab59f298b519482823ae57fcf11e819e3e550c /toke.c
parentf580a93dfe4c980e326a70e8ab035562b0b6dbf7 (diff)
downloadperl-ff3f26d2308508ca78054f72cc6eb2819386898d.tar.gz
PATCH: partial [perl #86972]: Allow /aia
This allows a second /a modifier to not have to be contiguous with the first. This patch changes only the part in toke.c where the modifiers are in suffix form.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/toke.c b/toke.c
index f5f1f8ab2f..c4cda7b324 100644
--- a/toke.c
+++ b/toke.c
@@ -8877,17 +8877,21 @@ S_pmflag(pTHX_ const char* const valid_flags, U32 * pmfl, char** s, char* charse
if (*((*s) + 1) == 'n') {
goto deprecate;
}
- if (*((*s) + 1) == ASCII_RESTRICT_PAT_MOD) {
- /* Doubled modifier implies more restricted */
- set_regex_charset(pmfl, REGEX_ASCII_MORE_RESTRICTED_CHARSET);
- (*s)++;
- }
- else {
+
+ if (! *charset) {
set_regex_charset(pmfl, REGEX_ASCII_RESTRICTED_CHARSET);
}
- if (*charset) { /* Do this after the increment of *s in /aa, so
- the return advances the ptr correctly */
- goto multiple_charsets;
+ else {
+
+ /* Error if previous modifier wasn't an 'a', but if it was, see
+ * if, and accept, a second occurrence (only) */
+ if (*charset != 'a'
+ || get_regex_charset(*pmfl)
+ != REGEX_ASCII_RESTRICTED_CHARSET)
+ {
+ goto multiple_charsets;
+ }
+ set_regex_charset(pmfl, REGEX_ASCII_MORE_RESTRICTED_CHARSET);
}
*charset = c;
break;
@@ -8912,6 +8916,9 @@ S_pmflag(pTHX_ const char* const valid_flags, U32 * pmfl, char** s, char* charse
if (*charset != c) {
yyerror(Perl_form(aTHX_ "Regexp modifiers \"/%c\" and \"/%c\" are mutually exclusive", *charset, c));
}
+ else if (c == 'a') {
+ yyerror("Regexp modifier \"/a\" may appear a maximum of twice");
+ }
else {
yyerror(Perl_form(aTHX_ "Regexp modifier \"/%c\" may not appear twice", c));
}