summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-07-11 13:51:57 +0200
committerAkim Demaille <akim.demaille@gmail.com>2020-07-11 18:05:35 +0200
commitdab23c4a21407791ffed73d6010f2eba453b147a (patch)
tree42e44a2822648d61ab1700c0c151e0b2d8990759
parent38a169bec159ef94dc7330e4a4834ebcbc4d25ca (diff)
downloadbison-dab23c4a21407791ffed73d6010f2eba453b147a.tar.gz
bistromathic: promote yytoken_kind_t
* examples/c/bistromathic/parse.y: Use yytoken_kind_t rather than int.
-rw-r--r--examples/c/bistromathic/parse.y13
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/c/bistromathic/parse.y b/examples/c/bistromathic/parse.y
index d4e77825..9ba07ea5 100644
--- a/examples/c/bistromathic/parse.y
+++ b/examples/c/bistromathic/parse.y
@@ -74,7 +74,7 @@
# define __attribute__(Spec) /* empty */
# endif
# endif
- int yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc);
+ yytoken_kind_t yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc);
void yyerror (YYLTYPE *loc, char const *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
}
@@ -257,7 +257,7 @@ symbol_count (void)
| Scanner. |
`----------*/
-int
+yytoken_kind_t
yylex (const char **line, YYSTYPE *yylval, YYLTYPE *yylloc)
{
int c;
@@ -453,7 +453,8 @@ process_line (YYLTYPE *lloc, const char *line)
int status = 0;
do {
YYSTYPE lval;
- status = yypush_parse (ps, yylex (&line, &lval, lloc), &lval, lloc);
+ yytoken_kind_t token = yylex (&line, &lval, lloc);
+ status = yypush_parse (ps, token, &lval, lloc);
} while (status == YYPUSH_MORE);
yypstate_delete (ps);
lloc->last_line++;
@@ -475,9 +476,9 @@ expected_tokens (const char *input,
do {
YYLTYPE lloc = { 1, 1, 1, 1 };
YYSTYPE lval;
- int token = yylex (&input, &lval, &lloc);
- // Don't let the parse know when we reach the end of input.
- if (!token)
+ yytoken_kind_t token = yylex (&input, &lval, &lloc);
+ // Don't let the parser know when we reach the end of input.
+ if (token == TOK_YYEOF)
break;
status = yypush_parse (ps, token, &lval, &lloc);
} while (status == YYPUSH_MORE);