Skip to content

Conversation

@jfmengels
Copy link
Collaborator

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.

)
, test "negated expression after ==" <|
\() ->
"a==-x"
Copy link
Contributor

@lue-bird lue-bird Feb 12, 2025

Choose a reason for hiding this comment

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

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 in specifically.

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops, right.

And I agree that the current system is not enough for in.

@jfmengels
Copy link
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.

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