oops; adaptor created wrong dup nodes

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6892]
This commit is contained in:
parrt 2010-05-24 15:48:55 -08:00
parent 259ec8f693
commit f32056f978
16 changed files with 182 additions and 120 deletions

View File

@ -351,7 +351,6 @@ public class Tool {
public void processGrammarsOnCommandLine() {
// TODO: process all files
GrammarAST t = load(grammarFileNames.get(0));
GrammarRootAST lexerAST = null;
if ( t instanceof GrammarASTErrorNode ) return; // came back as error node
if ( ((GrammarRootAST)t).hasErrors ) return;
@ -360,7 +359,7 @@ public class Tool {
g.fileName = grammarFileNames.get(0);
process(g);
if ( ast!=null && ast.grammarType==ANTLRParser.COMBINED && !ast.hasErrors ) {
lexerAST = extractImplicitLexer(g); // alters ast
GrammarRootAST lexerAST = extractImplicitLexer(g); // alters ast
if ( lexerAST!=null ) {
LexerGrammar lexerg = new LexerGrammar(this, lexerAST);
lexerg.fileName = grammarFileNames.get(0);

View File

@ -1,4 +1,4 @@
// $ANTLR ${project.version} ${buildNumber} ANTLRLexer.g 2010-05-21 18:40:58
// $ANTLR 3.2.1-SNAPSHOT May 24, 2010 15:02:05 ANTLRLexer.g 2010-05-24 16:31:55
/*
[The "BSD licence"]

View File

@ -1,4 +1,4 @@
// $ANTLR ${project.version} ${buildNumber} ANTLRParser.g 2010-05-21 18:41:00
// $ANTLR 3.2.1-SNAPSHOT May 24, 2010 15:02:05 ANTLRParser.g 2010-05-24 16:31:57
/*
[The "BSD licence"]
@ -339,7 +339,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: id, DOC_COMMENT, grammarType, mode, rules, prequelConstruct
// elements: prequelConstruct, rules, mode, grammarType, DOC_COMMENT, id
// token labels:
// rule labels: retval
// token list labels:
@ -849,7 +849,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: option, OPTIONS
// elements: OPTIONS, option
// token labels:
// rule labels: retval
// token list labels:
@ -1184,7 +1184,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: IMPORT, delegateGrammar
// elements: delegateGrammar, IMPORT
// token labels:
// rule labels: retval
// token list labels:
@ -1620,7 +1620,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: STRING_LITERAL, ASSIGN, id
// elements: id, STRING_LITERAL, ASSIGN
// token labels:
// rule labels: retval
// token list labels:
@ -1760,7 +1760,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: SCOPE, ACTION, id
// elements: SCOPE, id, ACTION
// token labels:
// rule labels: retval
// token list labels:
@ -1914,7 +1914,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: AT, ACTION, id, actionScopeName
// elements: actionScopeName, ACTION, id, AT
// token labels:
// rule labels: retval
// token list labels:
@ -2606,7 +2606,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: ruleReturns, ARG_ACTION, ruleBlock, DOC_COMMENT, ruleModifiers, id, exceptionGroup, rulePrequels
// elements: exceptionGroup, rulePrequels, ruleModifiers, ruleBlock, DOC_COMMENT, ruleReturns, id, ARG_ACTION
// token labels:
// rule labels: retval
// token list labels:
@ -2835,7 +2835,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: CATCH, ACTION, ARG_ACTION
// elements: ARG_ACTION, ACTION, CATCH
// token labels:
// rule labels: retval
// token list labels:
@ -3561,7 +3561,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: SCOPE, id
// elements: id, SCOPE
// token labels:
// rule labels: retval
// token list labels:
@ -3660,7 +3660,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: AT, id, ACTION
// elements: id, AT, ACTION
// token labels:
// rule labels: retval
// token list labels:
@ -4178,7 +4178,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: rewrite, elements
// elements: elements, rewrite
// token labels:
// rule labels: retval
// token list labels:
@ -4664,7 +4664,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: ebnfSuffix, atom
// elements: atom, ebnfSuffix
// token labels:
// rule labels: retval
// token list labels:
@ -5830,7 +5830,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: ruleref, id, DOT
// elements: id, ruleref, DOT
// token labels:
// rule labels: retval
// token list labels:
@ -6177,7 +6177,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: NOT, terminal
// elements: terminal, NOT
// token labels:
// rule labels: retval
// token list labels:
@ -6396,7 +6396,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: optionsSpec, altList, ra
// elements: altList, ra, optionsSpec
// token labels:
// rule labels: retval
// token list labels:
@ -6571,7 +6571,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: ARG_ACTION, RULE_REF, op
// elements: RULE_REF, ARG_ACTION, op
// token labels: op
// rule labels: retval
// token list labels:
@ -6838,7 +6838,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: ARG_ACTION, elementOptions, TOKEN_REF
// elements: TOKEN_REF, ARG_ACTION, elementOptions
// token labels:
// rule labels: retval
// token list labels:
@ -7362,7 +7362,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: predicatedRewrite, nakedRewrite
// elements: nakedRewrite, predicatedRewrite
// token labels:
// rule labels: retval
// token list labels:
@ -7450,7 +7450,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: rewriteAlt, SEMPRED, SEMPRED, rewriteAlt
// elements: SEMPRED, rewriteAlt, rewriteAlt, SEMPRED
// token labels:
// rule labels: retval
// token list labels:
@ -8231,7 +8231,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: elementOptions, TOKEN_REF, ARG_ACTION
// elements: TOKEN_REF, elementOptions, ARG_ACTION
// token labels:
// rule labels: retval
// token list labels:
@ -8315,7 +8315,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: STRING_LITERAL, elementOptions
// elements: elementOptions, STRING_LITERAL
// token labels:
// rule labels: retval
// token list labels:
@ -8472,7 +8472,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: ebnfSuffix, rewriteTreeAlt
// elements: rewriteTreeAlt, ebnfSuffix
// token labels:
// rule labels: retval
// token list labels:
@ -8609,7 +8609,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: TREE_BEGIN, rewriteTreeElement, rewriteTreeAtom
// elements: TREE_BEGIN, rewriteTreeAtom, rewriteTreeElement
// token labels:
// rule labels: retval
// token list labels:
@ -8764,7 +8764,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: str, TEMPLATE, rewriteTemplateArgs
// elements: TEMPLATE, str, rewriteTemplateArgs
// token labels: str
// rule labels: retval
// token list labels:
@ -9025,7 +9025,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: rewriteTemplateArgs, ACTION
// elements: ACTION, rewriteTemplateArgs
// token labels:
// rule labels: retval
// token list labels:
@ -9271,7 +9271,7 @@ public class ANTLRParser extends Parser {
// AST REWRITE
// elements: ACTION, id
// elements: id, ACTION
// token labels:
// rule labels: retval
// token list labels:

View File

@ -1,4 +1,4 @@
// $ANTLR ${project.version} ${buildNumber} ASTVerifier.g 2010-05-21 18:41:01
// $ANTLR 3.2.1-SNAPSHOT May 24, 2010 15:02:05 ASTVerifier.g 2010-05-24 16:31:58
/*
[The "BSD license"]

View File

@ -1,4 +1,4 @@
// $ANTLR ${project.version} ${buildNumber} ActionSplitter.g 2010-05-21 18:41:01
// $ANTLR 3.2.1-SNAPSHOT May 24, 2010 15:02:05 ActionSplitter.g 2010-05-24 16:31:57
package org.antlr.v4.parse;
@ -2175,20 +2175,6 @@ public class ActionSplitter extends Lexer {
state.failed=false;
return success;
}
public final boolean synpred12_ActionSplitter() {
state.backtracking++;
int start = input.mark();
try {
synpred12_ActionSplitter_fragment(); // can never throw exception
} catch (RecognitionException re) {
System.err.println("impossible: "+re);
}
boolean success = !state.failed;
input.rewind(start);
state.backtracking--;
state.failed=false;
return success;
}
public final boolean synpred17_ActionSplitter() {
state.backtracking++;
int start = input.mark();
@ -2217,6 +2203,20 @@ public class ActionSplitter extends Lexer {
state.failed=false;
return success;
}
public final boolean synpred12_ActionSplitter() {
state.backtracking++;
int start = input.mark();
try {
synpred12_ActionSplitter_fragment(); // can never throw exception
} catch (RecognitionException re) {
System.err.println("impossible: "+re);
}
boolean success = !state.failed;
input.rewind(start);
state.backtracking--;
state.failed=false;
return success;
}
public final boolean synpred9_ActionSplitter() {
state.backtracking++;
int start = input.mark();
@ -2329,11 +2329,11 @@ public class ActionSplitter extends Lexer {
state.failed=false;
return success;
}
public final boolean synpred8_ActionSplitter() {
public final boolean synpred2_ActionSplitter() {
state.backtracking++;
int start = input.mark();
try {
synpred8_ActionSplitter_fragment(); // can never throw exception
synpred2_ActionSplitter_fragment(); // can never throw exception
} catch (RecognitionException re) {
System.err.println("impossible: "+re);
}
@ -2343,11 +2343,11 @@ public class ActionSplitter extends Lexer {
state.failed=false;
return success;
}
public final boolean synpred2_ActionSplitter() {
public final boolean synpred8_ActionSplitter() {
state.backtracking++;
int start = input.mark();
try {
synpred2_ActionSplitter_fragment(); // can never throw exception
synpred8_ActionSplitter_fragment(); // can never throw exception
} catch (RecognitionException re) {
System.err.println("impossible: "+re);
}
@ -2399,11 +2399,11 @@ public class ActionSplitter extends Lexer {
state.failed=false;
return success;
}
public final boolean synpred3_ActionSplitter() {
public final boolean synpred15_ActionSplitter() {
state.backtracking++;
int start = input.mark();
try {
synpred3_ActionSplitter_fragment(); // can never throw exception
synpred15_ActionSplitter_fragment(); // can never throw exception
} catch (RecognitionException re) {
System.err.println("impossible: "+re);
}
@ -2413,11 +2413,11 @@ public class ActionSplitter extends Lexer {
state.failed=false;
return success;
}
public final boolean synpred15_ActionSplitter() {
public final boolean synpred3_ActionSplitter() {
state.backtracking++;
int start = input.mark();
try {
synpred15_ActionSplitter_fragment(); // can never throw exception
synpred3_ActionSplitter_fragment(); // can never throw exception
} catch (RecognitionException re) {
System.err.println("impossible: "+re);
}
@ -2495,19 +2495,23 @@ public class ActionSplitter extends Lexer {
static final String DFA29_eofS =
"\32\uffff";
static final String DFA29_minS =
"\2\0\2\uffff\1\0\7\uffff\1\0\2\uffff\1\0\12\uffff";
"\2\0\3\uffff\1\0\1\uffff\1\0\12\uffff\1\0\7\uffff";
static final String DFA29_maxS =
"\1\uffff\1\0\2\uffff\1\0\7\uffff\1\0\2\uffff\1\0\12\uffff";
"\1\uffff\1\0\3\uffff\1\0\1\uffff\1\0\12\uffff\1\0\7\uffff";
static final String DFA29_acceptS =
"\2\uffff\1\3\1\24\1\uffff\1\16\1\17\1\20\1\21\1\22\1\23\1\24\1\uffff"+
"\1\1\1\2\1\uffff\1\4\1\5\1\6\1\7\1\10\1\11\1\12\1\13\1\14\1\15";
"\2\uffff\1\1\1\2\1\24\1\uffff\1\3\1\uffff\1\4\1\5\1\6\1\7\1\10\1"+
"\11\1\12\1\13\1\14\1\15\1\uffff\1\16\1\17\1\20\1\21\1\22\1\23\1"+
"\24";
static final String DFA29_specialS =
"\1\0\1\1\2\uffff\1\2\7\uffff\1\3\2\uffff\1\4\12\uffff}>";
"\1\0\1\1\3\uffff\1\2\1\uffff\1\3\12\uffff\1\4\7\uffff}>";
static final String[] DFA29_transitionS = {
"\44\13\1\17\1\4\11\13\1\14\54\13\1\1\uffa3\13",
"\44\31\1\7\1\22\11\31\1\1\54\31\1\5\uffa3\31",
"\1\uffff",
"",
"",
"",
"\1\uffff",
"",
"\1\uffff",
"",
"",
@ -2516,7 +2520,7 @@ public class ActionSplitter extends Lexer {
"",
"",
"",
"\1\uffff",
"",
"",
"",
"\1\uffff",
@ -2526,9 +2530,6 @@ public class ActionSplitter extends Lexer {
"",
"",
"",
"",
"",
"",
""
};
@ -2572,15 +2573,15 @@ public class ActionSplitter extends Lexer {
int LA29_0 = input.LA(1);
s = -1;
if ( (LA29_0=='\\') ) {s = 1;}
if ( (LA29_0=='/') ) {s = 1;}
else if ( (LA29_0=='%') ) {s = 4;}
else if ( (LA29_0=='\\') ) {s = 5;}
else if ( ((LA29_0>='\u0000' && LA29_0<='#')||(LA29_0>='&' && LA29_0<='.')||(LA29_0>='0' && LA29_0<='[')||(LA29_0>=']' && LA29_0<='\uFFFF')) ) {s = 11;}
else if ( (LA29_0=='$') ) {s = 7;}
else if ( (LA29_0=='/') ) {s = 12;}
else if ( (LA29_0=='%') ) {s = 18;}
else if ( (LA29_0=='$') ) {s = 15;}
else if ( ((LA29_0>='\u0000' && LA29_0<='#')||(LA29_0>='&' && LA29_0<='.')||(LA29_0>='0' && LA29_0<='[')||(LA29_0>=']' && LA29_0<='\uFFFF')) ) {s = 25;}
if ( s>=0 ) return s;
break;
@ -2591,83 +2592,83 @@ public class ActionSplitter extends Lexer {
int index29_1 = input.index();
input.rewind();
s = -1;
if ( (synpred3_ActionSplitter()) ) {s = 2;}
if ( (synpred1_ActionSplitter()) ) {s = 2;}
else if ( (true) ) {s = 3;}
else if ( (synpred2_ActionSplitter()) ) {s = 3;}
else if ( (true) ) {s = 4;}
input.seek(index29_1);
if ( s>=0 ) return s;
break;
case 2 :
int LA29_4 = input.LA(1);
int LA29_5 = input.LA(1);
int index29_4 = input.index();
int index29_5 = input.index();
input.rewind();
s = -1;
if ( (synpred14_ActionSplitter()) ) {s = 5;}
if ( (synpred3_ActionSplitter()) ) {s = 6;}
else if ( (synpred15_ActionSplitter()) ) {s = 6;}
else if ( (synpred16_ActionSplitter()) ) {s = 7;}
else if ( (synpred17_ActionSplitter()) ) {s = 8;}
else if ( (synpred18_ActionSplitter()) ) {s = 9;}
else if ( (synpred19_ActionSplitter()) ) {s = 10;}
else if ( (true) ) {s = 4;}
input.seek(index29_4);
input.seek(index29_5);
if ( s>=0 ) return s;
break;
case 3 :
int LA29_12 = input.LA(1);
int LA29_7 = input.LA(1);
int index29_12 = input.index();
int index29_7 = input.index();
input.rewind();
s = -1;
if ( (synpred1_ActionSplitter()) ) {s = 13;}
if ( (synpred4_ActionSplitter()) ) {s = 8;}
else if ( (synpred2_ActionSplitter()) ) {s = 14;}
else if ( (synpred5_ActionSplitter()) ) {s = 9;}
else if ( (true) ) {s = 11;}
else if ( (synpred6_ActionSplitter()) ) {s = 10;}
else if ( (synpred7_ActionSplitter()) ) {s = 11;}
else if ( (synpred8_ActionSplitter()) ) {s = 12;}
else if ( (synpred9_ActionSplitter()) ) {s = 13;}
else if ( (synpred10_ActionSplitter()) ) {s = 14;}
else if ( (synpred11_ActionSplitter()) ) {s = 15;}
else if ( (synpred12_ActionSplitter()) ) {s = 16;}
else if ( (synpred13_ActionSplitter()) ) {s = 17;}
input.seek(index29_12);
input.seek(index29_7);
if ( s>=0 ) return s;
break;
case 4 :
int LA29_15 = input.LA(1);
int LA29_18 = input.LA(1);
int index29_15 = input.index();
int index29_18 = input.index();
input.rewind();
s = -1;
if ( (synpred4_ActionSplitter()) ) {s = 16;}
if ( (synpred14_ActionSplitter()) ) {s = 19;}
else if ( (synpred5_ActionSplitter()) ) {s = 17;}
else if ( (synpred15_ActionSplitter()) ) {s = 20;}
else if ( (synpred6_ActionSplitter()) ) {s = 18;}
else if ( (synpred16_ActionSplitter()) ) {s = 21;}
else if ( (synpred7_ActionSplitter()) ) {s = 19;}
else if ( (synpred17_ActionSplitter()) ) {s = 22;}
else if ( (synpred8_ActionSplitter()) ) {s = 20;}
else if ( (synpred18_ActionSplitter()) ) {s = 23;}
else if ( (synpred9_ActionSplitter()) ) {s = 21;}
else if ( (synpred10_ActionSplitter()) ) {s = 22;}
else if ( (synpred11_ActionSplitter()) ) {s = 23;}
else if ( (synpred12_ActionSplitter()) ) {s = 24;}
else if ( (synpred13_ActionSplitter()) ) {s = 25;}
else if ( (synpred19_ActionSplitter()) ) {s = 24;}
input.seek(index29_15);
input.seek(index29_18);
if ( s>=0 ) return s;
break;
}

View File

@ -38,8 +38,9 @@ public class GrammarASTAdaptor extends CommonTreeAdaptor {
public Object dupNode(Object t) {
if ( t==null ) return null;
return create(((GrammarAST)t).token);
return ((GrammarAST)t).dupNode(); //create(((GrammarAST)t).token);
}
public Object errorNode(TokenStream input, Token start, Token stop,
RecognitionException e)
{

View File

@ -1,4 +1,4 @@
// $ANTLR ${project.version} ${buildNumber} NFABuilder.g 2010-05-21 18:41:01
// $ANTLR 3.2.1-SNAPSHOT May 24, 2010 15:02:05 NFABuilder.g 2010-05-24 16:31:58
/*
[The "BSD license"]

View File

@ -1,4 +1,4 @@
// $ANTLR ${project.version} ${buildNumber} BasicSemanticTriggers.g 2010-05-19 15:07:28
// $ANTLR 3.2.1-SNAPSHOT May 24, 2010 15:02:05 BasicSemanticTriggers.g 2010-05-24 16:31:59
/*
[The "BSD license"]

View File

@ -1,4 +1,4 @@
// $ANTLR ${project.version} ${buildNumber} CollectSymbols.g 2010-05-19 15:10:21
// $ANTLR 3.2.1-SNAPSHOT May 24, 2010 15:02:05 CollectSymbols.g 2010-05-24 16:31:59
/*
[The "BSD license"]

View File

@ -1,6 +1,7 @@
package org.antlr.v4.tool;
import org.antlr.runtime.Token;
import org.antlr.runtime.tree.Tree;
import java.util.List;
@ -11,7 +12,18 @@ public class ActionAST extends GrammarAST {
/** In which alt does this node live? */
// public Alternative alt;
public ActionAST(Token t) { super(t); }
public ActionAST(GrammarAST node) {
super(node);
this.resolver = ((ActionAST)node).resolver;
this.chunks = ((ActionAST)node).chunks;
}
public ActionAST(Token t) { super(t); }
public ActionAST(int type) { super(type); }
public ActionAST(int type, Token t) { super(type, t); }
@Override
public Tree dupNode() { return new ActionAST(this); }
}

View File

@ -1,12 +1,21 @@
package org.antlr.v4.tool;
import org.antlr.runtime.Token;
import org.antlr.runtime.tree.Tree;
/** An ALT or ALT_REWRITE node (left of ->) */
public class AltAST extends GrammarAST {
public Alternative alt;
public AltAST(GrammarAST node) {
super(node);
this.alt = ((AltAST)node).alt;
}
public AltAST(Token t) { super(t); }
public AltAST(int type) { super(type); }
public AltAST(int type, Token t) { super(type, t); }
@Override
public Tree dupNode() { return new AltAST(this); }
}

View File

@ -1,6 +1,7 @@
package org.antlr.v4.tool;
import org.antlr.runtime.Token;
import org.antlr.runtime.tree.Tree;
import java.util.HashMap;
import java.util.Map;
@ -13,9 +14,16 @@ public class BlockAST extends GrammarASTWithOptions {
public static final Map defaultLexerBlockOptions =
new HashMap() {{put("greedy","true");}};
public BlockAST(Token t) { super(t); }
public BlockAST(GrammarAST node) {
super(node);
}
public BlockAST(Token t) { super(t); }
public BlockAST(int type) { super(type); }
public BlockAST(int type, Token t) { super(type, t); }
public BlockAST(int type, Token t, String text) { super(type,t,text); }
public BlockAST(int type, Token t, String text) { super(type,t,text); }
@Override
public Tree dupNode() { return new BlockAST(this); }
}

View File

@ -8,7 +8,12 @@ import java.util.Map;
public class GrammarASTWithOptions extends GrammarAST {
protected Map<String, String> options;
public GrammarASTWithOptions(Token t) { super(t); }
public GrammarASTWithOptions(GrammarAST node) {
super(node);
this.options = ((GrammarASTWithOptions)node).options;
}
public GrammarASTWithOptions(Token t) { super(t); }
public GrammarASTWithOptions(int type) { super(type); }
public GrammarASTWithOptions(int type, Token t) { super(type, t); }
public GrammarASTWithOptions(int type, Token t, String text) { super(type,t,text); }

View File

@ -1,6 +1,7 @@
package org.antlr.v4.tool;
import org.antlr.runtime.Token;
import org.antlr.runtime.tree.Tree;
import java.util.HashMap;
import java.util.Map;
@ -14,8 +15,17 @@ public class GrammarRootAST extends GrammarASTWithOptions {
};
public int grammarType; // LEXER, PARSER, TREE, GRAMMAR (combined)
public boolean hasErrors;
public GrammarRootAST(int type) { super(type); }
public GrammarRootAST(GrammarAST node) {
super(node);
this.grammarType = ((GrammarRootAST)node).grammarType;
this.hasErrors = ((GrammarRootAST)node).hasErrors;
}
@Override
public Tree dupNode() { return new GrammarRootAST(this); }
public GrammarRootAST(int type) { super(type); }
public GrammarRootAST(Token t) { super(t); }
public GrammarRootAST(int type, Token t) { super(type, t); }
public GrammarRootAST(int type, Token t, String text) {

View File

@ -1,8 +1,17 @@
package org.antlr.v4.tool;
import org.antlr.runtime.Token;
import org.antlr.runtime.tree.Tree;
public class RuleAST extends GrammarASTWithOptions {
public RuleAST(Token t) { super(t); }
public RuleAST(GrammarAST node) {
super(node);
}
public RuleAST(Token t) { super(t); }
public RuleAST(int type) { super(type); }
@Override
public Tree dupNode() { return new RuleAST(this); }
}

View File

@ -1,11 +1,19 @@
package org.antlr.v4.tool;
import org.antlr.runtime.Token;
import org.antlr.runtime.tree.Tree;
public class TerminalAST extends GrammarASTWithOptions {
public static final String defaultTokenOption = "node";
public TerminalAST(Token t) { super(t); }
public TerminalAST(GrammarAST node) {
super(node);
}
public TerminalAST(Token t) { super(t); }
public TerminalAST(int type) { super(type); }
public TerminalAST(int type, Token t) { super(type, t); }
@Override
public Tree dupNode() { return new TerminalAST(this); }
}