This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #128171] Fix assert fail with /@0{0*->@*/*0
If a syntax error such as * (multiply) followed by an arrow causes the
parser to pop scopes in trying to recover from the error, it might
exit the quote-parsing scope (for parsing the regexp) and point the
lexer’s cursor at the code following the regexp, after the lexer has
noted to itself that it is expected to parse a postfix dereference
(PL_expect==XPOSTDEREF).
The code for parsing a postfix dereference has an assertion which
ends up failing in this case, because the *0 following the regexp,
having sigil that can come after an arrow, goes through the postfix
deref function, which complains about the 0 it did not expect.
If we simply remove the assertion, the lexer will continue to emit
tokens, and we just end up dying (somewhat) gracefully because of the
syntax error, instead of crashing.
I used a ] in the test instead of a final 0, to avoid a compile-
time warning. (Number found where operator expected.)