Skip to content

'scan' doesn't progress cursor. #37

@xOC4

Description

@xOC4

Cursor doesn't get advanced input upon successful state predicate match.

So the following will enter an infinite loop instead of parsing the lead "ABCD"
parseBytes (scan 0x41 (\b w -> if b <= w then Just w else Nothing)) (fromString "ABCDABCD")

Possible change:

let go s = do
        mw <- peek
        case mw of
          Nothing -> pure s
          Just w -> case t s w of
            Just s' -> anyUnsafe >> go s'
            Nothing -> pure s'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions