]> git.saurik.com Git - bison.git/blobdiff - doc/bison.texinfo
Merge changes from gnulib. This was prompted because the CVS
[bison.git] / doc / bison.texinfo
index 32570b0431655e9eb3a1b6b1c5a3e703fca8c181..03da6c8f8511af93b74477950fb9fd61c3f1cd43 100644 (file)
@@ -39,8 +39,8 @@
 This manual is for @acronym{GNU} Bison (version @value{VERSION},
 @value{UPDATED}), the @acronym{GNU} parser generator.
 
-Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998,
-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 2003,
+1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -237,7 +237,7 @@ The Lexical Analyzer Function @code{yylex}
 * Calling Convention::  How @code{yyparse} calls @code{yylex}.
 * Token Values::      How @code{yylex} must return the semantic value
                         of the token it has read.
-* Token Positions::   How @code{yylex} must return the text position
+* Token Locations::   How @code{yylex} must return the text location
                         (line number, etc.) of the token, if the
                         actions want that.
 * Pure Calling::      How the calling convention differs
@@ -855,12 +855,12 @@ will suffice.  Otherwise, we suggest
 @node Locations Overview
 @section Locations
 @cindex location
-@cindex textual position
-@cindex position, textual
+@cindex textual location
+@cindex location, textual
 
 Many applications, like interpreters or compilers, have to produce verbose
 and useful error messages.  To achieve this, one must be able to keep track of
-the @dfn{textual position}, or @dfn{location}, of each syntactic construct.
+the @dfn{textual location}, or @dfn{location}, of each syntactic construct.
 Bison provides a mechanism for handling these locations.
 
 Each token has a semantic value.  In a similar fashion, each token has an
@@ -3071,8 +3071,8 @@ actually does to implement mid-rule actions.
 @node Locations
 @section Tracking Locations
 @cindex location
-@cindex textual position
-@cindex position, textual
+@cindex textual location
+@cindex location, textual
 
 Though grammar rules and semantic actions are enough to write a fully
 functional parser, it can be useful to process some additional information,
@@ -3558,7 +3558,7 @@ The declaration looks like this:
 
 Here @var{n} is a decimal integer.  The declaration says there should be
 no warning if there are @var{n} shift/reduce conflicts and no
-reduce/reduce conflicts.  An error, instead of the usual warning, is
+reduce/reduce conflicts.  The usual warning is
 given if there are either more or fewer conflicts, or if there are any
 reduce/reduce conflicts.
 
@@ -3580,9 +3580,9 @@ Add an @code{%expect} declaration, copying the number @var{n} from the
 number which Bison printed.
 @end itemize
 
-Now Bison will stop annoying you about the conflicts you have checked, but
-it will warn you again if changes in the grammar result in additional
-conflicts.
+Now Bison will stop annoying you if you do not change the number of
+conflicts, but it will warn you again if changes in the grammar result
+in more or fewer conflicts.
 
 @node Start Decl
 @subsection The Start-Symbol
@@ -3902,12 +3902,6 @@ Return immediately with value 0 (to report success).
 Return immediately with value 1 (to report failure).
 @end defmac
 
-@c For now, do not document %lex-param and %parse-param, since it's
-@c not clear that the current behavior is stable enough.  For example,
-@c we may need to add %error-param.
-@clear documentparam
-
-@ifset documentparam
 If you use a reentrant parser, you can optionally pass additional
 parameter information to it in a reentrant way.  To do so, use the
 declaration @code{%parse-param}:
@@ -3946,7 +3940,6 @@ In the grammar actions, use expressions like this to refer to the data:
 @example
 exp: @dots{}    @{ @dots{}; *randomness += 1; @dots{} @}
 @end example
-@end ifset
 
 
 @node Lexical
@@ -3971,7 +3964,7 @@ that need it.  @xref{Invocation, ,Invoking Bison}.
 * Calling Convention::  How @code{yyparse} calls @code{yylex}.
 * Token Values::      How @code{yylex} must return the semantic value
                         of the token it has read.
-* Token Positions::   How @code{yylex} must return the text position
+* Token Locations::   How @code{yylex} must return the text location
                         (line number, etc.) of the token, if the
                         actions want that.
 * Pure Calling::      How the calling convention differs
