bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

java: rename package as api.package


From: Akim Demaille
Subject: java: rename package as api.package
Date: Sun, 28 Jun 2020 09:52:18 +0200

commit e0b0a67b863ba3f1e3cc5f8c5ae33f9614de86e7
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Sun Jun 28 09:49:00 2020 +0200

    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.

diff --git a/NEWS b/NEWS
index 82636252..60587f7f 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
diff --git a/data/skeletons/lalr1.java b/data/skeletons/lalr1.java
index 73df2e7a..419d5c49 100644
--- a/data/skeletons/lalr1.java
+++ b/data/skeletons/lalr1.java
@@ -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[
diff --git a/doc/bison.texi b/doc/bison.texi
index e50e1cf7..678b6efe 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -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}@}
diff --git a/src/muscle-tab.c b/src/muscle-tab.c
index 2cc136a1..9d1c266e 100644
--- a/src/muscle-tab.c
+++ b/src/muscle-tab.c
@@ -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 },
diff --git a/tests/java.at b/tests/java.at
index cc4e8759..57472446 100644
--- a/tests/java.at
+++ b/tests/java.at
@@ -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"})*/}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]