dmy/elm-pratt-parser/2.0.0

Pratt.Advanced

Pratt.Advanced provides the same API as Pratt, but for Parser.Advanced. This allows to have custom context and problem types to improve error messages.

Expression parser

type Config c x e

An opaque type holding the parser configuration.

{ oneOf : List (Config c x e -> Parser c x e)
, andThenOneOf : List (Config c x e -> ( Int, e -> Parser c x e ))
, spaces : Parser c x ()
}
-> Parser c x e

Just like Pratt.expression.

Configuration helpers

subExpression : Int -> Config c x e -> Parser c x e

oneOf helpers

literal : Parser c x e -> Config c x e -> Parser c x e

Just like Pratt.literal.

constant : Parser c x () -> e -> Config c x e -> Parser c x e

Just like Pratt.constant.

prefix : Int -> Parser c x () -> (e -> e) -> Config c x e -> Parser c x e

Just like Pratt.prefix.

andThenOneOf helpers

Int
-> Parser c x ()
-> (e -> e -> e)
-> Config c x e
-> ( Int, e -> Parser c x e )

Just like Pratt.infixLeft.

Int
-> Parser c x ()
-> (e -> e -> e)
-> Config c x e
-> ( Int, e -> Parser c x e )

Just like Pratt.infixRight.

Int
-> Parser c x ()
-> (e -> e)
-> Config c x e
-> ( Int, e -> Parser c x e )

Just like Pratt.postfix.