mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
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:
@@ -95,11 +95,11 @@ The macro `b4_symbol(NUM, FIELD)` gives access to the following FIELDS:
|
||||
- `tag`: string
|
||||
A human representation of the symbol. Can be 'foo', 'foo.id', '"foo"' etc.
|
||||
|
||||
- `user_number`: integer
|
||||
The code associated to the `id`.
|
||||
- `code`: integer
|
||||
The token code associated to the `id`.
|
||||
The external number as used by yylex. Can be ASCII code when a character,
|
||||
some number chosen by bison, or some user number in the case of
|
||||
%token FOO <NUM>. Corresponds to yychar in yacc.c.
|
||||
some number chosen by bison, or some user number in the case of `%token
|
||||
FOO <NUM>`. Corresponds to `yychar` in `yacc.c`.
|
||||
|
||||
- `is_token`: 0 or 1
|
||||
Whether this is a terminal symbol.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;]])[
|
||||
|
||||
@@ -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])])])])
|
||||
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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...)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user