Repository navigation
Document readFields - #8983
Document readFields#8983phadej wants to merge 3 commits into
Conversation
As it runs fourmolu only on modified files, it's a lot faster.
For example `parseGenericPackageDescription` validates input it passes to `readFields'`. That is desirable: we want try to parse non-UTF8 inputs, and report as a warning if they are not UTF8. (There are non-UTF8 .cabal files on Hackage, e.g. with German names).
What is their encoding then? ISO 8859-2? |
I don't know. Maybe Latin1, maybe something else. Actually right now I can find only one file: https://hackage.haskell.org/package/nat-0.1/revision/0.cabal so maybe it can be patched (in |
|
ping |
|
Just asking: do we have a procedure to test parsing all cabal files on hackage? I am confident that the change you make here is well reasoned, but such a test would be good to have nonetheless. |
Yes. See This change however doesn't change what accepted or not. It's just (slightly) adjusts source locations reported (the indent amount was already calculated correctly). |
|
Thank you @phadej |
ulysses4ever
left a comment
There was a problem hiding this comment.
LGTM modulo commits that are already present in other PRs...
|
Merged in #9051. |
|
thanks @ffaf1 |
This PR cherry-picks a lexer BOM/NBSP commit from #8975.
The last commit documents
readFields:Document that readFields expects input to be UTF8
For example
parseGenericPackageDescriptionvalidates input it passes toreadFields'.That is desirable: we want try to parse non-UTF8 inputs, and report as a warning if they are not UTF8. (There are non-UTF8 .cabal files on Hackage, e.g. with German names).
In some other world lexer could repair invalid UTF8 on the fly, but OTOH it's quite simple to just do a prepass, as lexer makes (most of its) decisions on ASCII characters, and can treat text parts as opaque bytes.
This last commit doesn't change anything, it simply documents the current state of the codebase.