You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cabal.project parsing goes through legacy parsers and has a legacy -> current step. Its all rather awkward and also makes figuring out the actual grammar pretty difficult. It would be good to clean this up, capture the current grammar properly, and go through modern parsec parsers.
Well, maybe. As it is, we don't have any sane parsing at all. It would be nice to reuse as much of the cabal parsing machinery as possible, treating projects as a special grammar, at which point we could leverage the exact-print stuff.
... but actually figuring out what should or shouldn't be parsed.
The cabal.project parser reuses parts ~/.cabal/config parsing, there is some magic tying command line parsing in as well.
It's very messy, and not specified, there are only examples and some stuff which works, maybe intentionally, maybe accidentally.
I wouldn't tie exact print work with this. They are different challenges.
(EDIT: Just replicating what the current code does may be beneficial, already but i'm sure there are plenty of low-mid hanging cleanup&improvement opportunities).
Activity
ptkato commentedon Oct 14, 2021
I think this could be tied to the exact printing work. A project file doesn't differ much, in terms of how it's written, from a cabal file.
gbaz commentedon Oct 14, 2021
Well, maybe. As it is, we don't have any sane parsing at all. It would be nice to reuse as much of the cabal parsing machinery as possible, treating projects as a special grammar, at which point we could leverage the exact-print stuff.
phadej commentedon Oct 14, 2021
The challenge is not using some specific new framework, as parsing the project file would be something like
... but actually figuring out what should or shouldn't be parsed.
The
cabal.projectparser reuses parts~/.cabal/configparsing, there is some magic tying command line parsing in as well.It's very messy, and not specified, there are only examples and some stuff which works, maybe intentionally, maybe accidentally.
I wouldn't tie exact print work with this. They are different challenges.
(EDIT: Just replicating what the current code does may be beneficial, already but i'm sure there are plenty of low-mid hanging cleanup&improvement opportunities).
mmhat commentedon Aug 15, 2023
I think this can be closed since it is a duplicate of #6101.
Replace cabal project parsing with parsec implementation
Replace cabal project parsing with parsec implementation
Replace cabal project parsing with parsec implementation
Replace cabal project parsing with parsec implementation
Replace cabal project parsing with parsec implementation
Replace cabal project parsing with parsec implementation
Replace cabal project parsing with parsec implementation