java: rename package as api.package

* data/skeletons/lalr1.java: here.
* doc/bison.texi: Update.
* src/muscle-tab.c: Ensure backward compat.
* tests/java.at: Check it.
This commit is contained in:
Akim Demaille
2020-06-28 09:49:00 +02:00
parent 0e5cbd38b2
commit e0b0a67b86
5 changed files with 25 additions and 5 deletions

10
NEWS
View File

@@ -34,6 +34,14 @@ GNU Bison NEWS
It now defaults to `const std::string` instead of `std::string`.
*** Deprecated %define variable names
The following variables have been renamed for consistency. Backward
compatibility is ensured, but upgrading is recommended.
filename_type -> api.filename.type
package -> api.package
** Bug fixes
*** Include the generated header (yacc.c)
@@ -1943,7 +1951,7 @@ GNU Bison NEWS
%error-verbose directive is deprecated in favor of "%define parse.error
verbose".
** Renamed %define variables
** Deprecated %define variable names
The following variables have been renamed for consistency. Backward
compatibility is ensured, but upgrading is recommended.

View File

@@ -79,7 +79,7 @@ m4_define([b4_define_state],[[
]b4_copyright([Skeleton implementation for Bison LALR(1) parsers in Java],
[2007-2015, 2018-2020])[
]b4_disclaimer[
]b4_percent_define_ifdef([package], [package b4_percent_define_get([package]);[
]b4_percent_define_ifdef([api.package], [package b4_percent_define_get([api.package]);[
]])[
]b4_user_pre_prologue[
]b4_user_post_prologue[

View File

@@ -13688,8 +13688,8 @@ The prologue declarations have a different meaning than in C/C++ code.
@table @asis
@item @code{%code imports}
blocks are placed at the beginning of the Java source code. They may
include copyright notices. For a @code{package} declarations, it is
suggested to use @samp{%define package} instead.
include copyright notices. For a @code{package} declarations, use
@samp{%define api.package} instead.
@item unqualified @code{%code}
blocks are placed inside the parser class.
@@ -13843,9 +13843,10 @@ Formerly named @code{location_type}.
@xref{Java Location Values}.
@end deffn
@deffn {Directive} {%define package} @{@var{package}@}
@deffn {Directive} {%define api.package} @{@var{package}@}
The package to put the parser class in. Default is none.
@xref{Java Bison Interface}.
Renamed from @code{package} in Bison 3.7.
@end deffn
@deffn {Directive} {%define api.position.type} @{@var{class}@}

View File

@@ -456,6 +456,7 @@ muscle_percent_variable_update (char const *variable,
{ "lr.keep-unreachable-states", "lr.keep-unreachable-state", muscle_keyword },
{ "lr.keep_unreachable_states", "lr.keep-unreachable-state", muscle_keyword },
{ "namespace", "api.namespace", muscle_code },
{ "package", "api.package", muscle_code },
{ "parser_class_name", "api.parser.class", muscle_code },
{ "public", "api.parser.public", muscle_keyword },
{ "strictfp", "api.parser.strictfp", muscle_keyword },

View File

@@ -185,6 +185,10 @@ AT_CHECK_JAVA_GREP([[.*TOK_END.*]])
AT_CHECK_JAVA_MINIMAL([[%define api.parser.class {ParserClassName}]])
AT_CHECK_JAVA_GREP([[class ParserClassName]])
AT_CHECK_JAVA_MINIMAL([[%define api.package {user_java_package}]])
AT_CHECK_JAVA_GREP([[package user_java_package;]])
# Backward compatibility.
AT_CHECK_JAVA_MINIMAL([[%define package {user_java_package}]])
AT_CHECK_JAVA_GREP([[package user_java_package;]])
@@ -246,6 +250,12 @@ AT_CHECK_JAVA_MINIMAL([[
%define strictfp]])
AT_CHECK_JAVA_GREP([[public final strictfp class YYParser]])
AT_CHECK_JAVA_MINIMAL([[
%define api.parser.public
%define api.parser.final
%define api.parser.strictfp]])
AT_CHECK_JAVA_GREP([[public final strictfp class YYParser]])
# FIXME: Can't do a Java compile because javacomp.sh is configured for 1.3
AT_CHECK_JAVA_MINIMAL([[
%define annotations {/*@Deprecated @SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "deprecation"}) @SuppressWarnings(value={"unchecked", "deprecation"})*/}