When an unexpected token is encountered, in some cases the parser will try to parse the next rule without consuming the invalid token. This way the parser can be more tolerant to errors and more valid language elements can be recognized in partially valid code. However in some cases this leads to repeatedly trying to parse the same rule leading to either stack overflows or infinite loops.
The cases where a token can be left unconsumed on error should be thoroughly reviewed and used sparingly.
We should also implement fuzz tests to detect these issues.
When an unexpected token is encountered, in some cases the parser will try to parse the next rule without consuming the invalid token. This way the parser can be more tolerant to errors and more valid language elements can be recognized in partially valid code. However in some cases this leads to repeatedly trying to parse the same rule leading to either stack overflows or infinite loops.
The cases where a token can be left unconsumed on error should be thoroughly reviewed and used sparingly.
We should also implement fuzz tests to detect these issues.