stsewd / tree-sitter-rst

reStructuredText grammar for tree-sitter
https://stsewd.dev/tree-sitter-rst/
MIT License
50 stars 7 forks source link

Check for recovery mode and fix numeric list missparsing #41

Closed stsewd closed 1 year ago

stsewd commented 1 year ago

I'm making the external scanner aware of tree-sitter correction mode (https://tree-sitter.github.io/tree-sitter/creating-parsers#other-external-scanner-details), this will hopefully help to move the parsing of text nodes to JS.

While doing this also found a bug

https://github.com/stsewd/tree-sitter-rst/blob/c7c2b24918e231072af2d10c03b4893818de9d5d/src/tree_sitter_rst/parser.c#L135-L137

That is trying to parse the text as a numeric bullet, even if the token isn't valid in that context, a check for && valid_symbols[T_NUMERIC_BULLET] was added.

Fixes https://github.com/stsewd/tree-sitter-rst/issues/31