yacc.c: also count calls to YYERROR in yynerrs

* data/skeletons/yacc.c: here.
This commit is contained in:
Akim Demaille
2020-08-04 17:15:43 +02:00
parent 683040b324
commit f4d33ff4b4
4 changed files with 12 additions and 4 deletions

3
TODO
View File

@@ -1,4 +1,7 @@
* Soon * Soon
** YYERROR and yynerrs
We are missing some cases. Write a test case, and check all the skeletons.
** gnulib ** gnulib
Bruno notes: Bruno notes:

View File

@@ -2044,6 +2044,7 @@ yyerrorlab:
label yyerrorlab therefore never appears in user code. */ label yyerrorlab therefore never appears in user code. */
if (0) if (0)
YYERROR; YYERROR;
++yynerrs;
/* Do not reclaim the symbols of the rule whose action triggered /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */ this YYERROR. */

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.7.2.43-1ae84. */ /* A Bison parser, made by GNU Bison 3.7.2.67-44c6. */
/* Bison implementation for Yacc-like parsers in C /* Bison implementation for Yacc-like parsers in C
@@ -49,7 +49,7 @@
#define YYBISON 1 #define YYBISON 1
/* Bison version. */ /* Bison version. */
#define YYBISON_VERSION "3.7.2.43-1ae84" #define YYBISON_VERSION "3.7.2.67-44c6"
/* Skeleton name. */ /* Skeleton name. */
#define YYSKELETON_NAME "yacc.c" #define YYSKELETON_NAME "yacc.c"
@@ -1844,6 +1844,7 @@ YYLTYPE yylloc = yyloc_default;
yychar = GRAM_EMPTY; /* Cause a token to be read. */ yychar = GRAM_EMPTY; /* Cause a token to be read. */
/* User initialization code. */ /* User initialization code. */
{ {
/* Bison's grammar can initial empty locations, hence a default /* Bison's grammar can initial empty locations, hence a default
@@ -1945,6 +1946,7 @@ yysetstate:
} }
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
if (yystate == YYFINAL) if (yystate == YYFINAL)
YYACCEPT; YYACCEPT;
@@ -2008,8 +2010,8 @@ yybackup:
{ {
if (yytable_value_is_error (yyn)) if (yytable_value_is_error (yyn))
goto yyerrlab; goto yyerrlab;
YY_LAC_ESTABLISH;
yyn = -yyn; yyn = -yyn;
YY_LAC_ESTABLISH;
goto yyreduce; goto yyreduce;
} }
@@ -2709,6 +2711,7 @@ yyerrorlab:
label yyerrorlab therefore never appears in user code. */ label yyerrorlab therefore never appears in user code. */
if (0) if (0)
YYERROR; YYERROR;
++yynerrs;
/* Do not reclaim the symbols of the rule whose action triggered /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */ this YYERROR. */

View File

@@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.7.2.43-1ae84. */ /* A Bison parser, made by GNU Bison 3.7.2.67-44c6. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
@@ -216,6 +216,7 @@ struct GRAM_LTYPE
int gram_parse (void); int gram_parse (void);
/* "%code provides" blocks. */ /* "%code provides" blocks. */
/* Initialize unquote. */ /* Initialize unquote. */