This reverts commit
504858073fe16afb61d66a8b6748851780e51432, which
was made under the erroneous belief that certain code was unreachable.
This code appears to be reachable, however, only if the input has
a 2-character lexical token split by space or a comment. The token
should be indivisible, and was accepted only through an accident of
implementation. A later commit will deprecate splitting it, with the
view of eventually making splitting it a fatal error. In the meantime,
though, this reverts to the original behavior, and adds a (temporary)
test to verify that.
case '@': /* (?@...) */
vFAIL2("Sequence (?%c...) not implemented", (int)paren);
break;
+ case '#': /* (?#...) */
+ /* XXX As soon as we disallow separating the '?' and '*' (by
+ * spaces or (?#...) comment), it is believed that this case
+ * will be unreachable and can be removed. See
+ * [perl #117327] */
+ while (*RExC_parse && *RExC_parse != ')')
+ RExC_parse++;
+ if (*RExC_parse != ')')
+ FAIL("Sequence (?#... not terminated");
+ nextchar(pRExC_state);
+ *flagp = TRYAGAIN;
+ return NULL;
case '0' : /* (?0) */
case 'R' : /* (?R) */
if (*RExC_parse != ')')
require './test.pl';
}
-plan tests => 466; # Update this when adding/deleting tests.
+plan tests => 467; # Update this when adding/deleting tests.
run_tests() unless caller;
ok("Perl" =~ /P.*$/i, '#116148');
}
+ { # 117327: Sequence (?#...) not recognized in regex
+ # The space between the '(' and '?' is now deprecated; this test should
+ # be removed when the deprecation is made fatal.
+ no warnings;
+ like("ab", qr/a( ?#foo)b/x);
+ }
+
} # End of sub run_tests