2004-09-20 Akim Demaille <akim@epita.fr>
+ * doc/bison.texinfo (Initial Action Decl): New.
+
+2004-09-20 Akim Demaille <akim@epita.fr>
+
* data/yacc.c (YY_LOCATION_PRINT): Use YYLTYPE_IS_TRIVIAL as a
clearer criterion to define it.
(parse): Initialize the initial location when YYLTYPE_IS_TRIVIAL.
Changes in version 1.875e:
+* New directive: %initial-action.
+ This directive allows the user to run arbitrary code (including
+ initializing @$) from yyparse before parsing starts.
+
* The option `--report=lookahead' was changed to `--report=look-ahead'.
The old spelling still works, but is not documented and will be removed.
* Precedence Decl:: Declaring terminals with precedence and associativity.
* Union Decl:: Declaring the set of all semantic value types.
* Type Decl:: Declaring the choice of type for a nonterminal symbol.
+* Initial Action Decl:: Code run before parsing starts.
* Destructor Decl:: Declaring how symbols are freed.
* Expect Decl:: Suppressing warnings about parsing conflicts.
* Start Decl:: Specifying the start symbol.
* Precedence Decl:: Declaring terminals with precedence and associativity.
* Union Decl:: Declaring the set of all semantic value types.
* Type Decl:: Declaring the choice of type for a nonterminal symbol.
+* Initial Action Decl:: Code run before parsing starts.
* Destructor Decl:: Declaring how symbols are freed.
* Expect Decl:: Suppressing warnings about parsing conflicts.
* Start Decl:: Specifying the start symbol.
terminal symbol. All kinds of token declarations allow
@code{<@var{type}>}.
+@node Initial Action Decl
+@subsection Performing Actions before Parsing
+@findex %initial-action
+
+Sometimes your parser needs to perform some initializations before
+parsing. The @code{%initial-action} directive allows for such arbitrary
+code.
+
+@deffn {Directive} %initial-action @{ @var{code} @}
+@findex %initial-action
+Declare that the @var{code} must be invoked before parsing each time
+@code{yyparse} is called. The @var{code} may use @code{@@$} to
+designate the initial location, and the @code{%parse-param}.
+@end deffn
+
+
@node Destructor Decl
@subsection Freeing Discarded Symbols
@cindex freeing discarded symbols
@acronym{GLR} Parsers}.
@end deffn
+@deffn {Directive} %initial-action
+Run user code before parsing. @xref{Initial Action Decl, , Performing Actions before Parsing}.
+@end deffn
+
@deffn {Directive} %error-verbose
Bison declaration to request verbose, specific error message strings
when @code{yyerror} is called.