summaryrefslogtreecommitdiff
path: root/perly.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-05 22:24:09 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-05 22:27:04 -0700
commit7c70caa5333de92b09e138154bed7f78f783be3b (patch)
tree139644b1427743e4e1bafba7b92ff99b9c7c5521 /perly.h
parentc77244152327e2223e55144a463094790d835933 (diff)
downloadperl-7c70caa5333de92b09e138154bed7f78f783be3b.tar.gz
Forbid braces as format delimiters
As long the argument line is not missing, braces can be used for a format: # valid format foo { @<<< $a } but if the argument line is missing, you get a syntax error: # invalid format foo { @<<< } and also if the name is missing: # invalid format { @<<< $a } If you use = then you can use a closing brace to terminate the format, but only if the argument line is missing: # valid, but useless format = @<<< } # invalid format = @<<< $a } In commit 79072805 (perl 5.0 alpha 20), the lexer was changed to lie to the parser about formats’ = and . delimiters, pretending they are actually { and }, because the bracket-handling code takes care of all the scoping issues (well, most of them). Unfortunately, this implementation detail can leak through, but it is far from consistent, as shown above. Fixing this makes it easier to fix other bugs. We do this by recording the fact that we are dealing with a format token before jumping to the bracket code. And we feed format-specific tokens to the parser in that case, so it can’t get fake brackets and real brackets mixed up.
Diffstat (limited to 'perly.h')
-rw-r--r--perly.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/perly.h b/perly.h
index b744567a04..edc9dc7e18 100644
--- a/perly.h
+++ b/perly.h
@@ -242,6 +242,6 @@ typedef union YYSTYPE
/* Generated from:
- * cb438129c218850b1de0e202e7ed0f84fbad4a28047160c86667ff00d8a878e3 perly.y
+ * c0743374d088d66f137508719cfbfb829d2ec6a195899c82274cc128b274022c perly.y
* 38f866dcd8341ad3c0810347587113eb2c6ac7d4f33bdab75b020efce92865be regen_perly.pl
* ex: set ro: */