Fix bug such that the first pushed token's value and location are

sometimes overwritten (sometimes by %initial-action) before being used.
* data/push.c (yypush_parse): Rename arguments yynchar, yynlval, and
yynlloc to yypushed_char, yypushed_val, and yypushed_loc for clarity.
For the first yypush_parse invocation, initialize yychar to YYEMPTY to
more closely mimic the pull parser logic.
Don't copy the pushed token to yychar, yylval, and yylloc until it's
time to read a token, which is after any initialization of yylval and
yylloc.
(gottoken): Rename label to...
(yyread_pushed_token): ... for clarity and to avoid infringing on the
user namespace.
This commit is contained in:
Joel E. Denny
2006-12-20 06:46:20 +00:00
parent 9baf4d74a6
commit 8646b6a3fd
2 changed files with 48 additions and 32 deletions

View File

@@ -1,3 +1,18 @@
2006-12-20 Joel E. Denny <jdenny@ces.clemson.edu>
Fix bug such that the first pushed token's value and location are
sometimes overwritten (sometimes by %initial-action) before being used.
* data/push.c (yypush_parse): Rename arguments yynchar, yynlval, and
yynlloc to yypushed_char, yypushed_val, and yypushed_loc for clarity.
For the first yypush_parse invocation, initialize yychar to YYEMPTY to
more closely mimic the pull parser logic.
Don't copy the pushed token to yychar, yylval, and yylloc until it's
time to read a token, which is after any initialization of yylval and
yylloc.
(gottoken): Rename label to...
(yyread_pushed_token): ... for clarity and to avoid infringing on the
user namespace.
2006-12-20 Joel E. Denny <jdenny@ces.clemson.edu>
Rearrange initialization of the parser state variables so that the