mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
java: use api.location.type and api.position.type
* data/java.m4: here. * NEWS, doc/bison.texi, tests/java.at: Adjust.
This commit is contained in:
15
NEWS
15
NEWS
@@ -43,7 +43,7 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
The parse function now catches exceptions, uses the %destructors to
|
The parse function now catches exceptions, uses the %destructors to
|
||||||
release memory (the lookahead symbol and the symbols pushed on the stack)
|
release memory (the lookahead symbol and the symbols pushed on the stack)
|
||||||
before rethrowing the exception.
|
before re-throwing the exception.
|
||||||
|
|
||||||
This feature is somewhat experimental. User feedback would be
|
This feature is somewhat experimental. User feedback would be
|
||||||
appreciated.
|
appreciated.
|
||||||
@@ -65,7 +65,7 @@ GNU Bison NEWS
|
|||||||
"function declared 'noreturn' should not return") have also been
|
"function declared 'noreturn' should not return") have also been
|
||||||
addressed.
|
addressed.
|
||||||
|
|
||||||
** New %define variable: api.location.type (glr.cc, lalr1.cc)
|
** New %define variable: api.location.type (glr.cc, lalr1.cc, lalr1.java)
|
||||||
|
|
||||||
The %define variable api.location.type defines the name of the type to use
|
The %define variable api.location.type defines the name of the type to use
|
||||||
for locations. When defined, Bison no longer generates the position.hh
|
for locations. When defined, Bison no longer generates the position.hh
|
||||||
@@ -73,13 +73,17 @@ GNU Bison NEWS
|
|||||||
then responsible to define her type.
|
then responsible to define her type.
|
||||||
|
|
||||||
This can be used in programs with several parsers to factor their location
|
This can be used in programs with several parsers to factor their location
|
||||||
and position files: let one of them generate them, and let the others
|
and position files: let one of them generate them, and the others just use
|
||||||
simply resue these types and files.
|
them.
|
||||||
|
|
||||||
This feature was actually introduced, but not documented, in Bison 2.5,
|
This feature was actually introduced, but not documented, in Bison 2.5,
|
||||||
under the name "location_type" (which is maintained for backward
|
under the name "location_type" (which is maintained for backward
|
||||||
compatibility).
|
compatibility).
|
||||||
|
|
||||||
|
For consistency, lalr1.java's %define variables location_type and
|
||||||
|
position_type are deprecated in favor of api.location.type and
|
||||||
|
api.position.type.
|
||||||
|
|
||||||
* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
|
* Noteworthy changes in release 2.6.2 (2012-08-03) [stable]
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
@@ -1937,7 +1941,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
LocalWords: namespaces strerror const autoconfiguration Dconst Autoconf's FDL
|
||||||
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
LocalWords: Automake TMPDIR LESSEQ ylwrap endif yydebug YYTOKEN YYLSP ival hh
|
||||||
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
LocalWords: extern YYTOKENTYPE TOKENTYPE yytokentype tokentype STYPE lval pdf
|
||||||
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp calc yyo fval
|
LocalWords: lang yyoutput dvi html ps POSIX lvalp llocp calc yyo fval Wmaybe
|
||||||
|
LocalWords: yyvsp pragmas noreturn java's
|
||||||
|
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode: outline
|
mode: outline
|
||||||
|
|||||||
@@ -172,8 +172,8 @@ m4_define([b4_throws], [b4_percent_define_get([[throws]])])
|
|||||||
b4_percent_define_default([[api.location.type]], [Location])])
|
b4_percent_define_default([[api.location.type]], [Location])])
|
||||||
m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
|
m4_define([b4_location_type], [b4_percent_define_get([[api.location.type]])])
|
||||||
|
|
||||||
b4_percent_define_default([[position_type]], [Position])])
|
b4_percent_define_default([[api.position.type]], [Position])])
|
||||||
m4_define([b4_position_type], [b4_percent_define_get([[position_type]])])
|
m4_define([b4_position_type], [b4_percent_define_get([[api.position.type]])])
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|||||||
@@ -5331,7 +5331,7 @@ Some of the accepted @var{variable}s are:
|
|||||||
@findex %define api.location.type
|
@findex %define api.location.type
|
||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item Language(s): C++
|
@item Language(s): C++, Java
|
||||||
|
|
||||||
@item Purpose: Define the location type.
|
@item Purpose: Define the location type.
|
||||||
@xref{User Defined Location Type}.
|
@xref{User Defined Location Type}.
|
||||||
@@ -9458,7 +9458,7 @@ to generate the @file{master/position.hh} and @file{master/location.hh}
|
|||||||
files, reused by other parsers as follows:
|
files, reused by other parsers as follows:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
%define location_type "master::location"
|
%define api.location.type "master::location"
|
||||||
%code requires @{ #include <master/location.hh> @}
|
%code requires @{ #include <master/location.hh> @}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@@ -10175,11 +10175,11 @@ class defines a @dfn{position}, a single point in a file; Bison itself
|
|||||||
defines a class representing a @dfn{location}, a range composed of a pair of
|
defines a class representing a @dfn{location}, a range composed of a pair of
|
||||||
positions (possibly spanning several files). The location class is an inner
|
positions (possibly spanning several files). The location class is an inner
|
||||||
class of the parser; the name is @code{Location} by default, and may also be
|
class of the parser; the name is @code{Location} by default, and may also be
|
||||||
renamed using @code{%define location_type "@var{class-name}"}.
|
renamed using @code{%define api.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
|
||||||
with @code{%define position_type "@var{class-name}"}. This class must
|
with @code{%define api.position.type "@var{class-name}"}. This class must
|
||||||
be supplied by the user.
|
be supplied by the user.
|
||||||
|
|
||||||
|
|
||||||
@@ -10314,7 +10314,7 @@ In both cases, the scanner has to implement the following methods.
|
|||||||
@deftypemethod {Lexer} {void} yyerror (Location @var{loc}, String @var{msg})
|
@deftypemethod {Lexer} {void} yyerror (Location @var{loc}, String @var{msg})
|
||||||
This method is defined by the user to emit an error message. The first
|
This method is defined by the user to emit an error message. The first
|
||||||
parameter is omitted if location tracking is not active. Its type can be
|
parameter is omitted if location tracking is not active. Its type can be
|
||||||
changed using @code{%define location_type "@var{class-name}".}
|
changed using @code{%define api.location.type "@var{class-name}".}
|
||||||
@end deftypemethod
|
@end deftypemethod
|
||||||
|
|
||||||
@deftypemethod {Lexer} {int} yylex ()
|
@deftypemethod {Lexer} {int} yylex ()
|
||||||
@@ -10332,7 +10332,7 @@ Return respectively the first position of the last token that
|
|||||||
@code{yylex} returned, and the first position beyond it. These
|
@code{yylex} returned, and the first position beyond it. These
|
||||||
methods are not needed unless location tracking is active.
|
methods are not needed unless location tracking is active.
|
||||||
|
|
||||||
The return type can be changed using @code{%define position_type
|
The return type can be changed using @code{%define api.position.type
|
||||||
"@var{class-name}".}
|
"@var{class-name}".}
|
||||||
@end deftypemethod
|
@end deftypemethod
|
||||||
|
|
||||||
@@ -10577,10 +10577,11 @@ comma-separated list. Default is @code{java.io.IOException}.
|
|||||||
@xref{Java Scanner Interface}.
|
@xref{Java Scanner Interface}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} {%define location_type} "@var{class}"
|
@deffn {Directive} {%define api.location.type} "@var{class}"
|
||||||
The name of the class used for locations (a range between two
|
The name of the class used for locations (a range between two
|
||||||
positions). This class is generated as an inner class of the parser
|
positions). This class is generated as an inner class of the parser
|
||||||
class by @command{bison}. Default is @code{Location}.
|
class by @command{bison}. Default is @code{Location}.
|
||||||
|
Formerly named @code{location_type}.
|
||||||
@xref{Java Location Values}.
|
@xref{Java Location Values}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@@ -10595,9 +10596,10 @@ The name of the parser class. Default is @code{YYParser} or
|
|||||||
@xref{Java Bison Interface}.
|
@xref{Java Bison Interface}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Directive} {%define position_type} "@var{class}"
|
@deffn {Directive} {%define api.position.type} "@var{class}"
|
||||||
The name of the class used for positions. This class must be supplied by
|
The name of the class used for positions. This class must be supplied by
|
||||||
the user. Default is @code{Position}.
|
the user. Default is @code{Position}.
|
||||||
|
Formerly named @code{position_type}.
|
||||||
@xref{Java Location Values}.
|
@xref{Java Location Values}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@@ -11881,9 +11883,10 @@ London, Department of Computer Science, TR-00-12 (December 2000).
|
|||||||
@c LocalWords: getLVal defvar deftypefn deftypefnx gotos msgfmt Corbett LALR's
|
@c LocalWords: getLVal defvar deftypefn deftypefnx gotos msgfmt Corbett LALR's
|
||||||
@c LocalWords: subdirectory Solaris nonassociativity perror schemas Malloy ints
|
@c LocalWords: subdirectory Solaris nonassociativity perror schemas Malloy ints
|
||||||
@c LocalWords: Scannerless ispell american ChangeLog smallexample CSTYPE CLTYPE
|
@c LocalWords: Scannerless ispell american ChangeLog smallexample CSTYPE CLTYPE
|
||||||
@c LocalWords: clval CDEBUG cdebug deftypeopx yyterminate
|
@c LocalWords: clval CDEBUG cdebug deftypeopx yyterminate LocationType
|
||||||
|
|
||||||
@c Local Variables:
|
@c Local Variables:
|
||||||
@c ispell-dictionary: "american"
|
@c ispell-dictionary: "american"
|
||||||
@c fill-column: 76
|
@c fill-column: 76
|
||||||
@c End:
|
@c End:
|
||||||
|
@c LocalWords: errorVerbose
|
||||||
|
|||||||
@@ -719,8 +719,8 @@ AT_SETUP([Java stype, position_class and location_class])
|
|||||||
AT_CHECK_JAVA_MINIMAL([[
|
AT_CHECK_JAVA_MINIMAL([[
|
||||||
%define stype "java.awt.Color"
|
%define stype "java.awt.Color"
|
||||||
%type<java.awt.Color> start;
|
%type<java.awt.Color> start;
|
||||||
%define location_type "MyLoc"
|
%define api.location.type "MyLoc"
|
||||||
%define position_type "MyPos"
|
%define api.position.type "MyPos"
|
||||||
%code { class MyPos {} }]], [[$$ = $<java.awt.Color>1;]], [[MyPos]])
|
%code { class MyPos {} }]], [[$$ = $<java.awt.Color>1;]], [[MyPos]])
|
||||||
AT_CHECK([[grep 'java.awt.Color' YYParser.java]], [0], [ignore])
|
AT_CHECK([[grep 'java.awt.Color' YYParser.java]], [0], [ignore])
|
||||||
AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Position']], [1], [ignore])
|
AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Position']], [1], [ignore])
|
||||||
@@ -729,8 +729,8 @@ AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Location']], [1], [ignore])
|
|||||||
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
|
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
|
||||||
%define stype "java.awt.Color"
|
%define stype "java.awt.Color"
|
||||||
%type<java.awt.Color> start;
|
%type<java.awt.Color> start;
|
||||||
%define location_type "MyLoc"
|
%define api.location.type "MyLoc"
|
||||||
%define position_type "MyPos"
|
%define api.position.type "MyPos"
|
||||||
%code { class MyPos {} }]], [], [[return EOF;]], [],
|
%code { class MyPos {} }]], [], [[return EOF;]], [],
|
||||||
[[$$ = $<java.awt.Color>1;]],
|
[[$$ = $<java.awt.Color>1;]],
|
||||||
[[java.awt.Color]], [[MyPos]], [[MyLoc]])
|
[[java.awt.Color]], [[MyPos]], [[MyLoc]])
|
||||||
|
|||||||
Reference in New Issue
Block a user