[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/21] regen
From: |
Akim Demaille |
Subject: |
[PATCH 06/21] regen |
Date: |
Wed, 1 Apr 2020 08:37:32 +0200 |
---
src/parse-gram.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/parse-gram.c b/src/parse-gram.c
index 1adad0c3..777a53c1 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -103,6 +103,7 @@
/* Symbol type. */
enum yysymbol_type_t
{
+ YYSYMBOL_YYEMPTY = -2,
YYSYMBOL_YYEOF = 0,
YYSYMBOL_error = 1,
YYSYMBOL_YYUNDEF = 2,
@@ -620,10 +621,10 @@ static const yytype_int16 yyrline[] =
#if 1
/* The user-facing name of the symbol whose (internal) number is
YYSYMBOL. No bounds checking. */
-static const char *yysymbol_name (int yysymbol) YY_ATTRIBUTE_UNUSED;
+static const char *yysymbol_name (yysymbol_type_t yysymbol)
YY_ATTRIBUTE_UNUSED;
static const char *
-yysymbol_name (int yysymbol)
+yysymbol_name (yysymbol_type_t yysymbol)
{
static const char *const yy_sname[] =
{
@@ -1464,7 +1465,7 @@ do {
\
any old *YYES other than YYESA. */
static int
yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
- YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, int yytoken)
+ YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, yysymbol_type_t yytoken)
{
yy_state_t *yyes_prev = yyssp;
yy_state_t *yyesp = yyes_prev;
@@ -1574,7 +1575,7 @@ typedef struct
yy_state_t *yyesa;
yy_state_t **yyes;
YYPTRDIFF_T *yyes_capacity;
- int yytoken;
+ yysymbol_type_t yytoken;
YYLTYPE *yylloc;
} yyparse_context_t;
@@ -1586,7 +1587,7 @@ typedef struct
YYARG up to YYARGN. */
static int
yyexpected_tokens (const yyparse_context_t *yyctx,
- int yyarg[], int yyargn)
+ yysymbol_type_t yyarg[], int yyargn)
{
/* Actual size of YYARG. */
int yycount = 0;
@@ -1615,10 +1616,10 @@ yyexpected_tokens (const yyparse_context_t *yyctx,
/* The token type of the lookahead of this context. */
-static int
+static yysymbol_type_t
yyparse_context_token (const yyparse_context_t *yyctx) YY_ATTRIBUTE_UNUSED;
-static int
+static yysymbol_type_t
yyparse_context_token (const yyparse_context_t *yyctx)
{
return yyctx->yytoken;
@@ -1770,7 +1771,7 @@ YYLTYPE yylloc = yyloc_default;
/* The return value of yyparse. */
int yyresult;
/* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
+ yysymbol_type_t yytoken = YYSYMBOL_YYEMPTY;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
@@ -2604,7 +2605,7 @@ yyreduce:
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+ yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
@@ -2787,11 +2788,11 @@ yyreport_syntax_error (const yyparse_context_t *ctx)
enum { ARGS_MAX = 5 };
const char *argv[ARGS_MAX];
int argc = 0;
- int unexpected = yyparse_context_token (ctx);
- if (unexpected != YYEMPTY)
+ yysymbol_type_t unexpected = yyparse_context_token (ctx);
+ if (unexpected != YYSYMBOL_YYEMPTY)
{
argv[argc++] = yysymbol_name (unexpected);
- int expected[ARGS_MAX - 1];
+ yysymbol_type_t expected[ARGS_MAX - 1];
int nexpected = yyexpected_tokens (ctx, expected, ARGS_MAX - 1);
if (nexpected < 0)
res = nexpected;
--
2.26.0
- [PATCH 00/21] Use, Akim Demaille, 2020/04/01
- [PATCH 01/21] style: comment changes about token numbers, Akim Demaille, 2020/04/01
- [PATCH 02/21] yacc.c: introduce an enum that defines the symbol's number, Akim Demaille, 2020/04/01
- [PATCH 04/21] yacc.c: use yysymbol_type_t instead of int for yytoken, Akim Demaille, 2020/04/01
- [PATCH 03/21] regen, Akim Demaille, 2020/04/01
- [PATCH 06/21] regen,
Akim Demaille <=
- [PATCH 05/21] yacc.c: also define a symbol number for the empty token, Akim Demaille, 2020/04/01
- [PATCH 08/21] regen, Akim Demaille, 2020/04/01
- [PATCH 07/21] yacc.c: prefer YYSYMBOL_YYERROR to YYSYMBOL_error, Akim Demaille, 2020/04/01
- [PATCH 09/21] bistromathic: use symbol numbers instead of YYTRANSLATE, Akim Demaille, 2020/04/01
- [PATCH 11/21] regen, Akim Demaille, 2020/04/01
- [PATCH 10/21] yysymbol_type_t: always assign an enumerator, Akim Demaille, 2020/04/01
- [PATCH 12/21] yacc.c: revert to not using yysymbol_type_t in the yytranslate table, Akim Demaille, 2020/04/01
- [PATCH 13/21] regen, Akim Demaille, 2020/04/01
- [PATCH 14/21] yacc.c: fix more errors from make maintainer-check-g++, Akim Demaille, 2020/04/01
- [PATCH 15/21] regen, Akim Demaille, 2020/04/01