[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/6] java: stype is obsoleted by api.value.type
From: |
Akim Demaille |
Subject: |
[PATCH 4/6] java: stype is obsoleted by api.value.type |
Date: |
Thu, 3 Jan 2013 15:05:48 +0100 |
This is consistent with the other %define variable names.
* data/java.m4: Use api.value.type instead of stype.
* doc/bison.texi, NEWS: Document that change.
* src/muscle-tab.c (muscle_percent_variable_update): Provide backward
compatibility.
* tests/java.at: Adjust.
---
NEWS | 17 ++++++++++-------
data/java.m4 | 4 ++--
doc/bison.texi | 12 ++++++------
src/muscle-tab.c | 1 +
tests/java.at | 14 +++++++-------
5 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/NEWS b/NEWS
index d4f8a75..a44e1be 100644
--- a/NEWS
+++ b/NEWS
@@ -198,6 +198,16 @@ GNU Bison NEWS
used by the scanner, or rejecting invalid combinations from a
factory invoked by the user actions).
+** Renamed %define variables
+
+ The following variables have been renamed for consistency. Backward
+ compatibility is ensured, but upgrading is recommended.
+
+ lr.default-reductions -> lr.default-reduction
+ lr.keep-unreachable-states -> lr.keep-unreachable-state
+ namespace -> api.namespace
+ stype -> api.value.type
+
** Variable api.token.prefix
The variable api.token.prefix changes the way tokens are identified in
@@ -214,14 +224,7 @@ GNU Bison NEWS
use these prefixed token names, although the grammar itself still
uses the short names (as in the sample rule given above).
-** Renamed %define variables
-
- The following variables have been renamed for consistency. Backward
- compatibility is ensured, but upgrading is recommended.
- lr.default-reductions -> lr.default-reduction
- lr.keep-unreachable-states -> lr.keep-unreachable-state
- namespace -> api.namespace
** Variable parse.error
diff --git a/data/java.m4 b/data/java.m4
index 2be2359..97e9548 100644
--- a/data/java.m4
+++ b/data/java.m4
@@ -173,8 +173,8 @@ m4_define([b4_predicate_case], [ case $1:
## Default values. ##
## ---------------- ##
-m4_define([b4_yystype], [b4_percent_define_get([[stype]])])
-b4_percent_define_default([[stype]], [[Object]])
+m4_define([b4_yystype], [b4_percent_define_get([[api.value.type]])])
+b4_percent_define_default([[api.value.type]], [[Object]])
# %name-prefix
m4_define_default([b4_prefix], [[YY]])
diff --git a/doc/bison.texi b/doc/bison.texi
index bc7b167..7a7511a 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -11233,11 +11233,11 @@ semantic values' types (class names) should be
specified in the
By default, the semantic stack is declared to have @code{Object} members,
which means that the class types you specify can be of any class.
To improve the type safety of the parser, you can declare the common
-superclass of all the semantic values using the @samp{%define stype}
+superclass of all the semantic values using the @samp{%define api.value.type}
directive. For example, after the following declaration:
@example
-%define stype "ASTNode"
+%define api.value.type "ASTNode"
@end example
@noindent
@@ -11463,7 +11463,7 @@ The return type can be changed using @code{%define
api.position.type
@deftypemethod {Lexer} {Object} getLVal ()
Return the semantic value of the last token that yylex returned.
-The return type can be changed using @samp{%define stype
+The return type can be changed using @samp{%define api.value.type
"@var{class-name}".}
@end deftypemethod
@@ -11491,7 +11491,7 @@ Like @address@hidden but specifies a alternative type
@var{typealt}.
@defvar $$
The semantic value for the grouping made by the current rule. As a
value, this is in the base type (@code{Object} or as specified by
address@hidden stype}) as in not cast to the declared subtype because
address@hidden api.value.type}) as in not cast to the declared subtype because
casts are not allowed on the left-hand side of Java assignments.
Use an explicit Java cast if the correct subtype is needed.
@xref{Java Semantic Values}.
@@ -11573,7 +11573,7 @@ corresponds to these C macros.}.
@item
Java lacks unions, so @code{%union} has no effect. Instead, semantic
values have a common base type: @code{Object} or as specified by
address@hidden stype}. Angle brackets on @code{%token}, @code{type},
address@hidden api.value.type}. Angle brackets on @code{%token}, @code{type},
@address@hidden and @code{$$} specify subtypes rather than fields of
an union. The type of @code{$$}, even with angle brackets, is the base
type since Java casts are not allow on the left-hand side of assignments.
@@ -11749,7 +11749,7 @@ Whether the parser class is declared @code{public}.
Default is false.
@xref{Java Bison Interface}.
@end deffn
address@hidden {Directive} {%define stype} "@var{class}"
address@hidden {Directive} {%define api.value.type} "@var{class}"
The base type of semantic values. Default is @code{Object}.
@xref{Java Semantic Values}.
@end deffn
diff --git a/src/muscle-tab.c b/src/muscle-tab.c
index e40da8d..1a1ada0 100644
--- a/src/muscle-tab.c
+++ b/src/muscle-tab.c
@@ -439,6 +439,7 @@ muscle_percent_variable_update (char const *variable,
location variable_loc,
{ "lr.keep-unreachable-states", "lr.keep-unreachable-state", },
{ "lr.keep_unreachable_states", "lr.keep-unreachable-state", },
{ "namespace", "api.namespace", },
+ { "stype", "api.value.type", },
{ "variant=", "api.value.type=variant", },
{ "variant=true", "api.value.type=variant", },
{ NULL, NULL, }
diff --git a/tests/java.at b/tests/java.at
index 1c9bd50..2a1ba51 100644
--- a/tests/java.at
+++ b/tests/java.at
@@ -408,7 +408,7 @@ AT_JAVA_COMPILE([[YYParser.java]])
# AT_CHECK_JAVA_MINIMAL_W_LEXER([1:DIRECTIVES], [2:LEX_THROWS],
-# [3:YYLEX_ACTION], [4:LEXER_BODY], [5:PARSER_ACTION], [6:STYPE],
+# [3:YYLEX_ACTION], [4:LEXER_BODY], [5:PARSER_ACTION], [6:VALUE_TYPE],
# [7:POSITION_TYPE], [8:LOCATION_TYPE])
# ---------------------------------------------------------------------
# Check that a mininal parser with DIRECTIVES and a "%code lexer".
@@ -742,14 +742,14 @@ AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw
new InterruptedExcepti
AT_CLEANUP
-# --------------------------------------------- #
-# Java stype, position_class and location_class #
-# --------------------------------------------- #
+# ------------------------------------------ #
+# Java value, position, and location types. #
+# ------------------------------------------ #
-AT_SETUP([Java stype, position_class and location_class])
+AT_SETUP([Java value, position, and location types])
AT_CHECK_JAVA_MINIMAL([[
-%define stype "java.awt.Color"
+%define api.value.type "java.awt.Color"
%type<java.awt.Color> start;
%define api.location.type "MyLoc"
%define api.position.type "MyPos"
@@ -759,7 +759,7 @@ AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep
'Position']], [1], [ignore])
AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Location']], [1], [ignore])
AT_CHECK_JAVA_MINIMAL_W_LEXER([[
-%define stype "java.awt.Color"
+%define api.value.type "java.awt.Color"
%type<java.awt.Color> start;
%define api.location.type "MyLoc"
%define api.position.type "MyPos"
--
1.8.0.2
- [PATCH 0/6] {master} prepare the documentation for api.value.type, Akim Demaille, 2013/01/03
- [PATCH 2/6] todo: remove erroneous task, Akim Demaille, 2013/01/03
- [PATCH 1/6] gnulib: update, Akim Demaille, 2013/01/03
- [PATCH 3/6] doc: fix html build, Akim Demaille, 2013/01/03
- [PATCH 5/6] doc: minor completion and fixes, Akim Demaille, 2013/01/03
- [PATCH 6/6] doc: use deffn to declare the list of %define variables, Akim Demaille, 2013/01/03
- [PATCH 4/6] java: stype is obsoleted by api.value.type,
Akim Demaille <=