* 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

View file

@ -311,7 +311,7 @@ expr_simple
{ $$ = fixAttrs(1, $3); } { $$ = fixAttrs(1, $3); }
| '{' binds '}' | '{' binds '}'
{ $$ = fixAttrs(0, $2); } { $$ = fixAttrs(0, $2); }
| '[' expr_list ']' { $$ = makeList($2); } | '[' expr_list ']' { $$ = makeList(ATreverse($2)); }
; ;
string_parts string_parts
@ -356,15 +356,12 @@ inheritsrc
ids: ids ID { $$ = ATinsert($1, $2); } | { $$ = ATempty; }; ids: ids ID { $$ = ATinsert($1, $2); } | { $$ = ATempty; };
expr_list expr_list
: expr_select expr_list { $$ = ATinsert($2, $1); } : expr_list expr_select { $$ = ATinsert($1, $2); }
/* yes, this is right-recursive, but it doesn't matter since
otherwise we would need ATreverse which requires unbounded
stack space */
| { $$ = ATempty; } | { $$ = ATempty; }
; ;
formals formals
: formal ',' formals /* idem - right recursive */ : formal ',' formals /* !!! right recursive */
{ $$.formals = ATinsert($3.formals, $1); $$.ellipsis = $3.ellipsis; } { $$.formals = ATinsert($3.formals, $1); $$.ellipsis = $3.ellipsis; }
| formal | formal
{ $$.formals = ATinsert(ATempty, $1); $$.ellipsis = false; } { $$.formals = ATinsert(ATempty, $1); $$.ellipsis = false; }