pithub/elm-parser-extra/1.0.0

Parser.Advanced.Extra

Convenience functions for Parser.Advanced.


Everything here works just like in the Parser.Extra module, except that String arguments become Token arguments, and you need to provide a Problem for certain scenarios.


Table of Contents

Look Ahead

lookAhead : Parser c x a -> Parser c x a
negativeLookAhead : x -> Parser c x a -> Parser c x ()

Just like Parser.Extra.negativeLookAhead except you provide a Token instead of a String. That way you can specify your custom type of problem for when the given parser would succeed.

Miscellaneous

followedBy : Parser c x b -> Parser c x a -> Parser c x b
committed : Parser c x a -> Parser c x a

Binds

Flipped versions of andThen with 1 to 5 parsers and callbacks with 1 to 5 input parameters.

(In other functional languages, the flipped version of andThen is often called "bind", hence the names here.)

bind : Parser c x a -> (a -> Parser c x b) -> Parser c x b
Parser c x a1
-> Parser c x a2
-> (a1 -> a2 -> Parser c x b)
-> Parser c x b
Parser c x a1
-> Parser c x a2
-> Parser c x a3
-> (a1 -> a2 -> a3 -> Parser c x b)
-> Parser c x b
Parser c x a1
-> Parser c x a2
-> Parser c x a3
-> Parser c x a4
-> (a1 -> a2 -> a3 -> a4 -> Parser c x b)
-> Parser c x b
Parser c x a1
-> Parser c x a2
-> Parser c x a3
-> Parser c x a4
-> Parser c x a5
-> (a1 -> a2 -> a3 -> a4 -> a5 -> Parser c x b)
-> Parser c x b

Low-Level

These are low-level functions which are used under the hood to implement some of the other parsers of this module.

Maybe they can be useful to you, too?

type alias ParserResult c x a =
Result (List (DeadEnd c x)) a

Result of Parser.Advanced.run. The type alias simplifies the following function signatures a little bit.

getParserResult : Parser c x a -> Parser c x (ParserResult c x a)
Parser c x a
-> Parser c x ( String, ParserResult c x ( a, Int ) )