mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
Simplify code for variants bench marks.
* etc/bench.pl.in (&generate_grammar_list): Define and use location_type. Factor the common code in yylex.
This commit is contained in:
committed by
Akim Demaille
parent
070e650956
commit
4fc55348e5
@@ -1,3 +1,10 @@
|
|||||||
|
2008-11-15 Akim Demaille <akim@betelgeuse.gostai.ensta.fr>
|
||||||
|
|
||||||
|
Simplify code for variants bench marks.
|
||||||
|
* etc/bench.pl.in (&generate_grammar_list): Define and use
|
||||||
|
location_type.
|
||||||
|
Factor the common code in yylex.
|
||||||
|
|
||||||
2008-11-15 Akim Demaille <demaille@gostai.com>
|
2008-11-15 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
Better error message.
|
Better error message.
|
||||||
|
|||||||
@@ -686,6 +686,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|||||||
yy::parser::location_type* yylloc)
|
yy::parser::location_type* yylloc)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
typedef yy::parser::location_type location_type;
|
||||||
typedef yy::parser::token token;
|
typedef yy::parser::token token;
|
||||||
static int stage = -1;
|
static int stage = -1;
|
||||||
++stage;
|
++stage;
|
||||||
@@ -694,7 +695,7 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|||||||
#if USE_LEX_SYMBOL
|
#if USE_LEX_SYMBOL
|
||||||
return yy::parser::make_END_OF_FILE (yy::location());
|
return yy::parser::make_END_OF_FILE (yy::location());
|
||||||
#else
|
#else
|
||||||
*yylloc = yy::location ();
|
*yylloc = location_type ();
|
||||||
return token::END_OF_FILE;
|
return token::END_OF_FILE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -702,17 +703,15 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|||||||
{
|
{
|
||||||
#if USE_LEX_SYMBOL
|
#if USE_LEX_SYMBOL
|
||||||
return yy::parser::make_NUMBER (stage, yy::location());
|
return yy::parser::make_NUMBER (stage, yy::location());
|
||||||
#elif defined ONE_STAGE_BUILD
|
|
||||||
yylval->build(stage);
|
|
||||||
*yylloc = yy::location ();
|
|
||||||
return token::NUMBER;
|
|
||||||
#elif USE_VARIANTS
|
|
||||||
yylval->build<int>() = stage;
|
|
||||||
*yylloc = yy::location ();
|
|
||||||
return token::NUMBER;
|
|
||||||
#else
|
#else
|
||||||
|
# if defined ONE_STAGE_BUILD
|
||||||
|
yylval->build(stage);
|
||||||
|
# elif USE_VARIANTS
|
||||||
|
yylval->build<int>() = stage;
|
||||||
|
# else
|
||||||
yylval->ival = stage;
|
yylval->ival = stage;
|
||||||
*yylloc = yy::location ();
|
# endif
|
||||||
|
*yylloc = location_type ();
|
||||||
return token::NUMBER;
|
return token::NUMBER;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -720,17 +719,15 @@ yy::parser::token_type yylex(yy::parser::semantic_type* yylval,
|
|||||||
{
|
{
|
||||||
#if USE_LEX_SYMBOL
|
#if USE_LEX_SYMBOL
|
||||||
return yy::parser::make_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 ();
|
|
||||||
return token::TEXT;
|
|
||||||
#elif USE_VARIANTS
|
|
||||||
yylval->build<std::string>() = std::string("A string.");
|
|
||||||
*yylloc = yy::location ();
|
|
||||||
return token::TEXT;
|
|
||||||
#else
|
#else
|
||||||
|
# if defined ONE_STAGE_BUILD
|
||||||
|
yylval->build(std::string("A string."));
|
||||||
|
# elif USE_VARIANTS
|
||||||
|
yylval->build<std::string>() = std::string("A string.");
|
||||||
|
# else
|
||||||
yylval->sval = new std::string("A string.");
|
yylval->sval = new std::string("A string.");
|
||||||
*yylloc = yy::location ();
|
# endif
|
||||||
|
*yylloc = location_type ();
|
||||||
return token::TEXT;
|
return token::TEXT;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user