yychar cannot be empty in yyerrlab.

* TODO (yychar == yyempty_): New.
	* data/lalr1.cc: Remove the handling of this case.
	This eases forthcoming changes related to yychar and yytranslate.
This commit is contained in:
Akim Demaille committed 2008-11-11 15:26:17 +01:00
1 parent fce629c0ef
commit 27cb5b5901
3 files changed
+35 -11

No files matched your search

+7
View File
@@ -1,3 +1,10 @@
2008-11-11 Akim Demaille <[email protected]>
yychar cannot be empty in yyerrlab.
* TODO (yychar == yyempty_): New.
* data/lalr1.cc: Remove the handling of this case.
This eases forthcoming changes related to yychar and yytranslate.
2008-11-11 Akim Demaille <[email protected]>
Bench: syntactic sugar for %define/#define.
+16
View File
@@ -54,6 +54,22 @@ what it should look like. For instance what follows crashes.
return yyparse ();
}
** yychar == yyempty_
The code in yyerrlab reads:
if (yychar <= YYEOF)
{
/* Return failure if at end of input. */
if (yychar == YYEOF)
YYABORT;
}
There are only two yychar that can be <= YYEOF: YYEMPTY and YYEOF.
But I can't produce the situation where yychar is YYEMPTY here, is it
really possible? The test suite does not exercise this case.
This shows that it would be interesting to manage to install skeleton
coverage analysis to the test suite.
* Header guards
+12 -11
View File
@@ -1281,18 +1281,19 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
if (yyerrstatus_ == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
error, discard it. */
if (yychar <= yyeof_)
{
/* Return failure if at end of input. */
if (yychar == yyeof_)
YYABORT;
}
else
{
yy_destroy_ ("Error: discarding", yyla);
yychar = yyempty_;
/* Return failure if at end of input. */
if (yychar == yyeof_)
YYABORT;
else
{]b4_assert_if([
// Previous version of this code was ready to handle
// yychar == yyempty_ (actually yychar <= yyeof_). Can it
// really be triggered?
assert (yychar != yyempty_);])[
yy_destroy_ ("Error: discarding", yyla);
yychar = yyempty_;
}
}