Per https://github.com/tree-sitter/tree-sitter/issues/1259, tree-sitter will call the external scanner with all symbols marked valid when it enters error recovery mode. Currently, the scanner immediately bails & returns false when this happens. The scanner should instead attempt to handle itself gracefully during error recovery, for example continuing to look for additional elements of a jlist and emitting INDENT/NEWLINE/DEDENT tokens. It's also possible the external scanner could emit some "anchor" tokens to identify the next unit definition as an error recovery point; see also https://github.com/tree-sitter/tree-sitter/discussions/1205
Per https://github.com/tree-sitter/tree-sitter/issues/1259, tree-sitter will call the external scanner with all symbols marked valid when it enters error recovery mode. Currently, the scanner immediately bails & returns false when this happens. The scanner should instead attempt to handle itself gracefully during error recovery, for example continuing to look for additional elements of a jlist and emitting
INDENT
/NEWLINE
/DEDENT
tokens. It's also possible the external scanner could emit some "anchor" tokens to identify the next unit definition as an error recovery point; see also https://github.com/tree-sitter/tree-sitter/discussions/1205