avh4 / elm-format

elm-format formats Elm source code according to a standard set of rules based on the official Elm Style Guide
BSD 3-Clause "New" or "Revised" License
1.31k stars 148 forks source link

Parsec API refactor #743

Closed emmabastas closed 3 years ago

emmabastas commented 3 years ago

A refactoring of the parsec-like API, including the "documentation" in new-parser-2021-notes.md

Parsec-like API refactor

All of the modules providing the parsec-like API are merged into one single module. I.e. all functions found in Text.* are moved into Parse.ParsecAdapter. This means that all modules using the parsec-like API have had import statements changed resulting in the large file change count for this PR.

"Documentation" refactor

Notes found in new-parser-2021-notes.md which have been taken during the course of the parsec-like API work have been moved to more appropriate places, like source code comments and a Github issue, and the document has been removed.

Behavioral changes

The only change to the behavior of the parsec-like API can be found in bc58b34, a minor fix to the error message of a function.

Other refactorings

Parse.Helpers.failure has been re-implemented without the use of getInput and setInput, so that they can be removed from the API. This functions was re-implemented in elm/compiler at one point as well: https://github.com/elm/compiler/blob/9f6c60cec62a21f8eb205949f7a7115b60fd5832/src/Parse/Primitives.hs#L100