[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

parser error recovery algorithm vs treesit indentation "blinking"

From: Stephen Leake
Subject: parser error recovery algorithm vs treesit indentation "blinking"
Date: Mon, 03 Apr 2023 14:47:29 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

Alan Mackenzie <acm@muc.de> writes:

> Does the <tree-sitter> parser not produce adequate information for source 
> code which
> isn't syntactically valid (which is most of the time when editing is in
> progress)?

It often does, but also often does not. The error recovery algorithm in
tree-sitter is apparently not good enough for this use case (indentation
with a missing close block symbol). That's because the tree-sitter
algorithm does not insert symbols, it only skips them.

The error recovery algorithm in the wisitoken parser used by ada-mode
does work well in this case; it inserts the missing close block symbol
(and in general inserts other missing symbols).

It would be interesting to convert the C++ grammar used by tree-sitter
to a wisitoken grammar, and see how well that works. I don't have time
or energy for that, but I could support someone else doing it.

I am currently working on using tree-sitter as an ada-mode backend
parser, so we will be able to compare the two parser's indent behavior
using Ada test cases.

-- Stephe

reply via email to

[Prev in Thread] Current Thread [Next in Thread]