-
-
Notifications
You must be signed in to change notification settings - Fork 13
Parsing error on - sign or -- sign #15
Comments
Hello @berry, unfortunately there are some parsing bugs for the Elm AST libraries out there. You can reproduce the parsing error by pasting it into Also, neither tunguski/elm-ast#33 (comment) I think that the Elm community would really benefit from a new Elm AST package that has 0.19 support and doesn't have so many parsing errors. Unfortunately, I don't have the bandwidth to be the one that takes that task on. But I would really love it if someone would step up to the challenge! I'll close this issue here since I can't help fix it unfortunately. But feel free to open an issue on |
Hi @dillonkearns, No problem. I already wondered why Elm 0.18 was being installed ;-) I am certainly no expert on AST libraries. But, in Elm-Slack I found this library mentioned: Elm syntax. It is an Elm parser in Elm. It is 0.19 compatible. I tested it on the code examples mentioned earlier in this issue and it parsed the code correctly. But, maybe you already know this library I actually found some discussion in elm-syntax on the possibility of using elm-syntax for sharing constants between Typescript and Elm ;-) See: stil4m/elm-syntax#24. That issue references other issues on Elm AST. I do hope that this issue on an up-to-date Elm AST gets resolved, because I do like your approach with elm-typescript-interop a lot! |
Hello @berry, thank you for that suggestion! I wasn't aware of that library, I'll explore that! I'll create a separate issue to track that exploration. Thank you! 🙏 |
@dillonkearns hi, I'm also here because Once I found this issue and your link to https://tunguski.github.io/elm-ast/example/ I was able to refactor around the quirks of
After:
❓ |
Hello @dukedave, thanks for the comment! That is an excellent idea. I would love a PR for that. And thanks for asking first, I always like to start with a discussion. This sounds like an uncontroversial one that I am definitely for so I would welcome a PR 👍 By the way, I'm going to be experimenting with https://github.com/stil4m/elm-syntax once I have some free time. I'm hoping that this might have fewer parsing bugs. But regardless, having a better error message would be very useful! |
Inspired by: dillonkearns#15.
FWIW: The IntelliJ Elm plugin has a decent Elm parser. |
@muelli I think the Elm IntelliJ plugin's Elm parser is highly specialized for building up a format for IntelliJ to consume. And it's also in Kotlin. I'm hoping that still4m/elm-syntax will be up for the task! |
@dillonkearns I made that PR, BTW: #18 |
Here is another test case: capitalize : String -> String
capitalize inValue =
let
tempValue = String.toUpper inValue -- List E.Value
outValue = String.trim tempValue
in
outValue The trailing comment breaks the parser. A line after the line with the comment appears to be necessary for the break. I am using Elm 0.19 and elm-typescript-interop version 0.0.15. Reproduced by inserting into elm-typescript-starter before |
Hi Dillon,
I encountered the following error:
I finally (took me a while) tracked this down to the two following situations. The first:
Elm compiles this code just fine. But,
npx elm-typescript-interop
reports the error stated above. If I remove the-- comment
or move it a line lower no error occurs.The second situation:
This is also valid Elm code, but
npx elm-typescript-interop
reports the error stated above. If I substitute the - sign with-1 *
then no error occurs.I am using Elm 0.19 en elm-typescript-interop version 0.0.15.
Berry.
The text was updated successfully, but these errors were encountered: