From f4d33ff4b4aca9b89c28a3ded1d77657604c50b2 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Tue, 4 Aug 2020 17:15:43 +0200 Subject: [PATCH] yacc.c: also count calls to YYERROR in yynerrs * data/skeletons/yacc.c: here. --- TODO | 3 +++ data/skeletons/yacc.c | 1 + src/parse-gram.c | 9 ++++++--- src/parse-gram.h | 3 ++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 5dfff22f..8d6de590 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,7 @@ * Soon +** YYERROR and yynerrs +We are missing some cases. Write a test case, and check all the skeletons. + ** gnulib Bruno notes: diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c index 881167c7..c8c89555 100644 --- a/data/skeletons/yacc.c +++ b/data/skeletons/yacc.c @@ -2044,6 +2044,7 @@ yyerrorlab: label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; + ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ diff --git a/src/parse-gram.c b/src/parse-gram.c index b93d66c2..ff19886f 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -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 @@ -49,7 +49,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.7.2.43-1ae84" +#define YYBISON_VERSION "3.7.2.67-44c6" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -1844,6 +1844,7 @@ YYLTYPE yylloc = yyloc_default; yychar = GRAM_EMPTY; /* Cause a token to be read. */ + /* User initialization code. */ { /* Bison's grammar can initial empty locations, hence a default @@ -1945,6 +1946,7 @@ yysetstate: } #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + if (yystate == YYFINAL) YYACCEPT; @@ -2008,8 +2010,8 @@ yybackup: { if (yytable_value_is_error (yyn)) goto yyerrlab; - YY_LAC_ESTABLISH; yyn = -yyn; + YY_LAC_ESTABLISH; goto yyreduce; } @@ -2709,6 +2711,7 @@ yyerrorlab: label yyerrorlab therefore never appears in user code. */ if (0) YYERROR; + ++yynerrs; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ diff --git a/src/parse-gram.h b/src/parse-gram.h index d09a5f39..8fd3aa5f 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -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 @@ -216,6 +216,7 @@ struct GRAM_LTYPE int gram_parse (void); + /* "%code provides" blocks. */ /* Initialize unquote. */