elm / parser

A parsing library, focused on simplicity and great error messages
https://package.elm-lang.org/packages/elm/parser/latest
BSD 3-Clause "New" or "Revised" License
228 stars 46 forks source link

chompUntil does not consume the last string #20

Open jinjor opened 5 years ago

jinjor commented 5 years ago

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))

Related: #2