From a20912ba7321c4ae5faaf04187b45b305d0c1f76 Mon Sep 17 00:00:00 2001 From: parrt Date: Sat, 9 Jul 2011 16:27:01 -0800 Subject: [PATCH] got rid of ...IsRoot templates and model elements! [git-p4: depot-paths = "//depot/code/antlr4/main/": change = 8848] --- tool/playground/T.g | 2 +- .../v4/tool/templates/codegen/Java/Java.stg | 45 +++++---------- .../org/antlr/v4/codegen/ParserFactory.java | 57 +++++++------------ .../v4/codegen/model/ast/RewriteAction.java | 5 +- ...ActionIsRoot.java => RewriteAddChild.java} | 13 +++-- ...lRefIsRoot.java => RewriteBecomeRoot.java} | 13 +++-- .../model/ast/RewriteImagTokenRef.java | 3 - .../model/ast/RewriteImagTokenRefIsRoot.java | 44 -------------- .../v4/codegen/model/ast/RewriteLabelRef.java | 4 +- .../model/ast/RewriteLabelRefIsRoot.java | 40 ------------- .../v4/codegen/model/ast/RewriteRuleRef.java | 4 +- .../model/ast/RewriteRuleRefIsRoot.java | 41 ------------- .../model/ast/RewriteSelfRuleLabelRef.java | 5 +- .../v4/codegen/model/ast/RewriteTokenRef.java | 4 +- .../model/ast/RewriteTokenRefIsRoot.java | 41 ------------- 15 files changed, 60 insertions(+), 261 deletions(-) rename tool/src/org/antlr/v4/codegen/model/ast/{RewriteActionIsRoot.java => RewriteAddChild.java} (83%) rename tool/src/org/antlr/v4/codegen/model/ast/{RewriteSelfRuleLabelRefIsRoot.java => RewriteBecomeRoot.java} (83%) delete mode 100644 tool/src/org/antlr/v4/codegen/model/ast/RewriteImagTokenRefIsRoot.java delete mode 100644 tool/src/org/antlr/v4/codegen/model/ast/RewriteLabelRefIsRoot.java delete mode 100644 tool/src/org/antlr/v4/codegen/model/ast/RewriteRuleRefIsRoot.java delete mode 100644 tool/src/org/antlr/v4/codegen/model/ast/RewriteTokenRefIsRoot.java diff --git a/tool/playground/T.g b/tool/playground/T.g index f11e6e2ac..e50015c8e 100644 --- a/tool/playground/T.g +++ b/tool/playground/T.g @@ -2,7 +2,7 @@ grammar T; options {output=AST;} tokens {I;} -a : x+=b x+=b -> {new CommonTree()} ; +a : A B -> ^(A B); atom : A ; diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg index d4e3478d7..4c323606c 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Java/Java.stg @@ -428,44 +428,27 @@ RewriteTreeStructure(t, locals, ops) ::= << } >> -RewriteTokenRef(t) ::= "_adaptor.addChild(, .next());" -RewriteTokenRefIsRoot(t) ::= << - = _adaptor.becomeRoot(.next(), ); +RewriteTokenRef(t) ::= ".next()" + +RewriteImagTokenRef(t, argChunks) ::= << +_adaptor.create(, "") >> -//adaptor.addChild(root_0, (Object)adaptor.create(D, "D")); -RewriteImagTokenRef(t, argChunks) ::= <% -_adaptor.addChild(, - _adaptor.create(, - "") -); -%> -RewriteImagTokenRefIsRoot(t, argChunks) ::= <% - = - _adaptor.becomeRoot( - _adaptor.create(, - ""), - - ); -%> -RewriteRuleRef(r) ::= "_adaptor.addChild(, .next());" -RewriteRuleRefIsRoot(r) ::= - " = _adaptor.becomeRoot(.next(), );" +RewriteRuleRef(r) ::= ".next()" -RewriteLabelRef(t) ::= ".next()})>" -RewriteLabelRefIsRoot(t) ::= ".next()}, t.rootName)>" +RewriteLabelRef(t) ::= ".next()" // -> $e in rule e -RewriteSelfRuleLabelRef(s) ::= "" -RewriteSelfRuleLabelRefIsRoot(s) ::= "" +RewriteSelfRuleLabelRef(s) ::= "_localctx.tree" -RewriteAction(a, chunks) ::= "" -RewriteActionIsRoot(a, chunks) ::= "" +RewriteAction(a, chunks) ::= "" -// how to add child, make root -RewriteAddChild(rootName, child) ::= "_adaptor.addChild(, );" -RewriteBecomeRoot(newRoot, rootName) ::= - " = _adaptor.becomeRoot(, );" +/** how to add child in rewrite section */ +RewriteAddChild(x, rootName, child) ::= "_adaptor.addChild(, );" + +/** how to make something a new root in rewrite section */ +RewriteBecomeRoot(x, newRoot) ::= + " = _adaptor.becomeRoot(, );" /* diff --git a/tool/src/org/antlr/v4/codegen/ParserFactory.java b/tool/src/org/antlr/v4/codegen/ParserFactory.java index bbf5e250f..442e03d4e 100644 --- a/tool/src/org/antlr/v4/codegen/ParserFactory.java +++ b/tool/src/org/antlr/v4/codegen/ParserFactory.java @@ -244,68 +244,55 @@ public class ParserFactory extends DefaultOutputModelFactory { } public List rewrite_ruleRef(GrammarAST ID, boolean isRoot) { - String rootName = gen.target.getRootName(getTreeLevel()); - RewriteRuleRef ruleRef; String iterName = gen.target.getRewriteIteratorName(ID, getCodeBlockLevel()); - if ( isRoot ) ruleRef = new RewriteRuleRefIsRoot(this, ID, rootName, iterName); - else ruleRef = new RewriteRuleRef(this, ID, rootName, iterName); - return list(ruleRef); + RewriteRuleRef ruleRef = new RewriteRuleRef(this, ID, iterName); + return list(makeChildOrRoot(ruleRef, isRoot)); } public List rewrite_tokenRef(GrammarAST ID, boolean isRoot, ActionAST argAST) { Alternative alt = getCurrentAlt(); - String rootName = gen.target.getRootName(getTreeLevel()); String iterName = gen.target.getRewriteIteratorName(ID, getCodeBlockLevel()); // not ref'd on left hand side or it is but we have an argument like ID["x"] // implies create new node + SrcOp tokenRef; if ( alt.tokenRefs.get(ID.getText())==null || argAST!=null ) { - RewriteImagTokenRef tokenRef; - if ( isRoot ) { - tokenRef = new RewriteImagTokenRefIsRoot(this, ID, rootName, - ID.getText(), argAST); - } - else { - tokenRef = new RewriteImagTokenRef(this, ID, rootName, - ID.getText(), argAST); - } - return list(tokenRef); + tokenRef = new RewriteImagTokenRef(this, ID, ID.getText(), argAST); } - // must be token ref on left of -> - RewriteTokenRef tokenRef; - if ( isRoot ) tokenRef = new RewriteTokenRefIsRoot(this, ID, rootName, iterName); - else tokenRef = new RewriteTokenRef(this, ID, rootName, iterName); - return list(tokenRef); + else { // must be token ref on left of -> + tokenRef = new RewriteTokenRef(this, ID, iterName); + } + return list(makeChildOrRoot(tokenRef, isRoot)); } @Override public List rewrite_labelRef(GrammarAST ID, boolean isRoot) { - String rootName = gen.target.getRootName(getTreeLevel()); String iterName = gen.target.getRewriteIteratorName(ID, getCodeBlockLevel()); + SrcOp labelRef; if ( ID.getText().equals(getCurrentRuleFunction().rule.name) ) { // $e in rule e - RewriteSelfRuleLabelRef labelRef; - if ( isRoot ) labelRef = new RewriteSelfRuleLabelRef(this, ID, rootName); - else labelRef = new RewriteSelfRuleLabelRef(this, ID, rootName); - return list(labelRef); + labelRef = new RewriteSelfRuleLabelRef(this, ID); } else { // normal element label - RewriteLabelRef labelRef; - if ( isRoot ) labelRef = new RewriteLabelRefIsRoot(this, ID, rootName, iterName); - else labelRef = new RewriteLabelRef(this, ID, rootName, iterName); - return list(labelRef); + labelRef = new RewriteLabelRef(this, ID, iterName); } + return list(makeChildOrRoot(labelRef, isRoot)); } @Override public List rewrite_action(ActionAST actionAST, boolean isRoot) { - String rootName = gen.target.getRootName(getTreeLevel()); - RewriteAction action; - if ( isRoot ) action = new RewriteActionIsRoot(this, actionAST, rootName); - else action = new RewriteAction(this, actionAST, rootName); - return list(action); + RewriteAction action = new RewriteAction(this, actionAST); + return list(makeChildOrRoot(action, isRoot)); } // support + public SrcOp makeChildOrRoot(SrcOp elemToAdd, boolean isRoot) { + String rootName = gen.target.getRootName(getTreeLevel()); + SrcOp op; + if ( isRoot ) op = new RewriteBecomeRoot(this, rootName, elemToAdd); + else op = new RewriteAddChild(this, rootName, elemToAdd); + return op; + } + public void defineImplicitLabel(GrammarAST ID, LabeledOp op) { Decl d; Rule r = g.getRule(ID.getText()); diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteAction.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteAction.java index 11b346ff6..85986edf6 100644 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteAction.java +++ b/tool/src/org/antlr/v4/codegen/model/ast/RewriteAction.java @@ -37,13 +37,10 @@ import org.antlr.v4.tool.ActionAST; import java.util.List; public class RewriteAction extends SrcOp { - public String rootName; - @ModelElement public List chunks; - public RewriteAction(OutputModelFactory factory, ActionAST ast, String rootName) { + public RewriteAction(OutputModelFactory factory, ActionAST ast) { super(factory, ast); - this.rootName = rootName; if ( ast!=null ) { chunks = ActionTranslator.translateAction(factory, factory.getCurrentRuleFunction(), diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteActionIsRoot.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteAddChild.java similarity index 83% rename from tool/src/org/antlr/v4/codegen/model/ast/RewriteActionIsRoot.java rename to tool/src/org/antlr/v4/codegen/model/ast/RewriteAddChild.java index 324482591..9f71089ca 100644 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteActionIsRoot.java +++ b/tool/src/org/antlr/v4/codegen/model/ast/RewriteAddChild.java @@ -30,10 +30,15 @@ package org.antlr.v4.codegen.model.ast; import org.antlr.v4.codegen.OutputModelFactory; -import org.antlr.v4.tool.ActionAST; +import org.antlr.v4.codegen.model.*; -public class RewriteActionIsRoot extends RewriteAction { - public RewriteActionIsRoot(OutputModelFactory factory, ActionAST ast, String rootName) { - super(factory, ast, rootName); +public class RewriteAddChild extends SrcOp { + public String rootName; + @ModelElement public SrcOp child; + + public RewriteAddChild(OutputModelFactory factory, String rootName, SrcOp child) { + super(factory); + this.rootName = rootName; + this.child = child; } } diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteSelfRuleLabelRefIsRoot.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteBecomeRoot.java similarity index 83% rename from tool/src/org/antlr/v4/codegen/model/ast/RewriteSelfRuleLabelRefIsRoot.java rename to tool/src/org/antlr/v4/codegen/model/ast/RewriteBecomeRoot.java index 3550234dd..74339a5f2 100644 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteSelfRuleLabelRefIsRoot.java +++ b/tool/src/org/antlr/v4/codegen/model/ast/RewriteBecomeRoot.java @@ -30,10 +30,15 @@ package org.antlr.v4.codegen.model.ast; import org.antlr.v4.codegen.OutputModelFactory; -import org.antlr.v4.tool.GrammarAST; +import org.antlr.v4.codegen.model.*; -public class RewriteSelfRuleLabelRefIsRoot extends RewriteSelfRuleLabelRef { - public RewriteSelfRuleLabelRefIsRoot(OutputModelFactory factory, GrammarAST ast, String rootName) { - super(factory, ast, rootName); +public class RewriteBecomeRoot extends SrcOp { + public String rootName; + @ModelElement public SrcOp newRoot; + + public RewriteBecomeRoot(OutputModelFactory factory, String rootName, SrcOp newRoot) { + super(factory); + this.rootName = rootName; + this.newRoot = newRoot; } } diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteImagTokenRef.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteImagTokenRef.java index 5c7b967aa..dff9386af 100644 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteImagTokenRef.java +++ b/tool/src/org/antlr/v4/codegen/model/ast/RewriteImagTokenRef.java @@ -37,19 +37,16 @@ import org.antlr.v4.tool.*; import java.util.List; public class RewriteImagTokenRef extends SrcOp { - public String rootName; public String tokenType; @ModelElement public List argChunks; public RewriteImagTokenRef(OutputModelFactory factory, GrammarAST ast, - String rootName, String tokenType, ActionAST argAST) { super(factory, ast); - this.rootName = rootName; this.tokenType = tokenType; if ( argAST!=null ) { argChunks = ActionTranslator.translateAction(factory, diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteImagTokenRefIsRoot.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteImagTokenRefIsRoot.java deleted file mode 100644 index d29f9225f..000000000 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteImagTokenRefIsRoot.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - [The "BSD license"] - Copyright (c) 2011 Terence Parr - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.antlr.v4.codegen.model.ast; - -import org.antlr.v4.codegen.OutputModelFactory; -import org.antlr.v4.tool.*; - -public class RewriteImagTokenRefIsRoot extends RewriteImagTokenRef { - public RewriteImagTokenRefIsRoot(OutputModelFactory factory, - GrammarAST ast, - String rootName, - String tokenType, - ActionAST argAST) - { - super(factory, ast, rootName, tokenType, argAST); - } -} diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteLabelRef.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteLabelRef.java index 034ea1174..024c11036 100644 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteLabelRef.java +++ b/tool/src/org/antlr/v4/codegen/model/ast/RewriteLabelRef.java @@ -34,13 +34,11 @@ import org.antlr.v4.codegen.model.SrcOp; import org.antlr.v4.tool.GrammarAST; public class RewriteLabelRef extends SrcOp { - public String rootName; public String iterName; public RewriteLabelRef(OutputModelFactory factory, GrammarAST ast, - String rootName, String iterName) { + String iterName) { super(factory, ast); - this.rootName = rootName; this.iterName = iterName; } } diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteLabelRefIsRoot.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteLabelRefIsRoot.java deleted file mode 100644 index 5abd33bcd..000000000 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteLabelRefIsRoot.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - [The "BSD license"] - Copyright (c) 2011 Terence Parr - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.antlr.v4.codegen.model.ast; - -import org.antlr.v4.codegen.OutputModelFactory; -import org.antlr.v4.tool.GrammarAST; - -public class RewriteLabelRefIsRoot extends RewriteLabelRef { - public RewriteLabelRefIsRoot(OutputModelFactory factory, GrammarAST ast, - String rootName, String iterName) { - super(factory, ast, rootName, iterName); - } -} diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteRuleRef.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteRuleRef.java index eff6ba6cf..6a4503620 100644 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteRuleRef.java +++ b/tool/src/org/antlr/v4/codegen/model/ast/RewriteRuleRef.java @@ -34,14 +34,12 @@ import org.antlr.v4.codegen.model.SrcOp; import org.antlr.v4.tool.GrammarAST; public class RewriteRuleRef extends SrcOp { - public String rootName; public String iterName; public RewriteRuleRef(OutputModelFactory factory, GrammarAST ast, - String rootName, String iterName) + String iterName) { super(factory, ast); - this.rootName = rootName; this.iterName = iterName; } } diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteRuleRefIsRoot.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteRuleRefIsRoot.java deleted file mode 100644 index 68c05d02a..000000000 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteRuleRefIsRoot.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - [The "BSD license"] - Copyright (c) 2011 Terence Parr - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.antlr.v4.codegen.model.ast; - -import org.antlr.v4.codegen.OutputModelFactory; -import org.antlr.v4.tool.GrammarAST; - -public class RewriteRuleRefIsRoot extends RewriteRuleRef { - public RewriteRuleRefIsRoot(OutputModelFactory factory, GrammarAST ast, - String rootName, String iterName) - { - super(factory, ast, rootName, iterName); - } -} diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteSelfRuleLabelRef.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteSelfRuleLabelRef.java index c6740be01..4f68d537e 100644 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteSelfRuleLabelRef.java +++ b/tool/src/org/antlr/v4/codegen/model/ast/RewriteSelfRuleLabelRef.java @@ -34,10 +34,7 @@ import org.antlr.v4.codegen.model.SrcOp; import org.antlr.v4.tool.GrammarAST; public class RewriteSelfRuleLabelRef extends SrcOp { - public String rootName; - - public RewriteSelfRuleLabelRef(OutputModelFactory factory, GrammarAST ast, String rootName) { + public RewriteSelfRuleLabelRef(OutputModelFactory factory, GrammarAST ast) { super(factory, ast); - this.rootName = rootName; } } diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteTokenRef.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteTokenRef.java index d19dd1b20..b7c54a072 100644 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteTokenRef.java +++ b/tool/src/org/antlr/v4/codegen/model/ast/RewriteTokenRef.java @@ -34,13 +34,11 @@ import org.antlr.v4.codegen.model.SrcOp; import org.antlr.v4.tool.GrammarAST; public class RewriteTokenRef extends SrcOp { - public String rootName; public String iterName; public RewriteTokenRef(OutputModelFactory factory, GrammarAST ast, - String rootName, String iterName) + String iterName) { super(factory, ast); - this.rootName = rootName; this.iterName = iterName; } } diff --git a/tool/src/org/antlr/v4/codegen/model/ast/RewriteTokenRefIsRoot.java b/tool/src/org/antlr/v4/codegen/model/ast/RewriteTokenRefIsRoot.java deleted file mode 100644 index 8b2899cf8..000000000 --- a/tool/src/org/antlr/v4/codegen/model/ast/RewriteTokenRefIsRoot.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - [The "BSD license"] - Copyright (c) 2011 Terence Parr - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.antlr.v4.codegen.model.ast; - -import org.antlr.v4.codegen.OutputModelFactory; -import org.antlr.v4.tool.GrammarAST; - -public class RewriteTokenRefIsRoot extends RewriteTokenRef { - public RewriteTokenRefIsRoot(OutputModelFactory factory, GrammarAST ast, - String rootName, String iterName) - { - super(factory, ast, rootName, iterName); - } -}