Skip to content

fix: add :eof to the terminator list in parse_stab_expression/1#92

Merged
doorgan merged 1 commit intoelixir-tools:mainfrom
rma97:fix/handle-eof-when-parsing-stab-expression
Feb 8, 2026
Merged

fix: add :eof to the terminator list in parse_stab_expression/1#92
doorgan merged 1 commit intoelixir-tools:mainfrom
rma97:fix/handle-eof-when-parsing-stab-expression

Conversation

@rma97
Copy link
Contributor

@rma97 rma97 commented Feb 5, 2026

resolves #90

As I understand, the problems lies in the terminating list when doing while2.
In the given example in the issue, the loop continues, peek becomes ->, then c, then :eof. At that point, without :eof in the terminator list, the loop would continue infinitely.

If im completely off, feel free to close this PR.

Keep up the good work!

end

test "prefix stab expression does not exhaust fuel" do
assert Spitfire.parse("-> a") ==
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests for valid code should assert it's the same as Code.string_to_quoted. There's a helper function for it you can see in other tests.

Copy link

Choose a reason for hiding this comment

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

I have removed the test, as it is not valid Elixir and Code.string_to_quoted returns an error. What i'm testing is just that we don't hit an infinite loop or exhaust the fuel. So the second test should be enough.

@rma97 rma97 force-pushed the fix/handle-eof-when-parsing-stab-expression branch from 8cc0dc7 to d255f32 Compare February 6, 2026 08:04
@mhanberg
Copy link
Contributor

mhanberg commented Feb 7, 2026

I think this might be handled by #93, can you please confirm @doorgan

@doorgan
Copy link
Contributor

doorgan commented Feb 7, 2026

It's not, even with #93 on main we still get an infinite loop without the fix in this pr

@mhanberg
Copy link
Contributor

mhanberg commented Feb 8, 2026

@rma97 could you rebase this on main and then I think we can merge

@rma97 rma97 force-pushed the fix/handle-eof-when-parsing-stab-expression branch from d255f32 to a1fb50c Compare February 8, 2026 08:25
@rma97 rma97 force-pushed the fix/handle-eof-when-parsing-stab-expression branch from a1fb50c to 2105d3a Compare February 8, 2026 08:27
@rma97
Copy link
Contributor Author

rma97 commented Feb 8, 2026

@rma97 could you rebase this on main and then I think we can merge

done

Copy link
Contributor

@doorgan doorgan left a comment

Choose a reason for hiding this comment

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

Thank you! 💜

@doorgan doorgan merged commit 8f976ef into elixir-tools:main Feb 8, 2026
37 checks passed
@rmand97
Copy link

rmand97 commented Feb 8, 2026

@doorgan I would love to help with both spitfire and expert, so I was wondering if you could use the "good first issue" tag or something like it, to easier ease into the codebase :)

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.

Infinite loop on unexpected } token

4 participants