c++: use YYRHSLOC.

* data/lalr1.cc (YYRHSLOC): New.
	(YYLLOC_DEFAULT): Use it.
	* data/glr.cc: If location_type was user defined, do not include
	location.hh, and do not produce location.hh and position.hh.
	* tests/calc.at (YYLLOC_DEFAULT): Use YYRHSLOC.
	Check that glr.cc supports user defined location_type.
	* NEWS: Document this.
This commit is contained in:
Akim Demaille
2010-05-09 23:58:50 +02:00
parent f38ae16f37
commit bb9191dd31
5 changed files with 77 additions and 26 deletions

38
NEWS
View File

@@ -3,10 +3,46 @@ Bison News
* Changes in version ?.? (????-??-??):
** C++ parsers use YYRHSLOC
Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
macro and use it in the default YYLLOC_DEFAULT. You are encouraged
to use it. If, for instance, your location structure has "first"
and "last" members, instead of
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) \
{ \
(Current).first = (Rhs)[1].location.first; \
(Current).last = (Rhs)[N].location.last; \
} \
else \
{ \
(Current).first = (Current).last = (Rhs)[0].location.last; \
} \
while (false)
use:
# define YYLLOC_DEFAULT(Current, Rhs, N) \
do \
if (N) \
{ \
(Current).first = YYRHSLOC (Rhs, 1).first; \
(Current).last = YYRHSLOC (Rhs, N).last; \
} \
else \
{ \
(Current).first = (Current).last = YYRHSLOC (Rhs, 0).last; \
} \
while (false)
** Additional yylex/yyparse arguments
The new directive %param declare additional argument to both yylex
and yyparse. The %lex-param, %parse-param, and %param directive
and yyparse. The %lex-param, %parse-param, and %param directives
support one or more arguments. Instead of
%lex-param {arg1_type *arg1}