[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: lalr1.cc: yychar & yytoken
From: |
Akim Demaille |
Subject: |
FYI: lalr1.cc: yychar & yytoken |
Date: |
Mon, 19 Sep 2005 09:21:19 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
2005-09-19 Akim Demaille <address@hidden>
* data/lalr1.cc (yyparse): Rename yylooka and yyilooka as yychar
and yytoken for similarity with the other skeletons.
Index: data/lalr1.cc
===================================================================
RCS file: /cvsroot/bison/bison/data/lalr1.cc,v
retrieving revision 1.99
diff -u -u -r1.99 lalr1.cc
--- data/lalr1.cc 16 Sep 2005 22:54:21 -0000 1.99
+++ data/lalr1.cc 19 Sep 2005 07:20:03 -0000
@@ -510,9 +510,9 @@
int
yy::]b4_parser_class_name[::parse ()
{
- /* Look-ahead and look-ahead in internal form. */
- int yylooka;
- int yyilooka;
+ /// Look-ahead and look-ahead in internal form.
+ int yychar;
+ int yytoken;
/// Semantic value of the look-ahead.
semantic_type yylval;
@@ -535,7 +535,7 @@
/* Start. */
yystate_ = 0;
- yylooka = yyempty_;
+ yychar = yyempty_;
]m4_ifdef([b4_initial_action], [
m4_pushdef([b4_at_dollar], [yylloc])dnl
@@ -572,10 +572,10 @@
goto yydefault;
/* Read a look-ahead token. */
- if (yylooka == yyempty_)
+ if (yychar == yyempty_)
{
YYCDEBUG << "Reading a token: ";
- yylooka = ]b4_c_function_call([yylex], [int],
+ yychar = ]b4_c_function_call([yylex], [int],
[[YYSTYPE*], [&yylval]][]dnl
b4_location_if([, [[location*], [&yylloc]]])dnl
m4_ifdef([b4_lex_param], [, ]b4_lex_param))[;
@@ -583,21 +583,21 @@
/* Convert token to internal form. */
- if (yylooka <= yyeof_)
+ if (yychar <= yyeof_)
{
- yylooka = yyilooka = yyeof_;
+ yychar = yytoken = yyeof_;
YYCDEBUG << "Now at end of input." << std::endl;
}
else
{
- yyilooka = yytranslate_ (yylooka);
- YY_SYMBOL_PRINT ("Next token is", yyilooka, &yylval, &yylloc);
+ yytoken = yytranslate_ (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token ILOOKA_ is to reduce or to
detect an error, take that action. */
- yyn_ += yyilooka;
- if (yyn_ < 0 || yylast_ < yyn_ || yycheck_[yyn_] != yyilooka)
+ yyn_ += yytoken;
+ if (yyn_ < 0 || yylast_ < yyn_ || yycheck_[yyn_] != yytoken)
goto yydefault;
/* Reduce or error. */
@@ -620,11 +620,11 @@
goto yyacceptlab;
/* Shift the look-ahead token. */
- YY_SYMBOL_PRINT ("Shifting", yyilooka, &yylval, &yylloc);
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the token being shifted unless it is eof. */
- if (yylooka != yyeof_)
- yylooka = yyempty_;
+ if (yychar != yyeof_)
+ yychar = yyempty_;
yysemantic_stack_.push (yylval);
yylocation_stack_.push (yylloc);
@@ -701,7 +701,7 @@
if (!yyerrstatus_)
{
++yynerrs_;
- error (yylloc, yysyntax_error_ (YYERROR_VERBOSE_IF (yyilooka)));
+ error (yylloc, yysyntax_error_ (YYERROR_VERBOSE_IF (yytoken)));
}
yyerror_range[0] = yylloc;
@@ -710,16 +710,16 @@
/* If just tried and failed to reuse look-ahead token after an
error, discard it. */
- if (yylooka <= yyeof_)
+ if (yychar <= yyeof_)
{
/* Return failure if at end of input. */
- if (yylooka == yyeof_)
+ if (yychar == yyeof_)
YYABORT;
}
else
{
- yydestruct_ ("Error: discarding", yyilooka, &yylval, &yylloc);
- yylooka = yyempty_;
+ yydestruct_ ("Error: discarding", yytoken, &yylval, &yylloc);
+ yychar = yyempty_;
}
}
@@ -805,8 +805,8 @@
goto yyreturn;
yyreturn:
- if (yylooka != yyeof_ && yylooka != yyempty_)
- yydestruct_ ("Cleanup: discarding lookahead", yyilooka, &yylval, &yylloc);
+ if (yychar != yyeof_ && yychar != yyempty_)
+ yydestruct_ ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc);
while (yystate_stack_.height () != 1)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: lalr1.cc: yychar & yytoken,
Akim Demaille <=