Skip to content
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

Merged
merged 42 commits into from
Jul 13, 2021
Merged

Conversation

emmabastas
Copy link
Contributor

@emmabastas emmabastas commented Jul 6, 2021

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

@emmabastas
Copy link
Contributor Author

Turns out not all tasts are passing after all.
All of the units test are passing, but only some integrations tests. In particular most code containing let .. in and case .. of fails to parse.

@emmabastas emmabastas changed the title Gsoc 2021 Parsec API for the new Elm parser Jul 10, 2021
--
-- Let's not devle into this unless it turns out that elm-format
-- needs it.
0x0d {- "\r" -} -> error "Can't handle carrige return"
Copy link
Owner

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).

@avh4 avh4 changed the title Parsec API for the new Elm parser WIP: Parsec API for the new Elm parser Jul 13, 2021
@avh4 avh4 merged commit f57218e into avh4:new-parser-2021 Jul 13, 2021
@emmabastas emmabastas deleted the gsoc-2021 branch July 13, 2021 22:06
kutyel pushed a commit to kutyel/elm-format that referenced this pull request Apr 26, 2022
WIP: Parsec API for the new Elm parser
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.

2 participants