mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
java: fix support for api.prefix
* data/skeletons/java.m4: here. * tests/java.at: Check it.
This commit is contained in:
3
NEWS
3
NEWS
@@ -2,6 +2,9 @@ GNU Bison NEWS
|
||||
|
||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
In Java, %define api.prefix was ignored. It now behaves as expected.
|
||||
|
||||
* Noteworthy changes in release 3.4.1 (2019-05-22) [stable]
|
||||
|
||||
|
||||
@@ -184,8 +184,19 @@ b4_percent_define_check_kind([[throws]], [code], [deprecated])
|
||||
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]])
|
||||
# b4_api_prefix, b4_api_PREFIX
|
||||
# ----------------------------
|
||||
# Corresponds to %define api.prefix
|
||||
b4_percent_define_default([[api.prefix]], [[YY]])
|
||||
m4_define([b4_api_prefix],
|
||||
[b4_percent_define_get([[api.prefix]])])
|
||||
m4_define([b4_api_PREFIX],
|
||||
[m4_toupper(b4_api_prefix)])
|
||||
|
||||
# b4_prefix
|
||||
# ---------
|
||||
# If the %name-prefix is not given, it is api.prefix.
|
||||
m4_define_default([b4_prefix], [b4_api_prefix])
|
||||
|
||||
b4_percent_define_default([[api.parser.class]], [b4_prefix[]Parser])
|
||||
m4_define([b4_parser_class], [b4_percent_define_get([[api.parser.class]])])
|
||||
|
||||
@@ -6068,7 +6068,7 @@ Introduced in Bison 3.3 to replace @code{parser_class_name}.
|
||||
|
||||
@item Accepted Values: String
|
||||
|
||||
@item Default Value: @code{yy}
|
||||
@item Default Value: @code{YY} for Java, @code{yy} otherwise.
|
||||
|
||||
@item History: introduced in Bison 2.6
|
||||
@end itemize
|
||||
|
||||
@@ -60,7 +60,7 @@ AT_BISON_OPTION_PUSHDEFS([%language "Java" $4])
|
||||
AT_DATA_GRAMMAR([Calc.y],
|
||||
[[/* Infix notation calculator--calc */
|
||||
%language "Java"
|
||||
%name-prefix "Calc"
|
||||
%define api.prefix {Calc}
|
||||
%define api.parser.class {Calc}
|
||||
%define public
|
||||
|
||||
@@ -444,6 +444,9 @@ AT_CHECK_JAVA_GREP([[class YYParser]])
|
||||
AT_CHECK_JAVA_MINIMAL([[%name-prefix "Prefix"]])
|
||||
AT_CHECK_JAVA_GREP([[class PrefixParser]])
|
||||
|
||||
AT_CHECK_JAVA_MINIMAL([[%define api.prefix {Prefix}]])
|
||||
AT_CHECK_JAVA_GREP([[class PrefixParser]])
|
||||
|
||||
AT_CHECK_JAVA_MINIMAL([[%define api.token.prefix {TOK_}]])
|
||||
AT_CHECK_JAVA_GREP([[.*TOK_END.*]])
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ m4_pushdef([AT_NAME_PREFIX],
|
||||
[m4_bregexp([$3],
|
||||
[\(%define api\.prefix\|%name-prefix\) [\{\"]\([^\"\}]*\)[\"\}]],
|
||||
[\2])],
|
||||
[yy])])
|
||||
[AT_JAVA_IF([YY], [yy])])])
|
||||
# AT_NAMESPACE: also consider api.prefix. FIXME: Stop that confusion.
|
||||
m4_pushdef([AT_NAMESPACE],
|
||||
[m4_bmatch([$3], [\(%define api\.\(namespace\|prefix\)\|%name-prefix\) .*],
|
||||
@@ -218,7 +218,7 @@ m4_pushdef([AT_VARIANT_IF],
|
||||
m4_pushdef([AT_API_prefix],
|
||||
[m4_bmatch([$3], [%define api\.prefix {.*}],
|
||||
[m4_bregexp([$3], [%define api\.prefix {\([^\}]*\)}], [\1])],
|
||||
[yy])])
|
||||
[AT_JAVA_IF([YY], [yy])])])
|
||||
m4_pushdef([AT_API_PREFIX],
|
||||
[m4_toupper(AT_API_prefix)])
|
||||
# yyerror receives the location if %location, and if the parser is pure. For
|
||||
@@ -782,7 +782,7 @@ m4_define([AT_MAIN_DEFINE(java)],
|
||||
{
|
||||
public static void main (String args[]) throws IOException
|
||||
{
|
||||
YYParser p = new YYParser ();
|
||||
]AT_API_prefix[Parser p = new ]AT_API_prefix[Parser ();
|
||||
System.exit (p.parse () ? 0 : 1);
|
||||
}
|
||||
}]])
|
||||
|
||||
Reference in New Issue
Block a user