style: rename user_token_number as code

This should have been done in 3.6, but I wanted to avoid introducing
conflicts into Vincent's work on counterexamples.  It turns out it's
completely orthogonal.

* data/README.md, data/skeletons/bison.m4, data/skeletons/c++.m4,
* data/skeletons/c.m4, data/skeletons/glr.c, data/skeletons/java.m4,
* data/skeletons/lalr1.d, data/skeletons/lalr1.java,
* data/skeletons/variant.hh, data/skeletons/yacc.c, src/conflicts.c,
* src/derives.c, src/gram.c, src/gram.h, src/output.c,
* src/parse-gram.c, src/parse-gram.y, src/print-xml.c, src/print.c,
* src/reader.c, src/symtab.c, src/symtab.h, tests/input.at,
* tests/types.at:
s/user_token_number/code/g.
Plus minor changes.
This commit is contained in:
Akim Demaille
2020-05-22 20:12:03 +02:00
parent 339d11badf
commit e7aff57122
25 changed files with 88 additions and 95 deletions

View File

@@ -586,7 +586,7 @@ m4_define([b4_token_format],
[b4_token_visible_if([$2],
[m4_format([[$1]],
m4_expand(b4_symbol([$2], [id])),
m4_expand(b4_symbol([$2], b4_api_token_raw_if([[number]], [[user_number]]))))])])
m4_expand(b4_symbol([$2], b4_api_token_raw_if([[number]], [[code]]))))])])
# b4_last_enum_token

View File

@@ -594,11 +594,11 @@ m4_define([b4_yytranslate_define],
{
]b4_translate[
};
const int user_token_number_max_ = ]b4_user_token_number_max[;
const int code_max_ = ]b4_code_max[;
if (t <= 0)
return symbol_kind::]b4_symbol_prefix[YYEOF;
else if (t <= user_token_number_max_)
else if (t <= code_max_)
return YY_CAST (symbol_kind_type, translate_table[t]);
else
return symbol_kind::]b4_symbol_prefix[YYUNDEF;]])[

View File

@@ -523,7 +523,7 @@ m4_define([b4_token_enum],
[m4_format([ %-30s %s],
m4_format([[%s = %s%s%s]],
b4_symbol([$1], [id]),
b4_symbol([$1], b4_api_token_raw_if([[number]], [[user_number]])),
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])),
m4_if([$1], b4_last_enum_token, [], [[,]])),
[b4_symbol_tag_comment([$1])])])])

View File

@@ -332,7 +332,7 @@ static YYLTYPE yyloc_default][]b4_yyloc_default;])[
#define YYMAXLEFT ]b4_max_left_semantic_context[
/* YYMAXUTOK -- Last valid token number (for yychar). */
#define YYMAXUTOK ]b4_user_token_number_max[
#define YYMAXUTOK ]b4_code_max[
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */

View File

@@ -143,7 +143,7 @@ m4_define([b4_token_enum],
]],
b4_symbol([$1], [tag]),
b4_symbol([$1], [id]),
b4_symbol([$1], b4_api_token_raw_if([[number]], [[user_number]])))])])
b4_symbol([$1], b4_api_token_raw_if([[number]], [[code]])))])])
# b4_token_enums

View File

@@ -841,11 +841,11 @@ m4_popdef([b4_at_dollar])])dnl
]b4_translate[
@};
immutable int user_token_number_max_ = ]b4_user_token_number_max[;
immutable int code_max_ = ]b4_code_max[;
if (t <= 0)
return SymbolKind.]b4_symbol_prefix[YYEOF;
else if (t <= user_token_number_max_)
else if (t <= code_max_)
{
import std.conv : to;
return to!SymbolKind (translate_table[t]);

View File

@@ -1085,10 +1085,10 @@ b4_dollar_popdef[]dnl
}
]],
[[ {
int user_token_number_max_ = ]b4_user_token_number_max[;
int code_max_ = ]b4_code_max[;
if (t <= 0)
return SymbolKind.]b4_symbol_prefix[YYEOF;
else if (t <= user_token_number_max_)
else if (t <= code_max_)
return SymbolKind.get (yytranslate_table_[t]);
else
return SymbolKind.]b4_symbol_prefix[YYUNDEF;

View File

@@ -392,7 +392,7 @@ m4_define([_b4_type_clause],
[b4_symbol_if([$1], [is_token],
[b4_symbol_if([$1], [has_id],
[tok == token::b4_symbol([$1], [id])],
[tok == b4_symbol([$1], [user_number])])])])
[tok == b4_symbol([$1], [code])])])])
# _b4_token_constructor_define(SYMBOL-NUM...)

View File

@@ -592,7 +592,7 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES ]b4_states_number[
#define YYMAXUTOK ]b4_user_token_number_max[
#define YYMAXUTOK ]b4_code_max[
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM