mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
doc: clean up references to `Tracking Locations'.
* doc/bison.texinfo (Locations): Rename node to...
(Tracking Locations): ... this, which is its section name, and
update all cross references. The trouble is that there is another
node about locations. Its section name is `Locations', which was
easily confused with the node name of this node. Moreover, its
node name is `Locations Overview', which was mistakenly used to
label some cross references to this node.
(cherry picked from commit 7404cdf3a1)
Conflicts:
doc/bison.texinfo
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
|||||||
|
2011-05-29 Joel E. Denny <joeldenny@joeldenny.org>
|
||||||
|
|
||||||
|
doc: clean up references to `Tracking Locations'.
|
||||||
|
* doc/bison.texinfo (Locations): Rename node to...
|
||||||
|
(Tracking Locations): ... this, which is its section name, and
|
||||||
|
update all cross references. The trouble is that there is another
|
||||||
|
node about locations. Its section name is `Locations', which was
|
||||||
|
easily confused with the node name of this node. Moreover, its
|
||||||
|
node name is `Locations Overview', which was mistakenly used to
|
||||||
|
label some cross references to this node.
|
||||||
|
|
||||||
2011-05-29 Joel E. Denny <joeldenny@joeldenny.org>
|
2011-05-29 Joel E. Denny <joeldenny@joeldenny.org>
|
||||||
|
|
||||||
doc: clean up `Named References' a little.
|
doc: clean up `Named References' a little.
|
||||||
|
|||||||
@@ -181,15 +181,15 @@ Multi-Function Calculator: @code{mfcalc}
|
|||||||
|
|
||||||
Bison Grammar Files
|
Bison Grammar Files
|
||||||
|
|
||||||
* Grammar Outline:: Overall layout of the grammar file.
|
* Grammar Outline:: Overall layout of the grammar file.
|
||||||
* Symbols:: Terminal and nonterminal symbols.
|
* Symbols:: Terminal and nonterminal symbols.
|
||||||
* Rules:: How to write grammar rules.
|
* Rules:: How to write grammar rules.
|
||||||
* Recursion:: Writing recursive rules.
|
* Recursion:: Writing recursive rules.
|
||||||
* Semantics:: Semantic values and actions.
|
* Semantics:: Semantic values and actions.
|
||||||
* Locations:: Locations and actions.
|
* Tracking Locations:: Locations and actions.
|
||||||
* Named References:: Using named references in actions.
|
* Named References:: Using named references in actions.
|
||||||
* Declarations:: All kinds of Bison declarations are described here.
|
* Declarations:: All kinds of Bison declarations are described here.
|
||||||
* Multiple Parsers:: Putting more than one Bison parser in one program.
|
* Multiple Parsers:: Putting more than one Bison parser in one program.
|
||||||
|
|
||||||
Outline of a Bison Grammar
|
Outline of a Bison Grammar
|
||||||
|
|
||||||
@@ -1290,9 +1290,10 @@ the @dfn{textual location}, or @dfn{location}, of each syntactic construct.
|
|||||||
Bison provides a mechanism for handling these locations.
|
Bison provides a mechanism for handling these locations.
|
||||||
|
|
||||||
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
|
||||||
associated location, but the type of locations is the same for all tokens and
|
associated location, but the type of locations is the same for all tokens
|
||||||
groupings. Moreover, the output parser is equipped with a default data
|
and groupings. Moreover, the output parser is equipped with a default data
|
||||||
structure for storing locations (@pxref{Locations}, for more details).
|
structure for storing locations (@pxref{Tracking Locations}, for more
|
||||||
|
details).
|
||||||
|
|
||||||
Like semantic values, locations can be reached in actions using a dedicated
|
Like semantic values, locations can be reached in actions using a dedicated
|
||||||
set of constructs. In the example above, the location of the whole grouping
|
set of constructs. In the example above, the location of the whole grouping
|
||||||
@@ -2695,15 +2696,15 @@ The Bison grammar file conventionally has a name ending in @samp{.y}.
|
|||||||
@xref{Invocation, ,Invoking Bison}.
|
@xref{Invocation, ,Invoking Bison}.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Grammar Outline:: Overall layout of the grammar file.
|
* Grammar Outline:: Overall layout of the grammar file.
|
||||||
* Symbols:: Terminal and nonterminal symbols.
|
* Symbols:: Terminal and nonterminal symbols.
|
||||||
* Rules:: How to write grammar rules.
|
* Rules:: How to write grammar rules.
|
||||||
* Recursion:: Writing recursive rules.
|
* Recursion:: Writing recursive rules.
|
||||||
* Semantics:: Semantic values and actions.
|
* Semantics:: Semantic values and actions.
|
||||||
* Locations:: Locations and actions.
|
* Tracking Locations:: Locations and actions.
|
||||||
* Named References:: Using named references in actions.
|
* Named References:: Using named references in actions.
|
||||||
* Declarations:: All kinds of Bison declarations are described here.
|
* Declarations:: All kinds of Bison declarations are described here.
|
||||||
* Multiple Parsers:: Putting more than one Bison parser in one program.
|
* Multiple Parsers:: Putting more than one Bison parser in one program.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Grammar Outline
|
@node Grammar Outline
|
||||||
@@ -3880,7 +3881,7 @@ compound: subroutine
|
|||||||
Now Bison can execute the action in the rule for @code{subroutine} without
|
Now Bison can execute the action in the rule for @code{subroutine} without
|
||||||
deciding which rule for @code{compound} it will eventually use.
|
deciding which rule for @code{compound} it will eventually use.
|
||||||
|
|
||||||
@node Locations
|
@node Tracking Locations
|
||||||
@section Tracking Locations
|
@section Tracking Locations
|
||||||
@cindex location
|
@cindex location
|
||||||
@cindex textual location
|
@cindex textual location
|
||||||
@@ -4998,9 +4999,8 @@ Unless your parser is pure, the parser header file declares
|
|||||||
(Reentrant) Parser}.
|
(Reentrant) Parser}.
|
||||||
|
|
||||||
If you have also used locations, the parser header file declares
|
If you have also used locations, the parser header file declares
|
||||||
@code{YYLTYPE} and @code{yylloc} using a protocol similar to that of
|
@code{YYLTYPE} and @code{yylloc} using a protocol similar to that of the
|
||||||
the @code{YYSTYPE} macro and @code{yylval}. @xref{Locations,
|
@code{YYSTYPE} macro and @code{yylval}. @xref{Tracking Locations}.
|
||||||
,Tracking Locations}.
|
|
||||||
|
|
||||||
This parser header file is normally essential if you wish to put the
|
This parser header file is normally essential if you wish to put the
|
||||||
definition of @code{yylex} in a separate source file, because
|
definition of @code{yylex} in a separate source file, because
|
||||||
@@ -6002,12 +6002,12 @@ then the code in @code{yylex} might look like this:
|
|||||||
@subsection Textual Locations of Tokens
|
@subsection Textual Locations of Tokens
|
||||||
|
|
||||||
@vindex yylloc
|
@vindex yylloc
|
||||||
If you are using the @samp{@@@var{n}}-feature (@pxref{Locations, ,
|
If you are using the @samp{@@@var{n}}-feature (@pxref{Tracking Locations})
|
||||||
Tracking Locations}) in actions to keep track of the textual locations
|
in actions to keep track of the textual locations of tokens and groupings,
|
||||||
of tokens and groupings, then you must provide this information in
|
then you must provide this information in @code{yylex}. The function
|
||||||
@code{yylex}. The function @code{yyparse} expects to find the textual
|
@code{yyparse} expects to find the textual location of a token just parsed
|
||||||
location of a token just parsed in the global variable @code{yylloc}.
|
in the global variable @code{yylloc}. So @code{yylex} must store the proper
|
||||||
So @code{yylex} must store the proper data in that variable.
|
data in that variable.
|
||||||
|
|
||||||
By default, the value of @code{yylloc} is a structure and you need only
|
By default, the value of @code{yylloc} is a structure and you need only
|
||||||
initialize the members that are going to be used by the actions. The
|
initialize the members that are going to be used by the actions. The
|
||||||
@@ -6344,9 +6344,9 @@ Actions}).
|
|||||||
|
|
||||||
@deffn {Value} @@$
|
@deffn {Value} @@$
|
||||||
@findex @@$
|
@findex @@$
|
||||||
Acts like a structure variable containing information on the textual location
|
Acts like a structure variable containing information on the textual
|
||||||
of the grouping made by the current rule. @xref{Locations, ,
|
location of the grouping made by the current rule. @xref{Tracking
|
||||||
Tracking Locations}.
|
Locations}.
|
||||||
|
|
||||||
@c Check if those paragraphs are still useful or not.
|
@c Check if those paragraphs are still useful or not.
|
||||||
|
|
||||||
@@ -6370,9 +6370,9 @@ Tracking Locations}.
|
|||||||
|
|
||||||
@deffn {Value} @@@var{n}
|
@deffn {Value} @@@var{n}
|
||||||
@findex @@@var{n}
|
@findex @@@var{n}
|
||||||
Acts like a structure variable containing information on the textual location
|
Acts like a structure variable containing information on the textual
|
||||||
of the @var{n}th component of the current rule. @xref{Locations, ,
|
location of the @var{n}th component of the current rule. @xref{Tracking
|
||||||
Tracking Locations}.
|
Locations}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@node Internationalization
|
@node Internationalization
|
||||||
@@ -9176,10 +9176,10 @@ is some time and/or some talented C++ hacker willing to contribute to Bison.
|
|||||||
@c - %define filename_type "const symbol::Symbol"
|
@c - %define filename_type "const symbol::Symbol"
|
||||||
|
|
||||||
When the directive @code{%locations} is used, the C++ parser supports
|
When the directive @code{%locations} is used, the C++ parser supports
|
||||||
location tracking, see @ref{Locations, , Locations Overview}. Two
|
location tracking, see @ref{Tracking Locations}. Two auxiliary classes
|
||||||
auxiliary classes define a @code{position}, a single point in a file,
|
define a @code{position}, a single point in a file, and a @code{location}, a
|
||||||
and a @code{location}, a range composed of a pair of
|
range composed of a pair of @code{position}s (possibly spanning several
|
||||||
@code{position}s (possibly spanning several files).
|
files).
|
||||||
|
|
||||||
@deftypemethod {position} {std::string*} file
|
@deftypemethod {position} {std::string*} file
|
||||||
The name of the file. It will always be handled as a pointer, the
|
The name of the file. It will always be handled as a pointer, the
|
||||||
@@ -10100,14 +10100,13 @@ can be used to print the semantic values. This however may change
|
|||||||
@c - class Position
|
@c - class Position
|
||||||
@c - class Location
|
@c - class Location
|
||||||
|
|
||||||
When the directive @code{%locations} is used, the Java parser
|
When the directive @code{%locations} is used, the Java parser supports
|
||||||
supports location tracking, see @ref{Locations, , Locations Overview}.
|
location tracking, see @ref{Tracking Locations}. An auxiliary user-defined
|
||||||
An auxiliary user-defined class defines a @dfn{position}, a single point
|
class defines a @dfn{position}, a single point in a file; Bison itself
|
||||||
in a file; Bison itself defines a class representing a @dfn{location},
|
defines a class representing a @dfn{location}, a range composed of a pair of
|
||||||
a range composed of a pair of positions (possibly spanning several
|
positions (possibly spanning several files). The location class is an inner
|
||||||
files). The location class is an inner class of the parser; the name
|
class of the parser; the name is @code{Location} by default, and may also be
|
||||||
is @code{Location} by default, and may also be renamed using
|
renamed using @samp{%define location_type "@var{class-name}"}.
|
||||||
@samp{%define location_type "@var{class-name}"}.
|
|
||||||
|
|
||||||
The location class treats the position as a completely opaque value.
|
The location class treats the position as a completely opaque value.
|
||||||
By default, the class name is @code{Position}, but this can be changed
|
By default, the class name is @code{Position}, but this can be changed
|
||||||
@@ -10991,22 +10990,22 @@ See @url{http://lists.gnu.org/}.
|
|||||||
|
|
||||||
@deffn {Variable} @@$
|
@deffn {Variable} @@$
|
||||||
In an action, the location of the left-hand side of the rule.
|
In an action, the location of the left-hand side of the rule.
|
||||||
@xref{Locations, , Locations Overview}.
|
@xref{Tracking Locations}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Variable} @@@var{n}
|
@deffn {Variable} @@@var{n}
|
||||||
In an action, the location of the @var{n}-th symbol of the right-hand
|
In an action, the location of the @var{n}-th symbol of the right-hand side
|
||||||
side of the rule. @xref{Locations, , Locations Overview}.
|
of the rule. @xref{Tracking Locations}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Variable} @@@var{name}
|
@deffn {Variable} @@@var{name}
|
||||||
In an action, the location of a symbol addressed by name.
|
In an action, the location of a symbol addressed by name. @xref{Tracking
|
||||||
@xref{Locations, , Locations Overview}.
|
Locations}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Variable} @@[@var{name}]
|
@deffn {Variable} @@[@var{name}]
|
||||||
In an action, the location of a symbol addressed by name.
|
In an action, the location of a symbol addressed by name. @xref{Tracking
|
||||||
@xref{Locations, , Locations Overview}.
|
Locations}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Variable} $$
|
@deffn {Variable} $$
|
||||||
|
|||||||
Reference in New Issue
Block a user