summaryrefslogtreecommitdiff
path: root/perly.y
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-12-11 01:31:03 +0000
committerFather Chrysostomos <sprout@cpan.org>2010-12-11 16:59:54 -0800
commit78cdf10786e359ee461137c8a18efb13ea76c331 (patch)
treec9510d0ed5c75f7aa97bbe780318c347318b5ce7 /perly.y
parent72aa120d9a32a14196c9e39aa26993909423f096 (diff)
downloadperl-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.y11
1 files changed, 10 insertions, 1 deletions
diff --git a/perly.y b/perly.y
index bf51922145..ab146274ed 100644
--- a/perly.y
+++ b/perly.y
@@ -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;