diff options
author | Akim Demaille <demaille@gostai.com> | 2008-09-04 22:41:01 +0200 |
---|---|---|
committer | Akim Demaille <demaille@gostai.com> | 2008-11-15 10:20:02 +0100 |
commit | fe1b448ada5e3a79ae3f523e08b5004396f30ca9 (patch) | |
tree | 19b637f4d3b3601ae94117db53e32f9bebc104ae /etc | |
parent | 5679f31101d0bc5aab6adbce37212b2fdedd32cd (diff) | |
download | bison-fe1b448ada5e3a79ae3f523e08b5004396f30ca9.tar.gz |
Instead of using make_symbol<TOK_FOO>, generate make_FOO for each token type.
Using template buys us nothing, and makes it uselessly complex to
construct a symbol. Besides, it could not be generalized to other
languages, while make_FOO would work in C/Java etc.
* data/lalr1.cc (b4_symbol_): New.
(b4_symbol): Use it.
(b4_symbol_constructor_declaration_)
(b4_symbol_constructor_definition_): Instead of generating
specializations of an overloaded template function, just generate
several functions whose names are forged from the token names
without the token.prefix.
(b4_symbol_constructor_declarations): Generate them for all the
symbols, not just by class of symbol type, now that instead of
specializing a function template by the token, we generate a
function named after the token.
(b4_symbol_constructor_specialization_)
(b4_symbol_constructor_specializations): Remove.
* etc/bench.pl.in: Adjust to this new API.
Diffstat (limited to 'etc')
-rwxr-xr-x | etc/bench.pl.in | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/etc/bench.pl.in b/etc/bench.pl.in index f8fca8ac..7cab2ebe 100755 --- a/etc/bench.pl.in +++ b/etc/bench.pl.in @@ -692,7 +692,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylval, if (stage == STAGE_MAX) { #if USE_LEX_SYMBOL - return yy::parser::make_symbol <token::END_OF_FILE> (yy::location()); + return yy::parser::make_END_OF_FILE (yy::location()); #else *yylloc = yy::location (); return token::END_OF_FILE; @@ -701,7 +701,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylval, else if (stage % 2) { #if USE_LEX_SYMBOL - return yy::parser::make_symbol <token::NUMBER> (stage, yy::location()); + return yy::parser::make_NUMBER (stage, yy::location()); #elif defined ONE_STAGE_BUILD yylval->build(stage); *yylloc = yy::location (); @@ -719,7 +719,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylval, else { #if USE_LEX_SYMBOL - return yy::parser::make_symbol <token::TEXT> ("A string.", yy::location()); + return yy::parser::make_TEXT ("A string.", yy::location()); #elif defined ONE_STAGE_BUILD yylval->build(std::string("A string.")); *yylloc = yy::location (); |