ghciwatch
ghciwatch copied to clipboard
Parse single-quoted GHC output more reliably
GHC output contains quoted fragments:
Module graph contains a cycle:
module ‘C’ (./C.hs)
imports module ‘A’ (A.hs)
which imports module ‘B’ (./B.hs)
which imports module ‘C’ (./C.hs)
When Unicode output is not available, the Unicode quotes are substituted for GNU-style ASCII quotes:
module `C' (./C.hs)
However, when the quoted text starts or ends with a single quote, ASCII quotes are omitted. This leads to ambiguous output:
A → `A'
A' → A'
`A' → `A'
'A → 'A
'A' → 'A'
Correctly parsing this is challenging.
This probably increases the amount of backtracking and lookahead required for these parsers. Not sure if that's significant or how concerning it is...
Split off of #297