forked from jasder/antlr
Merge pull request #585 from sharwell/grammar-ast
Simplify the GrammarAST constructors
This commit is contained in:
commit
43b04f02f6
|
@ -67,18 +67,13 @@ public class GrammarAST extends CommonTree {
|
||||||
}
|
}
|
||||||
public GrammarAST(int type) { super(new CommonToken(type, ANTLRParser.tokenNames[type])); }
|
public GrammarAST(int type) { super(new CommonToken(type, ANTLRParser.tokenNames[type])); }
|
||||||
public GrammarAST(int type, Token t) {
|
public GrammarAST(int type, Token t) {
|
||||||
this(new CommonToken(type, t.getText()));
|
this(new CommonToken(t));
|
||||||
token.setInputStream(t.getInputStream());
|
token.setType(type);
|
||||||
token.setLine(t.getLine());
|
|
||||||
token.setCharPositionInLine(t.getCharPositionInLine());
|
|
||||||
token.setTokenIndex(t.getTokenIndex());
|
|
||||||
}
|
}
|
||||||
public GrammarAST(int type, Token t, String text) {
|
public GrammarAST(int type, Token t, String text) {
|
||||||
this(new CommonToken(type, text));
|
this(new CommonToken(t));
|
||||||
token.setInputStream(t.getInputStream());
|
token.setType(type);
|
||||||
token.setLine(t.getLine());
|
token.setText(text);
|
||||||
token.setCharPositionInLine(t.getCharPositionInLine());
|
|
||||||
token.setTokenIndex(t.getTokenIndex());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GrammarAST[] getChildrenAsArray() {
|
public GrammarAST[] getChildrenAsArray() {
|
||||||
|
|
Loading…
Reference in New Issue