Work around antlr bug to detect end of rule
Antlr stops parsing after the rule is completed, meaning that there may be some syntax erros that could not be unit tested e.g. task x := 5;o the "o" would not be detected as a syntax error if the "task" rule is completely parsed. the EOF token should help, however it does not: when using the parser in interactive mode it does complain, but not in standard parsing.. The workaround is to check the index of a possible following token after parsing the rule. If it is not none, it means that the buffer still contains something, which therefore is a syntax error.
Please register or sign in to comment