Clarification on producing an “incomplete” AST for recoverable parsing
I have a language here: https://github.com/Germ210/Crabstar/tree/main. The parser’s output implements recoverable, but I want high-quality errors, which requires a syntax tree even when the input is incomplete.
Is this possible in Untwine right now? If so, how? If not, will it be implemented?
Untwine can produce incomplete syntax trees, yes. Check out the JSON example, where the JSONValue type has an Error variant which will be inserted whenever there is an error that was recovered from. The Rangeuntwine::parse or its variants for this if you want to recover the incomplete AST; instead construct a ParserContext and invoke the public parser function on it directly. You can take the output of that function call to get an AST, and you can use the methods on the ParserContext to inspect the errors.