i has the following grammar
root
: sql_statements EOF | EOF
;
sql_statements
:( sql_statement )+
;
sql_statement
: ddl_statement semicolon
;
ddl_statement
: alter_statement
;
This is the first shot of my grammar I have the following test case
aleter table user;alter table group_user;
the first statement has an error, so I get an error for both statements in accordance with the sql_statements rule
Failed to parse at line 1:1 due to mismatched input 'aleter' expecting ALTER
Now I want to use the Defaulterrorhandler function to skip the first statement to the semicolon. Then it should start with the second statement, starting with the sql_statements rule.
Question :
How to tell which rule to start after consuming error tokens ?
Thanks in advance.
source
share