haskell / haskell/cabal

Make a spec-looking reference implementation of outer grammar.

Open
#4,965 3 comments 0 reactions 0 assignees View on GitHub
Cabal: parser exact-print type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

- The grammar is written in https://github.com/haskell/cabal/blob/76183b4ce6e9ffbd5246494fe560200d422313d9/Cabal/Distribution/Parsec/Parser.hs#L159-L206
- it uses ad-hoc formalism
- something like *Indentation-Sensitive PEG* from Indendation Sensitive Parsing for Parsec* https://dl.acm.org/citation.cfm?doid=2633357.2633369 should work better
- https://github.com/phadej/cabal-refact/blob/master/src/Distribution/Refact/Parser.hs is one my experiment, it doesn't support `{ }` (cabal files could have braces) IIRC.
- https://github.com/haskell/cabal/blob/master/boot/Lexer.x is useful too
- I think both `trifecta-indentation` and `megaparsec` should work.

- This is better done as a separate package in this repo `cabal-trifecta` or `cabal-megaparsec`, as there are technical limitations of having this as test-suite in `Cabal` package.

cc @sboosali

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.