dmy / elm-pratt-parser / 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.

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

Just like Pratt.expression.

Configuration helpers

subExpression : Basics.Int -> Config c x e -> Parser.Advanced.Parser c x e

Just like Pratt.subExpression.

oneOf helpers

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

Just like Pratt.literal.

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

Just like Pratt.constant.

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

Just like Pratt.prefix.

andThenOneOf helpers

infixLeft : Basics.Int -> Parser.Advanced.Parser c x () -> (e -> e -> e) -> Config c x e -> ( Basics.Int, e -> Parser.Advanced.Parser c x e )

Just like Pratt.infixLeft.

infixRight : Basics.Int -> Parser.Advanced.Parser c x () -> (e -> e -> e) -> Config c x e -> ( Basics.Int, e -> Parser.Advanced.Parser c x e )

Just like Pratt.infixRight.

postfix : Basics.Int -> Parser.Advanced.Parser c x () -> (e -> e) -> Config c x e -> ( Basics.Int, e -> Parser.Advanced.Parser c x e )

Just like Pratt.postfix.