Skip to content

Conversation

@doorgan
Copy link

@doorgan doorgan commented Jan 6, 2026

Split from #65
Fixes Spitfire.parse("%Foo = x") causing Spitfire to hang

With this fix the parser will continue while reporting an error. I'm not 100% sure if this is the behavior we want, we may want to fail the entire parsing, or report a different error.

@mhanberg
Copy link
Contributor

mhanberg commented Jan 6, 2026

we may want to fail the entire parsing

The point of the error resilient parsing is to tolerate errors (accumulate them) but then continue parsing the rest of the file

[
{:__aliases__, [last: [line: 1, column: 2], line: 1, column: 2], [:Foo]},
{:%{}, [closing: [line: 1, column: 8], line: 1, column: 6], [{:x, [line: 1, column: 8], nil}]}
]}, [{[line: 1, column: 8], "missing closing brace for struct"}]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be expecting the error message to say something about missing an opening brace for the struct. There might be something else not going correct here. I don't think %Foo is valid syntax by itself.

@lukaszsamson
Copy link
Contributor

I tried integrating spitfire with elixir_sense and my custom error tolerant lexer (https://github.com/elixir-lsp/elixir_toxic) that returns valid token ranges for all tokens but I found spitfire too buggy. I created some property tests that generate elixir programs and there are just too many cases of spitfire misparsing valid code, crashing or looping that I didn't even started on error recovery. Long story short, I am working on another custom parser.

@mhanberg
Copy link
Contributor

mhanberg commented Jan 6, 2026

I tried integrating spitfire with elixir_sense and my custom error tolerant lexer (https://github.com/elixir-lsp/elixir_toxic) that returns valid token ranges for all tokens but I found spitfire too buggy. I created some property tests that generate elixir programs and there are just too many cases of spitfire misparsing valid code, crashing or looping that I didn't even started on error recovery. Long story short, I am working on another custom parser.

Its not worth just fixing the bugs?

@mhanberg
Copy link
Contributor

mhanberg commented Jan 6, 2026

Also, that repo is private

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants