* 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.
This commit is contained in:
Eelco Dolstra 2009-05-07 11:35:52 +00:00
parent 52a9ba96f5
commit 7660e2a068
1 changed files with 3 additions and 6 deletions

View File

@ -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; }