* data/glr.c (YYERROR): Update definition.

(yyrecoverSyntaxError): Correct yyerrState logic. Correct comment.
Allow states with only a default reduction.

Fixes to avoid problem that $-N rules in GLR parsers can cause
buffer overruns, corrupting state.

* src/output.c (prepare_rules): Output max_left_semantic_context.
* src/reader.h (max_left_semantic_context): New
* src/scan-gram.l (max_left_semantic_context): Define.
(handle_action_dollar): Update max_left_semantic_context.
* data/glr.c (YYMAXLEFT): New.
(yydoAction): Increase yyrhsVals size.
(yyresolveAction): Ditto.

Fixes to problems with location handling in GLR parsers reported by
Frank Heckenbach (2003/06/05).

* data/glr.c (YYLTYPE): Make trivial if locations not used.
(YYRHSLOC): Add parentheses, make depend on whether locations used.
(YYLLOC_DEFAULT): Ditto.
(yyuserAction): Use YYLLOC_DEFAULT.
(yydoAction): Remove redundant code.

* tests/cxx-type.at: Exercise location information.
(yylex): Track locations.
(stmtMerge): Return value rather than printing.
This commit is contained in:
Paul Hilfinger
2003-06-10 02:44:58 +00:00
parent 144c1e767a
commit 25005f6ab0
6 changed files with 240 additions and 144 deletions

View File

@@ -1,3 +1,46 @@
2003-06-09 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
* data/glr.c (YYERROR): Update definition to reset yyerrState to 0
first.
(yyrecoverSyntaxError): Correct the logic for setting and testing
yyerrState.
Correct comment on handling EOF.
Allow states with only a default reduction, rather than failing
(I can't quite reconstruct why these were not allowed before).
Fixes to avoid problem that $-N rules in GLR parsers can cause
buffer overruns, corrupting state.
* src/output.c (prepare_rules): Output max_left_semantic_context
definition.
* src/reader.h (max_left_semantic_context): New variable declaration.
* src/scan-gram.l (max_left_semantic_context): Define.
(handle_action_dollar): Update max_left_semantic_context.
* data/glr.c (YYMAXLEFT): New definition.
(yydoAction): Increase size of yyrhsVals by YYMAXLEFT.
(yyresolveAction): Ditto.
Fixes to problems with location handling in GLR parsers reported by
Frank Heckenbach (2003/06/05).
* data/glr.c (YYLTYPE): Make trivial if locations not used.
(YYRHSLOC): Add parentheses, and define only if locations used.
(YYLLOC_DEFAULT): Add parentheses, and give trivial definition if
locations not used.
(yyuserAction): Use YYLLOC_DEFAULT to set *yylocp.
(yydoAction): Remove redundant initialization of *yyvalp and *yylocp.
* tests/cxx-type.at: Exercise location information; update tests
to differentiate output with and without locations.
Remove forward declarations of yylex and yyerror---caused errors
because default YYLTYPE not yet defined.
Change semantic actions to compute strings, rather than printing
them directly (to test proper passing of semantics values). Change
output to prefix notation and update test data and expected results.
(yylex): Track locations.
(stmtMerge): Return value rather than printing, and include arguments
in value.
2003-06-03 Paul Eggert <eggert@twinsun.com>
Avoid warnings generated by GCC 2.95.4 when Bison is