summaryrefslogtreecommitdiff
path: root/data/skeletons/lalr1.cc
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-11-07 16:21:00 +0100
committerAkim Demaille <akim.demaille@gmail.com>2020-11-07 16:58:47 +0100
commit5a31cda4c3a2a8e94edaea634a4f917c421f6954 (patch)
tree3721044907e8cd806c8eb0ce094642737b4c0acf /data/skeletons/lalr1.cc
parent34e6e8815a9dec2ee3463fd5e940c0b589ebaf3a (diff)
downloadbison-5a31cda4c3a2a8e94edaea634a4f917c421f6954.tar.gz
style: avoid explicit symbol numbers
This should have been part of commit "symbols: stop dealing with YYEMPTY as b4_symbol(-2, ...)" (cd40ec9526df27d0e3e1c2d41e82a3e6a47254d1). Give names to all the special symbols: "eof", "error" and "undef". * data/skeletons/bison.m4 (b4_symbol): Let `b4_symbol(eof, ...)` mean `b4_symbol(0, ...)`, `b4_symbol(error, ...)` mean `b4_symbol(1, ...)`, and , `b4_symbol(undef, ...)` mean `b4_symbol(2, ...)`.. * data/skeletons/c.m4, data/skeletons/glr.c, data/skeletons/glr.cc, * data/skeletons/glr2.cc, data/skeletons/lalr1.cc, * data/skeletons/lalr1.d, data/skeletons/lalr1.java, * data/skeletons/yacc.c: Prefer symbols to numbers.
Diffstat (limited to 'data/skeletons/lalr1.cc')
-rw-r--r--data/skeletons/lalr1.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index ddf70556..fbabba35 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -918,13 +918,13 @@ b4_dollar_popdef])[]dnl
}
YY_SYMBOL_PRINT ("Next token is", yyla);
- if (yyla.kind () == ]b4_symbol(1, kind)[)
+ if (yyla.kind () == ]b4_symbol(error, kind)[)
{
// The scanner already issued an error message, process directly
// to error recovery. But do not keep the error token as
// lookahead, it is too special and may lead us to an endless
// loop in error recovery. */
- yyla.kind_ = ]b4_symbol(2, kind)[;
+ yyla.kind_ = ]b4_symbol(undef, kind)[;
goto yyerrlab1;
}
@@ -1061,7 +1061,7 @@ b4_dollar_popdef])[]dnl
error, discard it. */
// Return failure if at end of input.
- if (yyla.kind () == ]b4_symbol(0, kind)[)
+ if (yyla.kind () == ]b4_symbol(eof, kind)[)
YYABORT;
else if (!yyla.empty ())
{
@@ -1102,9 +1102,9 @@ b4_dollar_popdef])[]dnl
yyn = yypact_[+yystack_[0].state];
if (!yy_pact_value_is_default_ (yyn))
{
- yyn += ]b4_symbol(1, kind)[;
+ yyn += ]b4_symbol(error, kind)[;
if (0 <= yyn && yyn <= yylast_
- && yycheck_[yyn] == ]b4_symbol(1, kind)[)
+ && yycheck_[yyn] == ]b4_symbol(error, kind)[)
{
yyn = yytable_[yyn];
if (0 < yyn)
@@ -1296,8 +1296,8 @@ b4_dollar_popdef])[]dnl
for (int yyx = 0; yyx < YYNTOKENS; ++yyx)
{
symbol_kind_type yysym = YY_CAST (symbol_kind_type, yyx);
- if (yysym != ]b4_symbol(1, kind)[
- && yysym != ]b4_symbol(2, kind)[
+ if (yysym != ]b4_symbol(error, kind)[
+ && yysym != ]b4_symbol(undef, kind)[
&& yyparser_.yy_lac_check_ (yysym))
{
if (!yyarg)
@@ -1319,7 +1319,7 @@ b4_dollar_popdef])[]dnl
int yychecklim = yylast_ - yyn + 1;
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(1, kind)[
+ if (yycheck_[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
{
if (!yyarg)