* data/c.m4 (b4_yy_symbol_print_generate):

(b4_yy_symbol_print_generate): Use 'YYSTYPE const' rather than
'const YYSTYPE', and similarly for YYLTYPE.  This fixes one
of the bugs reported today by Derek M Jones in
<http://lists.gnu.org/archive/html/bug-bison/2006-05/msg00027.html>.
* doc/bison.texinfo (Value Type): Document that YYSTYPE must be
defined to be a type name without parens or brackets.
(Location Type): Similarly for YYLTYPE.
* tests/regression.at (Trivial grammars): Put in a test for this
bug that will be caught by 'make maintainer-check' (though not,
alas, by 'make check' unless your compiler is picky).
This commit is contained in:
Paul Eggert
2006-05-21 04:48:47 +00:00
parent 95c0638353
commit 50cce58e9a
4 changed files with 25 additions and 5 deletions

View File

@@ -3067,6 +3067,8 @@ specify some other type, define @code{YYSTYPE} as a macro, like this:
@end example
@noindent
@code{YYSTYPE}'s replacement list should be a type name
that does not contain parentheses or square brackets.
This macro definition must go in the prologue of the grammar file
(@pxref{Grammar Outline, ,Outline of a Bison Grammar}).
@@ -3463,7 +3465,9 @@ actions to take when rules are matched.
Defining a data type for locations is much simpler than for semantic values,
since all tokens and groupings always use the same type.
The type of locations is specified by defining a macro called @code{YYLTYPE}.
You can specify the type of locations by defining a macro called
@code{YYLTYPE}, just as you can specify the semantic value type by
defining @code{YYSTYPE} (@pxref{Value Type}).
When @code{YYLTYPE} is not defined, Bison uses a default structure type with
four members: