mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
style: update comments in the skeletons
* data/skeletons/c++.m4, data/skeletons/glr.c, data/skeletons/lalr1.d, * data/skeletons/lalr1.java, data/skeletons/yacc.c: Be more accurate about yychar and yytoken. Don't name local variables as if they were members.
This commit is contained in:
@@ -594,11 +594,12 @@ m4_define([b4_yytranslate_define],
|
|||||||
{
|
{
|
||||||
]b4_translate[
|
]b4_translate[
|
||||||
};
|
};
|
||||||
const int code_max_ = ]b4_code_max[;
|
// Last valid token kind.
|
||||||
|
const int code_max = ]b4_code_max[;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return symbol_kind::]b4_symbol_prefix[YYEOF;
|
return symbol_kind::]b4_symbol_prefix[YYEOF;
|
||||||
else if (t <= code_max_)
|
else if (t <= code_max)
|
||||||
return YY_CAST (symbol_kind_type, translate_table[t]);
|
return YY_CAST (symbol_kind_type, translate_table[t]);
|
||||||
else
|
else
|
||||||
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
|
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
|
|||||||
accessed by $0, $-1, etc., in any rule. */
|
accessed by $0, $-1, etc., in any rule. */
|
||||||
#define YYMAXLEFT ]b4_max_left_semantic_context[
|
#define YYMAXLEFT ]b4_max_left_semantic_context[
|
||||||
|
|
||||||
/* YYMAXUTOK -- Last valid token number (for yychar). */
|
/* YYMAXUTOK -- Last valid token kind. */
|
||||||
#define YYMAXUTOK ]b4_code_max[
|
#define YYMAXUTOK ]b4_code_max[
|
||||||
|
|
||||||
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
|
|||||||
@@ -428,8 +428,9 @@ b4_locations_if([, ref ]b4_location_type[ yylocationp])[)
|
|||||||
*/
|
*/
|
||||||
public bool parse ()
|
public bool parse ()
|
||||||
{
|
{
|
||||||
/// Lookahead and lookahead in internal form.
|
// Lookahead token kind.
|
||||||
int yychar = TokenKind.YYEMPTY;
|
int yychar = TokenKind.YYEMPTY;
|
||||||
|
// Lookahead symbol kind.
|
||||||
SymbolKind yytoken = ]b4_symbol(-2, kind)[;
|
SymbolKind yytoken = ]b4_symbol(-2, kind)[;
|
||||||
|
|
||||||
/* State. */
|
/* State. */
|
||||||
@@ -841,11 +842,12 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
]b4_translate[
|
]b4_translate[
|
||||||
@};
|
@};
|
||||||
|
|
||||||
immutable int code_max_ = ]b4_code_max[;
|
// Last valid token kind.
|
||||||
|
immutable int code_max = ]b4_code_max[;
|
||||||
|
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return ]b4_symbol(0, kind)[;
|
return ]b4_symbol(0, kind)[;
|
||||||
else if (t <= code_max_)
|
else if (t <= code_max)
|
||||||
{
|
{
|
||||||
import std.conv : to;
|
import std.conv : to;
|
||||||
return to!SymbolKind (translate_table[t]);
|
return to!SymbolKind (translate_table[t]);
|
||||||
|
|||||||
@@ -53,8 +53,9 @@ b4_use_push_for_pull_if([
|
|||||||
# allows them to be defined either in parse() when doing pull parsing,
|
# allows them to be defined either in parse() when doing pull parsing,
|
||||||
# or as class instance variable when doing push parsing.
|
# or as class instance variable when doing push parsing.
|
||||||
m4_define([b4_define_state],[[
|
m4_define([b4_define_state],[[
|
||||||
/* Lookahead and lookahead in internal form. */
|
/* Lookahead token kind. */
|
||||||
int yychar = YYEMPTY_;
|
int yychar = YYEMPTY_;
|
||||||
|
/* Lookahead symbol kind. */
|
||||||
SymbolKind yytoken = null;
|
SymbolKind yytoken = null;
|
||||||
|
|
||||||
/* State. */
|
/* State. */
|
||||||
@@ -1078,17 +1079,18 @@ b4_dollar_popdef[]dnl
|
|||||||
|
|
||||||
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
/* YYTRANSLATE_(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
||||||
as returned by yylex, with out-of-bounds checking. */
|
as returned by yylex, with out-of-bounds checking. */
|
||||||
private static final SymbolKind yytranslate_ (int t)
|
private static final SymbolKind yytranslate_(int t)
|
||||||
]b4_api_token_raw_if(dnl
|
]b4_api_token_raw_if(dnl
|
||||||
[[ {
|
[[ {
|
||||||
return SymbolKind.get(t);
|
return SymbolKind.get(t);
|
||||||
}
|
}
|
||||||
]],
|
]],
|
||||||
[[ {
|
[[ {
|
||||||
int code_max_ = ]b4_code_max[;
|
// Last valid token kind.
|
||||||
|
int code_max = ]b4_code_max[;
|
||||||
if (t <= 0)
|
if (t <= 0)
|
||||||
return ]b4_symbol(0, kind)[;
|
return ]b4_symbol(0, kind)[;
|
||||||
else if (t <= code_max_)
|
else if (t <= code_max)
|
||||||
return SymbolKind.get(yytranslate_table_[t]);
|
return SymbolKind.get(yytranslate_table_[t]);
|
||||||
else
|
else
|
||||||
return ]b4_symbol(2, kind)[;
|
return ]b4_symbol(2, kind)[;
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ m4_define([b4_rhs_location],
|
|||||||
# Declare the variables that are global, or local to YYPARSE if
|
# Declare the variables that are global, or local to YYPARSE if
|
||||||
# pure-parser.
|
# pure-parser.
|
||||||
m4_define([b4_declare_scanner_communication_variables], [[
|
m4_define([b4_declare_scanner_communication_variables], [[
|
||||||
/* The lookahead symbol. */
|
/* Lookahead token kind. */
|
||||||
int yychar;
|
int yychar;
|
||||||
|
|
||||||
]b4_pure_if([[
|
]b4_pure_if([[
|
||||||
@@ -571,6 +571,7 @@ union yyalloc
|
|||||||
/* YYNSTATES -- Number of states. */
|
/* YYNSTATES -- Number of states. */
|
||||||
#define YYNSTATES ]b4_states_number[
|
#define YYNSTATES ]b4_states_number[
|
||||||
|
|
||||||
|
/* YYMAXUTOK -- Last valid token kind. */
|
||||||
#define YYMAXUTOK ]b4_code_max[
|
#define YYMAXUTOK ]b4_code_max[
|
||||||
|
|
||||||
|
|
||||||
@@ -1544,7 +1545,7 @@ yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])[
|
|||||||
int yyn;
|
int yyn;
|
||||||
/* The return value of yyparse. */
|
/* The return value of yyparse. */
|
||||||
int yyresult;
|
int yyresult;
|
||||||
/* Lookahead token as an internal (translated) token number. */
|
/* Lookahead symbol kind. */
|
||||||
yysymbol_kind_t yytoken = ]b4_symbol(-2, kind)[;
|
yysymbol_kind_t yytoken = ]b4_symbol(-2, kind)[;
|
||||||
/* The variables used to return semantic value and location from the
|
/* The variables used to return semantic value and location from the
|
||||||
action routines. */
|
action routines. */
|
||||||
|
|||||||
@@ -627,6 +627,7 @@ union yyalloc
|
|||||||
/* YYNSTATES -- Number of states. */
|
/* YYNSTATES -- Number of states. */
|
||||||
#define YYNSTATES 167
|
#define YYNSTATES 167
|
||||||
|
|
||||||
|
/* YYMAXUTOK -- Last valid token kind. */
|
||||||
#define YYMAXUTOK 315
|
#define YYMAXUTOK 315
|
||||||
|
|
||||||
|
|
||||||
@@ -1752,7 +1753,7 @@ yydestruct (const char *yymsg,
|
|||||||
int
|
int
|
||||||
yyparse (void)
|
yyparse (void)
|
||||||
{
|
{
|
||||||
/* The lookahead symbol. */
|
/* Lookahead token kind. */
|
||||||
int yychar;
|
int yychar;
|
||||||
|
|
||||||
|
|
||||||
@@ -1807,7 +1808,7 @@ YYLTYPE yylloc = yyloc_default;
|
|||||||
int yyn;
|
int yyn;
|
||||||
/* The return value of yyparse. */
|
/* The return value of yyparse. */
|
||||||
int yyresult;
|
int yyresult;
|
||||||
/* Lookahead token as an internal (translated) token number. */
|
/* Lookahead symbol kind. */
|
||||||
yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
|
yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
|
||||||
/* The variables used to return semantic value and location from the
|
/* The variables used to return semantic value and location from the
|
||||||
action routines. */
|
action routines. */
|
||||||
|
|||||||
Reference in New Issue
Block a user