Support more characters directly before negation#272
Open
Support more characters directly before negation#272
Conversation
lue-bird
approved these changes
Feb 12, 2025
lue-bird
reviewed
Feb 12, 2025
| ) | ||
| , test "negated expression after ==" <| | ||
| \() -> | ||
| "a==-x" |
Contributor
There was a problem hiding this comment.
in theory this one should not parse if we want to be that strict
-- UNKNOWN OPERATOR ------------------------------------------------------- REPL
I do not recognize the (==-) operator.
1| a==-x
^^^
Is there an `import` and `exposing` entry for it? Maybe you want (==) or (-)
instead?
Also, the fact that the let...in-a test fails is bad. We probably either need
- to check on
"n"that the previous is"i"and the one before isn't alphanumeric - a different kind of negation parser for after
inspecifically.
Currently I have passing tests with
if
(String.slice (offset - 3) (offset - 2) source == "i")
&& Basics.not
(String.all Char.Extra.isLatinAlphaNumOrUnderscoreFast
(String.slice (offset - 4) (offset - 3) source)
)
then
negationAfterMinus
else
ParserFast.problem
Collaborator
Author
There was a problem hiding this comment.
Oops, right.
And I agree that the current system is not enough for in.
Collaborator
Author
|
@lue-bird I don't think I'll merge this unless tests pass. Feel free to push to this branch (or create a new branch/PR on top of this one) if you'd like to continue the work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up to #271
I went through https://lucamug.github.io/elm-cheat-sheet/elm-cheat-sheet.color.pdf and found a bunch more characters that should be allowed before
-, which I've tested in the REPL. I've written tests for those. I've also added a few regressions tests for patterns that should not be supported (mostly things like<|-which the compiler understands as an unknown operator).I have not succeeded in supporting all of them though. I'd love help with this.