Closed HEIGE-PCloud closed 7 months ago
Actually, this isn't to do with the lexer at all. It feels reminiscent of https://github.com/j-mie6/parsley/issues/167, which also materialised with whitespace, and also with square brackets. But with an entirely different parsing architecture, that's rather surprising!
I'll take a look shortly and minimise it to something that doesn't involve the lexer
Ok:
ghci> parseRepl (optional digit <* char ']' <* hide (optional letter) <* eof) "]1"
(line 1, column 2):
unexpected "1"
expected digit or end of input
>]1
^
Turns out the hide
combinator is the required bit to make this break; thanks!
good' x st' = good x st' { Internal.hints = Internal.hints st } -- TODO: should this change valid offset?
I believe the answer is categorically: yes, lol
To reproduce, run
cabal repl
, thenObserve output
Expected output should not contain
expected "1"
.Seems to related to how whiteSpace is handled, after replacing
https://github.com/j-mie6/gigaparsec/blob/79736ee2bf83a921aefb98b836bd657b99004b6d/src/Text/Gigaparsec/Internal/Token/Lexer.hs#L68
with
apply = id
, the issue disappears.