-
I've read that antlr4 would do single token insertion or deletion as an error recovery measure, but when I try it on SELECT statement it always fail:
these are obvious cases of missing one and having one extra token, and neither can trigger the corresponding error recovery method and be prased into a complete SELECT statement. Antlr simply gives up on the point of error and doesnt even bother parsing the tokens afterwards. Same test done on INSERT statement:
While only the extra token case has the correct error message, both have the token after the error point parsed successfully. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
For this input I am unsure of the error recovery mechanism in the Oracle sources (https://github.com/mysql/mysql-shell-plugins/tree/8928ada7d9e37a4075291880738983752b315fee/gui/frontend/src/parsing/mysql). It may involve token insertion, i.e., a minimal distance error strategy. @mike-lischke |
Beta Was this translation helpful? Give feedback.
-
RecoverInLine() is only called from Parser.Match() or from ParserInterpreter.VisitState(). The parser exception, NoViableAltException, is raised by AdaptivePredict():
In
There are two problems here. First, it arises because |
Beta Was this translation helpful? Give feedback.
RecoverInLine() is only called from Parser.Match() or from ParserInterpreter.VisitState().
ParserInterpreter
isn't even involved because it's not called here, and the class hiearachy for the parser doesn't involveParserInterpreter
. For testing performance and ambiguous tree enumeration, the template driver apps in grammars-v4 utilize ParserInterpreter; however, it is not used for a simple parse.The parser exception, NoViableAltException, is raised by AdaptivePredict():