This commit is contained in:
Akim Demaille
2020-04-13 08:18:51 +02:00
parent 64aec0a8d8
commit 3877b7210e
2 changed files with 10 additions and 10 deletions

View File

@@ -898,8 +898,7 @@ static const yytype_int8 yyr2[] =
enum { YYENOMEM = -2 }; enum { YYENOMEM = -2 };
#define yyerrok (yyerrstatus = 0) #define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY) #define yyclearin (yychar = GRAM_EMPTY)
#define YYEMPTY (-2)
#define YYACCEPT goto yyacceptlab #define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab #define YYABORT goto yyabortlab
@@ -910,7 +909,7 @@ enum { YYENOMEM = -2 };
#define YYBACKUP(Token, Value) \ #define YYBACKUP(Token, Value) \
do \ do \
if (yychar == YYEMPTY) \ if (yychar == GRAM_EMPTY) \
{ \ { \
yychar = (Token); \ yychar = (Token); \
yylval = (Value); \ yylval = (Value); \
@@ -1819,7 +1818,7 @@ YYLTYPE yylloc = yyloc_default;
YYDPRINTF ((stderr, "Starting parse\n")); YYDPRINTF ((stderr, "Starting parse\n"));
yychar = YYEMPTY; /* Cause a token to be read. */ yychar = GRAM_EMPTY; /* Cause a token to be read. */
/* User initialization code. */ /* User initialization code. */
{ {
@@ -1943,7 +1942,7 @@ yybackup:
/* Not known => get a lookahead token if don't already have one. */ /* Not known => get a lookahead token if don't already have one. */
/* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
if (yychar == YYEMPTY) if (yychar == GRAM_EMPTY)
{ {
YYDPRINTF ((stderr, "Reading a token\n")); YYDPRINTF ((stderr, "Reading a token\n"));
yychar = yylex (&yylval, &yylloc); yychar = yylex (&yylval, &yylloc);
@@ -1993,7 +1992,7 @@ yybackup:
*++yylsp = yylloc; *++yylsp = yylloc;
/* Discard the shifted token. */ /* Discard the shifted token. */
yychar = YYEMPTY; yychar = GRAM_EMPTY;
YY_LAC_DISCARD ("shift"); YY_LAC_DISCARD ("shift");
goto yynewstate; goto yynewstate;
@@ -2619,7 +2618,7 @@ yyreduce:
yyerrlab: yyerrlab:
/* Make sure we have latest lookahead translation. See comments at /* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */ user semantic actions for why this is necessary. */
yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); yytoken = yychar == GRAM_EMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */ /* If not already recovering from an error, report this error. */
if (!yyerrstatus) if (!yyerrstatus)
@@ -2628,7 +2627,7 @@ yyerrlab:
{ {
yypcontext_t yyctx yypcontext_t yyctx
= {yyssp, yyesa, &yyes, &yyes_capacity, yytoken, &yylloc}; = {yyssp, yyesa, &yyes, &yyes_capacity, yytoken, &yylloc};
if (yychar != YYEMPTY) if (yychar != GRAM_EMPTY)
YY_LAC_ESTABLISH; YY_LAC_ESTABLISH;
if (yyreport_syntax_error (&yyctx) == 2) if (yyreport_syntax_error (&yyctx) == 2)
goto yyexhaustedlab; goto yyexhaustedlab;
@@ -2652,7 +2651,7 @@ yyerrlab:
{ {
yydestruct ("Error: discarding", yydestruct ("Error: discarding",
yytoken, &yylval, &yylloc); yytoken, &yylval, &yylloc);
yychar = YYEMPTY; yychar = GRAM_EMPTY;
} }
} }
@@ -2763,7 +2762,7 @@ yyexhaustedlab:
| yyreturn -- parsing is finished, return the result. | | yyreturn -- parsing is finished, return the result. |
`-----------------------------------------------------*/ `-----------------------------------------------------*/
yyreturn: yyreturn:
if (yychar != YYEMPTY) if (yychar != GRAM_EMPTY)
{ {
/* Make sure we have latest lookahead translation. See comments at /* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */ user semantic actions for why this is necessary. */

View File

@@ -77,6 +77,7 @@ extern int gram_debug;
# define GRAM_TOKENTYPE # define GRAM_TOKENTYPE
enum gram_tokentype enum gram_tokentype
{ {
GRAM_EMPTY = -2,
GRAM_EOF = 0, /* "end of file" */ GRAM_EOF = 0, /* "end of file" */
GRAM_ERRCODE = 1, /* error */ GRAM_ERRCODE = 1, /* error */
GRAM_UNDEF = 2, /* "invalid token" */ GRAM_UNDEF = 2, /* "invalid token" */