mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 10:13:03 +00:00
If the user does not define YYSTYPE as a macro, Bison now declares it
using typedef instead of defining it as a macro. POSIX requires this.
For consistency, YYLTYPE is also declared instead of defined.
%union directives can now have a tag before the `{', e.g., the
directive `%union foo {...}' now generates the C code
`typedef union foo { ... } YYSTYPE;'; this is for Yacc compatibility.
The default union tag is `YYSTYPE', for compatibility with Solaris 9
Yacc. For consistency, YYLTYPE's struct tag is now `YYLTYPE'
instead of `yyltype'.
`yystype' and `yyltype' are now obsolescent macros instead of being
typedefs or tags; they are no longer documented and will be
withdrawn in a future release.
This commit is contained in:
@@ -3102,13 +3102,13 @@ When @code{YYLTYPE} is not defined, Bison uses a default structure type with
|
|||||||
four members:
|
four members:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
struct
|
typedef struct YYLTYPE
|
||||||
@{
|
@{
|
||||||
int first_line;
|
int first_line;
|
||||||
int first_column;
|
int first_column;
|
||||||
int last_line;
|
int last_line;
|
||||||
int last_column;
|
int last_column;
|
||||||
@}
|
@} YYLTYPE;
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@node Actions and Locations
|
@node Actions and Locations
|
||||||
@@ -3417,7 +3417,23 @@ This says that the two alternative types are @code{double} and @code{symrec
|
|||||||
in the @code{%token} and @code{%type} declarations to pick one of the types
|
in the @code{%token} and @code{%type} declarations to pick one of the types
|
||||||
for a terminal or nonterminal symbol (@pxref{Type Decl, ,Nonterminal Symbols}).
|
for a terminal or nonterminal symbol (@pxref{Type Decl, ,Nonterminal Symbols}).
|
||||||
|
|
||||||
Note that, unlike making a @code{union} declaration in C, you do not write
|
As an extension to @acronym{POSIX}, a tag is allowed after the
|
||||||
|
@code{union}. For example:
|
||||||
|
|
||||||
|
@example
|
||||||
|
@group
|
||||||
|
%union value @{
|
||||||
|
double val;
|
||||||
|
symrec *tptr;
|
||||||
|
@}
|
||||||
|
@end group
|
||||||
|
@end example
|
||||||
|
|
||||||
|
specifies the union tag @code{value}, so the corresponding C type is
|
||||||
|
@code{union value}. If you do not specify a tag, it defaults to
|
||||||
|
@code{YYSTYPE}.
|
||||||
|
|
||||||
|
Note that, unlike making a @code{union} declaration in C, you need not write
|
||||||
a semicolon after the closing brace.
|
a semicolon after the closing brace.
|
||||||
|
|
||||||
@node Type Decl
|
@node Type Decl
|
||||||
@@ -6452,15 +6468,11 @@ macro is deprecated, and is supported only for Yacc like parsers.
|
|||||||
@xref{Pure Calling,, Calling Conventions for Pure Parsers}.
|
@xref{Pure Calling,, Calling Conventions for Pure Parsers}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Macro} YYLTYPE
|
@deffn {Type} YYLTYPE
|
||||||
Macro for the data type of @code{yylloc}; a structure with four
|
Data type of @code{yylloc}; by default, a structure with four
|
||||||
members. @xref{Location Type, , Data Types of Locations}.
|
members. @xref{Location Type, , Data Types of Locations}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Type} yyltype
|
|
||||||
Default value for YYLTYPE.
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@deffn {Macro} YYMAXDEPTH
|
@deffn {Macro} YYMAXDEPTH
|
||||||
Macro for specifying the maximum size of the parser stack. @xref{Stack
|
Macro for specifying the maximum size of the parser stack. @xref{Stack
|
||||||
Overflow}.
|
Overflow}.
|
||||||
@@ -6485,8 +6497,8 @@ grow its internal stacks. Do @emph{not} define @code{YYSTACK_USE_ALLOCA}
|
|||||||
to anything else.
|
to anything else.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Macro} YYSTYPE
|
@deffn {Type} YYSTYPE
|
||||||
Macro for the data type of semantic values; @code{int} by default.
|
Data type of semantic values; @code{int} by default.
|
||||||
@xref{Value Type, ,Data Types of Semantic Values}.
|
@xref{Value Type, ,Data Types of Semantic Values}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user