-
Notifications
You must be signed in to change notification settings - Fork 148
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
WIP: Parsec API for the new Elm parser #740
Conversation
Note that `parserPlus` does not handle error merging properly, there is an `undefined` there. I'll need to figure out to what extent proper error handling is needed, does elm-format give specific error messages on syntax errors?
Turns out that `IndentParser` and even the `State SourcePos` bit used by `indents` can be factored out! So much simple now.
Turns out not all tasts are passing after all. |
-- | ||
-- Let's not devle into this unless it turns out that elm-format | ||
-- needs it. | ||
0x0d {- "\r" -} -> error "Can't handle carrige return" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly, elm-format will never output CRs, but it does read them. For ones in literal strings, it will convert them to an escape sequence. And for ones elsewhere, it will treat them either as newlines or whitespace (I forget which).
WIP: Parsec API for the new Elm parser
This is PR is the first step in an effort to integrate the parser from the Elm compiler into elm-format as part of a GSOC project (project proposal).
This PR removes the dependency on parsec and indents which have been used by elm-format to parse Elm code. The API these libraries provided has been replaced with drop-in replacement modules (located in
Text.Parsec.*
) compatible with elm-format. These replacement modules are implemented in terms of the new Elm parser (located inParse.Primitives
and copied from the Elm compiler).new-parser-2021-notes.md
in the project root goes into more detail on some specifics relating to this project.The entire test suite passes.