Skip to content
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

Parser error on 1+/**/1 #122

Closed
piegamesde opened this issue May 5, 2023 · 3 comments
Closed

Parser error on 1+/**/1 #122

piegamesde opened this issue May 5, 2023 · 3 comments

Comments

@piegamesde
Copy link
Member

nixfmt chokes on (1+/**/1) with "unexpected '+'; expecting expression". However, (1+ /**/1) works just fine

@yorickvP
Copy link
Contributor

yorickvP commented May 5, 2023

bug is here:

https://github.com/serokell/nixfmt/blob/c123d0a725cc916a467934a7db88c3d3a0ba88eb/src/Nixfmt/Parser.hs#L295-L297C5

In particular, operators can be followed by other operators.
Also failing: (1+.4)

@piegamesde
Copy link
Member Author

So, is the fix to simply remove the notFollowedBy (oneOf opChars)?

@Lucus16
Copy link
Contributor

Lucus16 commented Feb 9, 2024

The idea behind it was to prevent parsing ++ as + + and // as / / so something still needs to check for that.

piegamesde added a commit to piegamesde/nixfmt that referenced this issue Mar 14, 2024
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

No branches or pull requests

3 participants