Skip to content

chompUntil does not consume the last string #20

@jinjor

Description

@jinjor

chompUntil and chompUntilEndOr consume only position but not the last string. chompIf and chompWhile work as expected.

SSCCE: https://ellie-app.com/3MJnNtV3KDFa1

main : Html msg
main =
    text (Debug.toString (Parser.run chomper "foobar"))


chomper : Parser (String, ( Int, Int ))
chomper =
    succeed Tuple.pair
        |= getChompedString (chompUntil "bar")
        |= getPosition

exceted:

Ok ("foobar",(1,7))

actual:

Ok ("foo",(1,7))
  • elm/parser: 1.1.0

Related: #2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions