This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
toke.c: One less token for missing format args
authorFather Chrysostomos <sprout@cpan.org>
Thu, 9 Aug 2012 05:49:17 +0000 (22:49 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 10 Aug 2012 20:32:27 +0000 (13:32 -0700)
commit96f9b7829bf7acfe4d793430f9fd6ca003f6d481
tree3b6c472e1d06759713fa19b952e3077e90db6512
parent93a8ff62dea3b24a5cafff9474c37a38a367f2da
toke.c: One less token for missing format args

In commit 705fe0e5f8a, when I made the parser understand format syntax
itself, I had to add special handling for a terminating dot where for-
mat arguments were expected:

format =
@
.

The parser expects every format argument line to look like this:

formarg : /* NULL */
{ $$ = NULL; }
| FORMLBRACK stmtseq FORMRBRACK
{ $$ = op_unscope($2); }
;

When the line break is encountered after the @, the FORMLBRACK token
is emitted, and the lexer switches into â€˜normal’ (as opposed to for-
mat picture) mode.  When the final dot is encountered, since the
FORMLBRACK has already been emitted, the lexer has to conjure up a
FORMRBRACK as well, to avoid a syntax error.

I had it producing a semicolon before the FORMRBRACK, but that is not
necessary, because stmtseq can be null.  So this commit removes it.
toke.c