@Override /** Make sure even imaginary nodes know the input stream */ public Object create(int tokenType, String text) { GrammarAST t; if ( tokenType==ANTLRParser.RULE ) { // needed by TreeWizard to make RULE tree t = new RuleAST(new CommonToken(tokenType, text)); } else if ( tokenType==ANTLRParser.STRING_LITERAL ) { // implicit lexer construction done with wizard; needs this node type // whereas grammar ANTLRParser.g can use token option to spec node type t = new TerminalAST(new CommonToken(tokenType, text)); } else { t = (GrammarAST)super.create(tokenType, text); } t.token.setInputStream(input); return t; }
@Override /** Make sure even imaginary nodes know the input stream */ public Object create(int tokenType, String text) { GrammarAST t; if ( tokenType==ANTLRParser.RULE ) { // needed by TreeWizard to make RULE tree t = new RuleAST(new CommonToken(tokenType, text)); } else if ( tokenType==ANTLRParser.STRING_LITERAL ) { // implicit lexer construction done with wizard; needs this node type // whereas grammar ANTLRParser.g can use token option to spec node type t = new TerminalAST(new CommonToken(tokenType, text)); } else { t = (GrammarAST)super.create(tokenType, text); } t.token.setInputStream(input); return t; }
@Override /** Make sure even imaginary nodes know the input stream */ public GrammarAST create(int tokenType, String text) { GrammarAST t; if ( tokenType==ANTLRParser.RULE ) { // needed by TreeWizard to make RULE tree t = new RuleAST(new CommonToken(tokenType, text)); } else if ( tokenType==ANTLRParser.STRING_LITERAL ) { // implicit lexer construction done with wizard; needs this node type // whereas grammar ANTLRParser.g can use token option to spec node type t = new TerminalAST(new CommonToken(tokenType, text)); } else { t = (GrammarAST)super.create(tokenType, text); } t.token.setInputStream(input); return t; }
@Override /** Make sure even imaginary nodes know the input stream */ public Object create(int tokenType, String text) { GrammarAST t; if ( tokenType==ANTLRParser.RULE ) { // needed by TreeWizard to make RULE tree t = new RuleAST(new CommonToken(tokenType, text)); } else if ( tokenType==ANTLRParser.STRING_LITERAL ) { // implicit lexer construction done with wizard; needs this node type // whereas grammar ANTLRParser.g can use token option to spec node type t = new TerminalAST(new CommonToken(tokenType, text)); } else { t = (GrammarAST)super.create(tokenType, text); } t.token.setInputStream(input); return t; }
@Override /** Make sure even imaginary nodes know the input stream */ public Object create(int tokenType, String text) { GrammarAST t; if ( tokenType==ANTLRParser.RULE ) { // needed by TreeWizard to make RULE tree t = new RuleAST(new CommonToken(tokenType, text)); } else if ( tokenType==ANTLRParser.STRING_LITERAL ) { // implicit lexer construction done with wizard; needs this node type // whereas grammar ANTLRParser.g can use token option to spec node type t = new TerminalAST(new CommonToken(tokenType, text)); } else { t = (GrammarAST)super.create(tokenType, text); } t.token.setInputStream(input); return t; }
state.token.setInputStream(input); state.token.setLine(state.tokenStartLine); state.token.setCharPositionInLine(state.tokenStartCharPositionInLine);
state.token.setInputStream(input); state.token.setLine(state.tokenStartLine); state.token.setCharPositionInLine(state.tokenStartCharPositionInLine);
new GrammarRootAST(new CommonToken(ANTLRParser.GRAMMAR, "LEXER_GRAMMAR"), combinedGrammar.ast.tokenStream); lexerAST.grammarType = ANTLRParser.LEXER; lexerAST.token.setInputStream(combinedAST.token.getInputStream()); lexerAST.addChild((GrammarAST)adaptor.create(ANTLRParser.ID, lexerName));
new GrammarRootAST(new CommonToken(ANTLRParser.GRAMMAR, "LEXER_GRAMMAR"), combinedGrammar.ast.tokenStream); lexerAST.grammarType = ANTLRParser.LEXER; lexerAST.token.setInputStream(combinedAST.token.getInputStream()); lexerAST.addChild((GrammarAST)adaptor.create(ANTLRParser.ID, lexerName));
new GrammarRootAST(new CommonToken(ANTLRParser.GRAMMAR, "LEXER_GRAMMAR"), combinedGrammar.ast.tokenStream); lexerAST.grammarType = ANTLRParser.LEXER; lexerAST.token.setInputStream(combinedAST.token.getInputStream()); lexerAST.addChild((GrammarAST)adaptor.create(ANTLRParser.ID, lexerName));
new GrammarRootAST(new CommonToken(ANTLRParser.GRAMMAR, "LEXER_GRAMMAR"), combinedGrammar.ast.tokenStream); lexerAST.grammarType = ANTLRParser.LEXER; lexerAST.token.setInputStream(combinedAST.token.getInputStream()); lexerAST.addChild((GrammarAST)adaptor.create(ANTLRParser.ID, lexerName));
new GrammarRootAST(new CommonToken(ANTLRParser.GRAMMAR, "LEXER_GRAMMAR"), combinedGrammar.ast.tokenStream); lexerAST.grammarType = ANTLRParser.LEXER; lexerAST.token.setInputStream(combinedAST.token.getInputStream()); lexerAST.addChild(adaptor.create(ANTLRParser.ID, lexerName));