bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: Document %initial-action


From: Akim Demaille
Subject: FYI: Document %initial-action
Date: Mon, 20 Sep 2004 16:29:19 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

I think the "Bison Symbols" section should be sorted regardless of
special characters such as %, @ etc. for symbols with real letters in
them.  Currently, $undefined is before error which is before %debug.

Shouldn't we re-sort?

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * doc/bison.texinfo (Initial Action Decl): New.

Index: NEWS
===================================================================
RCS file: /cvsroot/bison/bison/NEWS,v
retrieving revision 1.103
diff -u -u -r1.103 NEWS
--- NEWS 21 Jun 2004 20:20:30 -0000 1.103
+++ NEWS 20 Sep 2004 14:25:30 -0000
@@ -3,6 +3,10 @@
 
 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.
 
Index: doc/bison.texinfo
===================================================================
RCS file: /cvsroot/bison/bison/doc/bison.texinfo,v
retrieving revision 1.130
diff -u -u -r1.130 bison.texinfo
--- doc/bison.texinfo 6 Sep 2004 07:48:19 -0000 1.130
+++ doc/bison.texinfo 20 Sep 2004 14:25:30 -0000
@@ -228,6 +228,7 @@
 * 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.
@@ -3520,6 +3521,7 @@
 * 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.
@@ -3729,6 +3731,22 @@
 terminal symbol.  All kinds of token declarations allow
 @code{<@var{type}>}.
 
address@hidden Initial Action Decl
address@hidden Performing Actions before Parsing
address@hidden %initial-action
+
+Sometimes your parser needs to perform some initializations before
+parsing.  The @code{%initial-action} directive allows for such arbitrary
+code.
+
address@hidden {Directive} %initial-action @{ @var{code} @}
address@hidden %initial-action
+Declare that the @var{code} must be invoked before parsing each time
address@hidden is called.  The @var{code} may use @code{@@$} to
+designate the initial location, and the @code{%parse-param}.
address@hidden deffn
+
+
 @node Destructor Decl
 @subsection Freeing Discarded Symbols
 @cindex freeing discarded symbols
@@ -7144,6 +7162,10 @@
 @acronym{GLR} Parsers}.
 @end deffn
 
address@hidden {Directive} %initial-action
+Run user code before parsing.  @xref{Initial Action Decl, , Performing Actions 
before Parsing}.
address@hidden deffn
+
 @deffn {Directive} %error-verbose
 Bison declaration to request verbose, specific error message strings
 when @code{yyerror} is called.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]