haskell-suite/haskell-src-exts

self-delimiting parseExp (and others)?

jwaldmann opened this issue · 0 comments

can we make parseExp self-delimiting? The type is

parseExp :: String -> ParseResult (Exp SrcSpanInfo)

but I'd want "maximum munch" and the part that was not eaten,
as in :: String -> ParseResult (.. , String)

I tried

  parseExp "x } foo bar"
ParseFailed (SrcLoc "<unknown>.hs" 1 3) "Unexpected }"

so I could extract the error location, and then re-parse that prefix.
That's feels a bit strange.

(cf. https://mail.haskell.org/pipermail/haskell-cafe/2020-April/132124.html)