diff options
author | Zefram <zefram@fysh.org> | 2010-10-15 13:11:54 +0100 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-10-21 05:54:01 -0700 |
commit | e53d8f768a2bcb331fe11ed5282d228a938ce161 (patch) | |
tree | 7a753652885308a61615a5e1c4caa4b7a67ca4b3 /perly.y | |
parent | 9eb5c532bf567fdd066254fcaacf4a66722714c5 (diff) | |
download | perl-e53d8f768a2bcb331fe11ed5282d228a938ce161.tar.gz |
function to parse Perl code block
New API function parse_block() parses a code block, including surrounding
braces. The block is a lexical scope, but not inherently a dynamic scope.
Diffstat (limited to 'perly.y')
-rw-r--r-- | perly.y | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -69,7 +69,7 @@ #endif } -%token <ival> GRAMPROG GRAMFULLSTMT GRAMSTMTSEQ +%token <ival> GRAMPROG GRAMBLOCK GRAMFULLSTMT GRAMSTMTSEQ %token <i_tkval> '{' '}' '[' ']' '-' '+' '$' '@' '%' '*' '&' ';' @@ -143,6 +143,17 @@ /* Top-level choice of what kind of thing yyparse was called to parse */ grammar : GRAMPROG prog { $$ = $2; } + | GRAMBLOCK + { + parser->expect = XBLOCK; + } + block + { + PL_eval_root = $3; + $$ = 0; + yyunlex(); + parser->yychar = YYEOF; + } | GRAMFULLSTMT { parser->expect = XSTATE; |