Open jfmengels opened 10 months ago
If you go back one commit from the current state of the branch, i.e this commit https://github.com/stil4m/elm-syntax/pull/207/commits/9126cda3ece73d00512ed46220896bf07bd2b6a5, there is a Test.only
on a test around parsing case expressions that doesn't work. IIRC It's because in the following case expression, the -
symbols are considered to be the -
by the Pratt parser.
case f of
True -> 1
False -> 2
I could be wrong about this, but that's what I had figured at some point. I have not been able to find a way to fix it yet.
I usually spread out operators too, and types that are recordsSent from my iPhoneOn Jul 8, 2024, at 16:11, Jeroen Engels @.***> wrote: @jfmengels commented on this pull request.
In review/src/OrderedRanges.elm:
@@ -18,6 +18,24 @@ rule = expressionVisitor : Node Expression -> List (Error {}) expressionVisitor node = case Node.value node of
- Expression.Application [ Node (Expression.FunctionOrValue [] "Application"), Node (Expression.ListExpr ((Node firstItemRange ) :: )) ] ->
- let
- { start, end } =
- Node.range node
- in
- if start.row == end.row then
- [ Rule.errorWithFix
- { message = "Split Application on multiple likes"
Good catch 👍 And I had good inspiration 😉 I wonder what other node we can apply this to, I don't remember what I usually did manually.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Fixes #199.
Reimplements the expression using a Pratt Parser (see explanation https://martin.janiczek.cz/2023/07/03/demystifying-pratt-parsers.html).
This is not completely done, and I imagine the remaining parts will be the trickiest to do. But I'm really happy about the progress (I've been trying for a few weeks but couldn't get it to work until this morning!).
I'm off for a week+ of vacation, so I'll have to pause work on this. If some people have insight about how to do this better, I'd love to hear about. If some want to continue the work, I'd love that too :smile:
TODO
dmy/elm-pratt-parser
as the project was heavily copied from that.