mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 21:33:04 +00:00
* src/gram.h, src/gram.c (error_token_number): Remove, use
errtoken->number. * src/reader.c (reader): Don't specify the user token number (2) for $undefined, as it uselessly prevents using it. * src/gram.h (token_number_t): Move to... * src/symtab.h: here. (state_t.number): Is a token_number_t. * src/print.c, src/reader.c: Use undeftoken->number instead of hard coded 2. (Even though this 2 is not the same as above: the number of the undeftoken remains being 2, it is its user token number which might not be 2). * src/output.c (prepare_tokens): Rename the `maxtok' muscle with `user_token_number_max'. Output `undef_token_number'. * data/bison.simple, data/bison.c++: Use them. Be sure to map invalid yylex return values to `undef_token_number'. This saves us from gratuitous SEGV. * tests/conflicts.at (Solved SR Conflicts) (Unresolved SR Conflicts): Adjust. * tests/regression.at (Web2c Actions): Adjust.
This commit is contained in:
@@ -257,7 +257,8 @@ namespace yy
|
||||
static const int errcode_;
|
||||
static const int ntokens_;
|
||||
static const int initdepth_;
|
||||
static const unsigned maxtok_;
|
||||
static const unsigned user_token_number_max_;
|
||||
static const TokenNumberType undef_token_;
|
||||
|
||||
/* State. */
|
||||
int n_;
|
||||
@@ -722,7 +723,10 @@ yy::b4_name::translate_ (int token)
|
||||
{
|
||||
b4_translate
|
||||
};
|
||||
return (unsigned)(token) <= maxtok_ ? translate_[[token]] : nsym_;
|
||||
if ((unsigned) token <= user_token_number_max_)
|
||||
return translate_[[token]];
|
||||
else
|
||||
return undef_token_;
|
||||
}
|
||||
|
||||
const int yy::b4_name::eof_ = 0;
|
||||
@@ -737,7 +741,8 @@ const int yy::b4_name::errcode_ = 256;
|
||||
const int yy::b4_name::ntokens_ = b4_ntokens;
|
||||
const int yy::b4_name::initdepth_ = b4_initdepth;
|
||||
|
||||
const unsigned yy::b4_name::maxtok_ = b4_maxtok;
|
||||
const unsigned yy::b4_name::user_token_number_max_ = b4_user_token_number_max;
|
||||
const yy::b4_name::TokenNumberType yy::b4_name::undef_token_ = b4_undef_token_number;
|
||||
|
||||
b4_epilogue
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
m4_divert(-1)
|
||||
m4_divert(-1) -*- C -*-
|
||||
|
||||
# b4_sint_type(MAX)
|
||||
# -----------------
|
||||
@@ -265,11 +265,14 @@ b4_token_defines(b4_tokens)
|
||||
#define YYNRULES b4_nrules
|
||||
/* YYNRULES -- Number of states. */
|
||||
#define YYNSTATES b4_nstates
|
||||
#define YYMAXUTOK b4_maxtok
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
#define YYUNDEFTOK b4_undef_token_number
|
||||
#define YYMAXUTOK b4_user_token_number_max
|
||||
|
||||
typedef b4_uint_type(b4_token_number_max) yy_token_number_type;
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= b4_maxtok ? yytranslate[[x]] : b4_nsym)
|
||||
#define YYTRANSLATE(X) \
|
||||
((unsigned)(X) <= YYMAXUTOK ? yytranslate[[X]] : YYUNDEFTOK)
|
||||
|
||||
/* YYTRANSLATE[[YYLEX]] -- Bison symbol number corresponding to YYLEX. */
|
||||
static const yy_token_number_type yytranslate[[]] =
|
||||
|
||||
Reference in New Issue
Block a user