-
-
Notifications
You must be signed in to change notification settings - Fork 8
Fix a few semicolon issues #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -225,6 +225,8 @@ defmodule Spitfire do | |||
precedence < power | |||
end | |||
|
|||
# TODO Is anything needed here? Removing all of these tokens does not break any tests | |||
# TODO Should we add :";" to the list? | |||
@terminals MapSet.new([:eol, :eof, :"}", :")", :"]", :">>"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests pass even with
@terminals MapSet.new([])
lib/spitfire.ex
Outdated
@@ -306,6 +308,8 @@ defmodule Spitfire do | |||
{parser, is_valid} = validate_peek(parser, current_token_type(parser)) | |||
|
|||
if is_valid do | |||
# TODO should we handle ; here? | |||
# TODO removing peek_token(parser) != :eol does not break any tests | |||
while is_nil(Map.get(parser, :stab_state)) and not MapSet.member?(terminals, peek_token(parser)) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests pass with
(current_token(parser) != :do) &&
lib/spitfire.ex
Outdated
@@ -1542,6 +1546,8 @@ defmodule Spitfire do | |||
else | |||
{left, parser} = prefix.(parser) | |||
|
|||
# TODO should we add ; here? | |||
# TODO is anything needed? Removing all tokens does not break any tests | |||
terminals = [:eol, :eof, :"}", :")", :"]", :">>"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests pass with
terminals = []
@@ -2141,8 +2147,12 @@ defmodule Spitfire do | |||
parser | |||
end | |||
|
|||
# TODO this may be too greedy. Probably the better option would be to have distinct eat_eol/1 and eat_eol_or_semicolon/1 | |||
defp eat_eol(parser) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eat_eol
should be more context aware. Semicolons are not allowed in all contexts or change the meaning
@@ -2212,7 +2222,7 @@ defmodule Spitfire do | |||
:eof | |||
end | |||
|
|||
defp peek_token_eat_eol(%{peek_token: {:eol, _token}} = parser) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eat_eol
should be more context aware. Semicolons are not allowed in all contexts or change the meaning
bb38d00
to
17d4b8f
Compare
Fixes crash 1 from #48
I tried to find all the places where
:eol
token was handled and by disabling that code discover tests that were affected. In a few places removing the code did not make any noticeable change so I left TODOs