@Override
public void exitNonReserved(SqlBaseParser.NonReservedContext context)
{
// we can't modify the tree during rule enter/exit event handling unless we're dealing with a terminal.
// Otherwise, ANTLR gets confused an fires spurious notifications.
if (!(context.getChild(0) instanceof TerminalNode)) {
int rule = ((ParserRuleContext) context.getChild(0)).getRuleIndex();
throw new AssertionError("nonReserved can only contain tokens. Found nested rule: " + ruleNames.get(rule));
}
// replace nonReserved words with IDENT tokens
context.getParent().removeLastChild();
Token token = (Token) context.getChild(0).getPayload();
context.getParent().addChild(new CommonToken(
new Pair<>(token.getTokenSource(), token.getInputStream()),
SqlBaseLexer.IDENTIFIER,
token.getChannel(),
token.getStartIndex(),
token.getStopIndex()));
}
SqlParser.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:rainbow
作者:
评论列表
文章目录