From d1aa1ebed52b917fa5f7adffcde3c59c5596156d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jesper=20=C3=96qvist?= <jesper.oqvist@cs.lth.se>
Date: Mon, 24 Oct 2016 14:51:03 +0200
Subject: [PATCH] Change default AST state class name to ASTState

The AST state class previously had the default name ASTNode$State to avoid
conflict with other class names. However, it is usually considered bad practice
to use the dollar sign in class names, since the Java compiler uses the dollar
sign in the names of implicitly generated classes.
---
 ChangeLog                               | 5 +++++
 src/jastadd/ast/JaddCodeGen.jrag        | 4 ++--
 src/java/org/jastadd/Configuration.java | 2 +-
 src/template/ast/State.tt               | 4 ++--
 4 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3b7bd0ec..eeefc325 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-10-24  Jesper Öqvist <jesper.oqvist@cs.lth.se>
+
+    * Changed default name of the AST state class from ASTNode$State to
+    ASTState. This can be changed by the --stateClassName=NAME option.
+
 2016-05-29  Jesper Öqvist <joqvist@google.com>
 
     * Inherited equations on parameterized NTAs can no longer use the child
diff --git a/src/jastadd/ast/JaddCodeGen.jrag b/src/jastadd/ast/JaddCodeGen.jrag
index 00f431c8..d12335ad 100644
--- a/src/jastadd/ast/JaddCodeGen.jrag
+++ b/src/jastadd/ast/JaddCodeGen.jrag
@@ -248,7 +248,7 @@ aspect JaddCodeGen {
   }
 
   public void Grammar.genReset(PrintWriter out) {
-    templateContext().expand("ASTNode$State.reset", out);
+    templateContext().expand("ASTState.reset", out);
   }
 
   /**
@@ -257,7 +257,7 @@ aspect JaddCodeGen {
    * @param out Aspect output stream
    */
   public void Grammar.emitStateClass(PrintWriter out) {
-    templateContext().expand("ASTNode$State", out);
+    templateContext().expand("ASTState", out);
   }
 
   /**
diff --git a/src/java/org/jastadd/Configuration.java b/src/java/org/jastadd/Configuration.java
index 28021029..ef2a433c 100644
--- a/src/java/org/jastadd/Configuration.java
+++ b/src/java/org/jastadd/Configuration.java
@@ -103,7 +103,7 @@ public class Configuration {
   Option<String> stateClassNameOption = new ValueOption("stateClassName",
       "set the name of the AST state class")
       .acceptAnyValue()
-      .defaultValue("ASTNode$State")
+      .defaultValue("ASTState")
       .templateVariable("StateClass");
 
   Option<String> ASTNodeSuperOption = new ValueOption("ASTNodeSuper", "set the ASTNode supertype")
diff --git a/src/template/ast/State.tt b/src/template/ast/State.tt
index 31b6963b..0b07c4c4 100644
--- a/src/template/ast/State.tt
+++ b/src/template/ast/State.tt
@@ -25,7 +25,7 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-ASTNode$State = [[
+ASTState = [[
 /** @apilevel internal */
 public class $StateClass {
   /** @apilevel internal */
@@ -255,7 +255,7 @@ $endif
 }
 ]]
 
-ASTNode$State.reset [[
+ASTState.reset [[
   /** @apilevel internal */
   public void $StateClass.reset() {
     $SynchBegin
-- 
GitLab