Use antlr v4 for syntax check
Clash Royale CLAN TAG #URR8PPP Use antlr v4 for syntax check Can I use antlr v4 for syntax check before I actually run the code? Example : I defined syntax: select * from table , I want to know the statement is correct or not before actually executing it. select * from table Following is my code : val listener = new SQLListener() val loadLexer = new SQLLexer(new ANTLRInputStream(input)) val tokens = new CommonTokenStream(loadLexer) val parser = new SQLParser(tokens) val stat = parser.statement() I tried but DefaultErrorStrategy won't throw an Exception DefaultErrorStrategy I tried this: parser.addErrorListener(new BaseErrorListener { override def syntaxError(recognizer: Recognizer[_, _ <: ATNSimulator], offendingSymbol: scala.Any, line: Int, charPositionInLine: Int, msg: String, e: RecognitionException ): Unit = { println("==========2============"+m...