Adding the ParserRuleContext when there is a Syntax error in the source code

折月煮酒 提交于 2019-12-11 17:58:34

问题


Given below is the code i written. I need to add the parserRulecontext that cause the syntax error when ever there is a error in the code. I am using the antlr4 as well.

if (tree instanceof TerminalNodeImpl) {
        Token token = ((TerminalNodeImpl) tree).getSymbol();
        map.put("line", token.getLine());
        map.put("column", token.getCharPositionInLine());
        map.put("type",JavaScriptLexer.VOCABULARY.getSymbolicName(token.getType()));
        map.put("text", token.getText());
    }

来源:https://stackoverflow.com/questions/57951251/adding-the-parserrulecontext-when-there-is-a-syntax-error-in-the-source-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!