tree-sitter
tree-sitter copied to clipboard
Return early if syntax errors are encountered
Hi Tree-Sitter team!
In my use case of Tree-Sitter I've been parsing source code samples but was wanting to early exit if the file had an error during the parsing. I followed in the footsteps of the other parser settings (exit flag and timeout) for the rust binding.
Full disclosure I'm not completely sure if I got all the web asm binding side of things, I'm primarily coming in through the Rust binding side. But I tried to mimic everywhere I saw the timeout exit being exposed.
Happy to make changes!
@criminosis Thank you for the PR and the idea, but I added a proposal #2541 with a more generic design.
@ahlinc Glad to hear someone else liked the idea, I was beginning to worry I had fundamentally misunderstood my approach in my PR 😅 .
Checked out your proposal, it makes a lot of sense. Hope it gets some momentum!