@@ -4104,8 +4097,8 @@ then the code in @code{yylex} might look like this:
 @end group
 @end example
 
-@node Token Positions
-@subsection Textual Positions of Tokens
+@node Token Locations
+@subsection Textual Locations of Tokens
 
 @vindex yylloc
 If you are using the @samp{@@@var{n}}-feature (@pxref{Locations, ,
@@ -4148,12 +4141,11 @@ yylex (YYSTYPE *lvalp, YYLTYPE *llocp)
 @end example
 
 If the grammar file does not use the @samp{@@} constructs to refer to
-textual positions, then the type @code{YYLTYPE} will not be defined.  In
+textual locations, then the type @code{YYLTYPE} will not be defined.  In
 this case, omit the second argument; @code{yylex} will be called with
 only one argument.
 
 
-@ifset documentparam
 If you wish to pass the additional parameter data to @code{yylex}, use
 @code{%lex-param} just like @code{%parse-param} (@pxref{Parser
 Function}).
@@ -4194,7 +4186,6 @@ and finally, if both @code{%pure-parser} and @code{%locations} are used:
 int yylex   (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
 int yyparse (int *nastiness, int *randomness);
 @end example
-@end ifset
 
 @node Error Reporting
 @section The Error Reporting Function @code{yyerror}
@@ -4259,7 +4250,6 @@ void yyerror (char const *msg);                 /* Yacc parsers.  */
 void yyerror (YYLTYPE *locp, char const *msg);  /* GLR parsers.   */
 @end example
 
-@ifset documentparam
 If @samp{%parse-param @{int *nastiness@}} is used, then:
 
 @example
@@ -4293,7 +4283,6 @@ void yyerror (YYLTYPE *locp,
               int *nastiness, int *randomness,
               char const *msg);
 @end example
-@end ifset
 
 @noindent
 The prototypes are only indications of how the code produced by Bison
@@ -4410,7 +4399,7 @@ errors.  This is useful primarily in error rules.
 
 @deffn {Value} @@$
 @findex @@$
-Acts like a structure variable containing information on the textual position
+Acts like a structure variable containing information on the textual location
 of the grouping made by the current rule.  @xref{Locations, ,
 Tracking Locations}.
 
@@ -4436,7 +4425,7 @@ Tracking Locations}.
 
 @deffn {Value} @@@var{n}
 @findex @@@var{n}
-Acts like a structure variable containing information on the textual position
+Acts like a structure variable containing information on the textual location
 of the @var{n}th component of the current rule.  @xref{Locations, ,
 Tracking Locations}.
 @end deffn
@@ -6562,8 +6551,8 @@ External variable in which @code{yylex} should place the line and column
 numbers associated with a token.  (In a pure parser, it is a local
 variable within @code{yyparse}, and its address is passed to
 @code{yylex}.)  You can ignore this variable if you don't use the
-@samp{@@} feature in the grammar actions.  @xref{Token Positions,
-,Textual Positions of Tokens}.
+@samp{@@} feature in the grammar actions.  @xref{Token Locations,
+,Textual Locations of Tokens}.
 @end deffn
 
 @deffn {Variable} yynerrs
@@ -6617,13 +6606,11 @@ Bison declaration to assign left associativity to token(s).
 @xref{Precedence Decl, ,Operator Precedence}.
 @end deffn
 
-@ifset documentparam
 @deffn {Directive} %lex-param @{@var{argument-declaration}@}
 Bison declaration to specifying an additional parameter that
 @code{yylex} should accept.  @xref{Pure Calling,, Calling Conventions
 for Pure Parsers}.
 @end deffn
-@end ifset
 
 @deffn {Directive} %merge
 Bison declaration to assign a merging function to a rule.  If there is a
@@ -6651,13 +6638,11 @@ Bison declaration to set the name of the parser file.  @xref{Decl
 Summary}.
 @end deffn
 
-@ifset documentparam
 @deffn {Directive} %parse-param @{@var{argument-declaration}@}
 Bison declaration to specifying an additional parameter that
 @code{yyparse} should accept.  @xref{Parser Function,, The Parser
 Function @code{yyparse}}.
 @end deffn
-@end ifset
 
 @deffn {Directive} %prec
 Bison declaration to assign a precedence to a specific rule.