/[bison]/bison/doc/bison.texinfo
ViewVC logotype

Diff of /bison/doc/bison.texinfo

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.100 by eggert, Mon Jan 13 06:41:29 2003 UTC revision 1.101 by akim, Fri Feb 21 08:07:57 2003 UTC
# Line 237  The Lexical Analyzer Function @code{yyle Line 237  The Lexical Analyzer Function @code{yyle
237  * Calling Convention::  How @code{yyparse} calls @code{yylex}.  * Calling Convention::  How @code{yyparse} calls @code{yylex}.
238  * Token Values::      How @code{yylex} must return the semantic value  * Token Values::      How @code{yylex} must return the semantic value
239                          of the token it has read.                          of the token it has read.
240  * Token Positions::   How @code{yylex} must return the text position  * Token Locations::   How @code{yylex} must return the text location
241                          (line number, etc.) of the token, if the                          (line number, etc.) of the token, if the
242                          actions want that.                          actions want that.
243  * Pure Calling::      How the calling convention differs  * Pure Calling::      How the calling convention differs
# Line 855  will suffice.  Otherwise, we suggest Line 855  will suffice.  Otherwise, we suggest
855  @node Locations Overview  @node Locations Overview
856  @section Locations  @section Locations
857  @cindex location  @cindex location
858  @cindex textual position  @cindex textual location
859  @cindex position, textual  @cindex location, textual
860    
861  Many applications, like interpreters or compilers, have to produce verbose  Many applications, like interpreters or compilers, have to produce verbose
862  and useful error messages.  To achieve this, one must be able to keep track of  and useful error messages.  To achieve this, one must be able to keep track of
863  the @dfn{textual position}, or @dfn{location}, of each syntactic construct.  the @dfn{textual location}, or @dfn{location}, of each syntactic construct.
864  Bison provides a mechanism for handling these locations.  Bison provides a mechanism for handling these locations.
865    
866  Each token has a semantic value.  In a similar fashion, each token has an  Each token has a semantic value.  In a similar fashion, each token has an
# Line 3071  actually does to implement mid-rule acti Line 3071  actually does to implement mid-rule acti
3071  @node Locations  @node Locations
3072  @section Tracking Locations  @section Tracking Locations
3073  @cindex location  @cindex location
3074  @cindex textual position  @cindex textual location
3075  @cindex position, textual  @cindex location, textual
3076    
3077  Though grammar rules and semantic actions are enough to write a fully  Though grammar rules and semantic actions are enough to write a fully
3078  functional parser, it can be useful to process some additional information,  functional parser, it can be useful to process some additional information,
# Line 3971  that need it.  @xref{Invocation, ,Invoki Line 3971  that need it.  @xref{Invocation, ,Invoki
3971  * Calling Convention::  How @code{yyparse} calls @code{yylex}.  * Calling Convention::  How @code{yyparse} calls @code{yylex}.
3972  * Token Values::      How @code{yylex} must return the semantic value  * Token Values::      How @code{yylex} must return the semantic value
3973                          of the token it has read.                          of the token it has read.
3974  * Token Positions::   How @code{yylex} must return the text position  * Token Locations::   How @code{yylex} must return the text location
3975                          (line number, etc.) of the token, if the                          (line number, etc.) of the token, if the
3976                          actions want that.                          actions want that.
3977  * Pure Calling::      How the calling convention differs  * Pure Calling::      How the calling convention differs
# Line 4104  then the code in @code{yylex} might look Line 4104  then the code in @code{yylex} might look
4104  @end group  @end group
4105  @end example  @end example
4106    
4107  @node Token Positions  @node Token Locations
4108  @subsection Textual Positions of Tokens  @subsection Textual Locations of Tokens
4109    
4110  @vindex yylloc  @vindex yylloc
4111  If you are using the @samp{@@@var{n}}-feature (@pxref{Locations, ,  If you are using the @samp{@@@var{n}}-feature (@pxref{Locations, ,
# Line 4148  yylex (YYSTYPE *lvalp, YYLTYPE *llocp) Line 4148  yylex (YYSTYPE *lvalp, YYLTYPE *llocp)
4148  @end example  @end example
4149    
4150  If the grammar file does not use the @samp{@@} constructs to refer to  If the grammar file does not use the @samp{@@} constructs to refer to
4151  textual positions, then the type @code{YYLTYPE} will not be defined.  In  textual locations, then the type @code{YYLTYPE} will not be defined.  In
4152  this case, omit the second argument; @code{yylex} will be called with  this case, omit the second argument; @code{yylex} will be called with
4153  only one argument.  only one argument.
4154    
# Line 4410  errors.  This is useful primarily in err Line 4410  errors.  This is useful primarily in err
4410    
4411  @deffn {Value} @@$  @deffn {Value} @@$
4412  @findex @@$  @findex @@$
4413  Acts like a structure variable containing information on the textual position  Acts like a structure variable containing information on the textual location
4414  of the grouping made by the current rule.  @xref{Locations, ,  of the grouping made by the current rule.  @xref{Locations, ,
4415  Tracking Locations}.  Tracking Locations}.
4416    
# Line 4436  Tracking Locations}. Line 4436  Tracking Locations}.
4436    
4437  @deffn {Value} @@@var{n}  @deffn {Value} @@@var{n}
4438  @findex @@@var{n}  @findex @@@var{n}
4439  Acts like a structure variable containing information on the textual position  Acts like a structure variable containing information on the textual location
4440  of the @var{n}th component of the current rule.  @xref{Locations, ,  of the @var{n}th component of the current rule.  @xref{Locations, ,
4441  Tracking Locations}.  Tracking Locations}.
4442  @end deffn  @end deffn
# Line 6562  External variable in which @code{yylex} Line 6562  External variable in which @code{yylex}
6562  numbers associated with a token.  (In a pure parser, it is a local  numbers associated with a token.  (In a pure parser, it is a local
6563  variable within @code{yyparse}, and its address is passed to  variable within @code{yyparse}, and its address is passed to
6564  @code{yylex}.)  You can ignore this variable if you don't use the  @code{yylex}.)  You can ignore this variable if you don't use the
6565  @samp{@@} feature in the grammar actions.  @xref{Token Positions,  @samp{@@} feature in the grammar actions.  @xref{Token Locations,
6566  ,Textual Positions of Tokens}.  ,Textual Locations of Tokens}.
6567  @end deffn  @end deffn
6568    
6569  @deffn {Variable} yynerrs  @deffn {Variable} yynerrs

Legend:
Removed from v.1.100  
changed lines
  Added in v.1.101

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26