diff options
author | Zefram <zefram@fysh.org> | 2010-12-11 01:31:03 +0000 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2010-12-11 16:59:54 -0800 |
commit | 78cdf10786e359ee461137c8a18efb13ea76c331 (patch) | |
tree | c9510d0ed5c75f7aa97bbe780318c347318b5ce7 /perly.y | |
parent | 72aa120d9a32a14196c9e39aa26993909423f096 (diff) | |
download | perl-78cdf10786e359ee461137c8a18efb13ea76c331.tar.gz |
recursive-descent expression parsing
New API functions parse_fullexpr(), parse_listexpr(), parse_termexpr(),
and parse_arithexpr(), to parse an expression at various precedence
levels.
Diffstat (limited to 'perly.y')
-rw-r--r-- | perly.y | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -69,7 +69,7 @@ #endif } -%token <ival> GRAMPROG GRAMBLOCK GRAMBARESTMT GRAMFULLSTMT GRAMSTMTSEQ +%token <ival> GRAMPROG GRAMEXPR GRAMBLOCK GRAMBARESTMT GRAMFULLSTMT GRAMSTMTSEQ %token <i_tkval> '{' '}' '[' ']' '-' '+' '$' '@' '%' '*' '&' ';' @@ -148,6 +148,15 @@ grammar : GRAMPROG newPROG(block_end($3,$4)); $$ = 0; } + | GRAMEXPR + { + parser->expect = XTERM; + } + listexprcom + { + PL_eval_root = $3; + $$ = 0; + } | GRAMBLOCK { parser->expect = XBLOCK; |