Locations are no longer required by lalr1.cc.

* data/lalr1.cc (_b4_args, b4_args): New.
	Adjust all uses of locations to make them optional.
	* tests/c++.at (AT_CHECK_VARIANTS): No longer use the locations.
	(AT_CHECK_NAMESPACE): Check the use of locations.
	* tests/calc.at (_AT_DATA_CALC_Y): Adjust to be usable with or
	without locations with lalr1.cc.
	Test these cases.
	* tests/output.at: Check lalr1.cc with and without location
	support.
	* tests/regression.at (_AT_DATA_EXPECT2_Y, _AT_DATA_DANCER_Y):
	Don't use locations.
This commit is contained in:
Akim Demaille
2008-08-25 13:52:51 +02:00
parent 7ca2266adc
commit 2ea7730c56
6 changed files with 160 additions and 87 deletions

View File

@@ -141,10 +141,9 @@ yylex(yy::parser::semantic_type* yylval)
}
void
yy::parser::error(const yy::parser::location_type& yylloc,
const std::string& message)
yy::parser::error(const std::string& message)
{
std::cerr << yylloc << ": " << message << std::endl;
std::cerr << message << std::endl;
}
int
@@ -278,10 +277,11 @@ AT_DATA_GRAMMAR([[input.y]],
%define namespace "]$1["
%union { int i; }
%define global_tokens_and_yystype
%locations
%code {
// YYSTYPE contains a namespace reference.
int yylex (YYSTYPE *lval) {
int yylex (YYSTYPE *lval, const ]$1[::parser::location_type* lloc) {
lval->i = 3;
return 0;
}