aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/parser.y
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-05-07 11:35:52 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-05-07 11:35:52 +0000
commit7660e2a0684e57c2f7f014a6f457b7866e2b9e22 (patch)
treec323afd85d97823f1dbf07b5f274897e232a592f /src/libexpr/parser.y
parent52a9ba96f53be0a36f8229a14126302c5de966a6 (diff)
* Remove a right recursion that causes the parser to barf on very long
lists. The comment about ATreverse requiring unbounded stack space was unfounded anyway.
Diffstat (limited to 'src/libexpr/parser.y')
-rw-r--r--src/libexpr/parser.y9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y
index 05ba52e68..4f09b80d8 100644
--- a/src/libexpr/parser.y
+++ b/src/libexpr/parser.y
@@ -311,7 +311,7 @@ expr_simple
{ $$ = fixAttrs(1, $3); }
| '{' binds '}'
{ $$ = fixAttrs(0, $2); }
- | '[' expr_list ']' { $$ = makeList($2); }
+ | '[' expr_list ']' { $$ = makeList(ATreverse($2)); }
;
string_parts
@@ -356,15 +356,12 @@ inheritsrc
ids: ids ID { $$ = ATinsert($1, $2); } | { $$ = ATempty; };
expr_list
- : expr_select expr_list { $$ = ATinsert($2, $1); }
- /* yes, this is right-recursive, but it doesn't matter since
- otherwise we would need ATreverse which requires unbounded
- stack space */
+ : expr_list expr_select { $$ = ATinsert($1, $2); }
| { $$ = ATempty; }
;
formals
- : formal ',' formals /* idem - right recursive */
+ : formal ',' formals /* !!! right recursive */
{ $$.formals = ATinsert($3.formals, $1); $$.ellipsis = $3.ellipsis; }
| formal
{ $$.formals = ATinsert(ATempty, $1); $$.ellipsis = false; }