crumbtoo
2024-01-26 17:25:59 -07:00
parent 6a6076f26e
commit 8d0f324c63
6 changed files with 59 additions and 24 deletions

View File

@@ -164,10 +164,10 @@ alexGetByte inp = case inp ^. aiBytes of
-- report the previous char
& aiPrevChar .~ c
-- update the position
& aiPos %~ \ (ln,col) ->
& aiPos %~ \ (ln,col,a) ->
if c == '\n'
then (ln+1,1)
else (ln,col+1)
then (ln+1, 1, a+1)
else (ln, col+1, a+1)
pure (b, inp')
_ -> Just (head bs, inp')
@@ -225,7 +225,7 @@ initAlexInput s = AlexInput
{ _aiPrevChar = '\0'
, _aiSource = s
, _aiBytes = []
, _aiPos = (1,1)
, _aiPos = (1,1,0)
}
runP' :: P a -> Text -> (ParseState, [MsgEnvelope RlpParseError], Maybe a)