[{"name":"Peg.Parser","comment":" A parser combinator implementation for Parsing Expression Grammer (PEG).\r\n\r\n# Parse\r\n@docs Parser, parse\r\n\r\n# Parsers\r\n@docs return, fail, match, char, chars\r\n\r\n# Basic Combinators\r\n@docs seq2, choice, option, zeroOrMore, oneOrMore, andPredicate, notPredicate\r\n\r\n# Transform\r\n@docs map, andThen\r\n\r\n# Sequence Utils\r\n@docs seq3, seq4, seq5, seq6, intersperseSeq2, intersperseSeq3, intersperseSeq4, intersperseSeq5, intersperseSeq6, join\r\n\r\n","unions":[{"name":"Parser","comment":" A value decides wether the given input string should be accepted or not and\r\nconverts it into Elm object when accepted. ","args":["a"],"cases":[]}],"aliases":[],"values":[{"name":"andPredicate","comment":" Generate and-predicate parser. The parse succeeds if the specified parser\r\naccepts the input and fails if the specified parser rejects, but in either case,\r\n never consumes any input.\r\n\r\n    word = chars (always True)\r\n    p = seq2 (andPredicate (match \"A\")) (\\_ w -> w)\r\n    p |> parse \"Apple\" == Just \"Apple\"\r\n    p |> parse \"Banana\" == Nothing\r\n","type":"Peg.Parser.Parser a -> Peg.Parser.Parser ()"},{"name":"andThen","comment":" Incorporate specified parser to the parser. It re-parse the input using\r\nspecified parser with the original result when the original parser success\r\nparse, otherwise the parse failed. Using it can set more stringent\r\nconditions for parse success.\r\n\r\n    intParser =\r\n      chars Char.isDigit\r\n        |> andThen (\\str ->\r\n          case String.toInt str of\r\n            Just i -> return i\r\n            Nothing -> fail)\r\n","type":"(a -> Peg.Parser.Parser b) -> Peg.Parser.Parser a -> Peg.Parser.Parser b"},{"name":"char","comment":" Generate the parser accepts characters satisfied with the specified\r\npredicator. The parser returns the specified character when accepted.\r\n\r\n    char Char.isUpper |> parse \"A\"  == Just 'A'\r\n    char Char.isUpper |> parse \"a\"  == Nothing\r\n","type":"(Char.Char -> Basics.Bool) -> Peg.Parser.Parser Char.Char"},{"name":"chars","comment":" Generate the parser accepts consecutive characters satisfied with the\r\nspecified predicator. The parser returns the string when accepted.\r\n\r\n    char Char.isUpper |> parse \"AAA\"  == Just \"AAA\"\r\n    char Char.isUpper |> parse \"aaa\"  == Nothing\r\n","type":"(Char.Char -> Basics.Bool) -> Peg.Parser.Parser String.String"},{"name":"choice","comment":" Generate new parser from specified parsers. result parser accepts all inputs\r\nspecified parsers accept. This combinator is ordered, in other words, if the\r\nfirst parser accepts input, the second parser is ignored. These parsers needs\r\nto be '() -> Parser' form. (It is useful for avoiding infinite reference.)\r\n\r\n    p =\r\n        choice\r\n        [ \\() -> match \"foo\"\r\n        , \\() -> match \"bar\"\r\n        ]\r\n    p |> parse \"foo\" == Just \"foo\"\r\n    p |> parse \"bar\" == Just \"bar\"\r\n","type":"List.List (() -> Peg.Parser.Parser a) -> Peg.Parser.Parser a"},{"name":"fail","comment":" This `Parser` always fails on parse. It is \"mzero\" on monad context.\r\nTypically used with `andThen`.\r\n","type":"Peg.Parser.Parser a"},{"name":"intersperseSeq2","comment":" Concatenate two parsers with a specified parser in between.\r\n\r\n    ws = match \" \" |> oneOrMore\r\n    varTy = choise [ \\() -> match \"int\", \\() -> match \"char\" ]\r\n    varName = chars Char.isAlpha\r\n    varDecl =\r\n      intersperseSeq2\r\n      ws varTy varName           -- matches like \"int x\" or \"char  foo\"\r\n      (\\ty name -> ( ty, name )) -- result like (\"int\", \"x\") or (\"char\", \"foo\")\r\n","type":"Peg.Parser.Parser i -> Peg.Parser.Parser a -> Peg.Parser.Parser b -> (a -> b -> result) -> Peg.Parser.Parser result"},{"name":"intersperseSeq3","comment":"","type":"Peg.Parser.Parser i -> Peg.Parser.Parser a -> Peg.Parser.Parser b -> Peg.Parser.Parser c -> (a -> b -> c -> result) -> Peg.Parser.Parser result"},{"name":"intersperseSeq4","comment":"","type":"Peg.Parser.Parser i -> Peg.Parser.Parser a -> Peg.Parser.Parser b -> Peg.Parser.Parser c -> Peg.Parser.Parser d -> (a -> b -> c -> d -> result) -> Peg.Parser.Parser result"},{"name":"intersperseSeq5","comment":"","type":"Peg.Parser.Parser i -> Peg.Parser.Parser a -> Peg.Parser.Parser b -> Peg.Parser.Parser c -> Peg.Parser.Parser d -> Peg.Parser.Parser e -> (a -> b -> c -> d -> e -> result) -> Peg.Parser.Parser result"},{"name":"intersperseSeq6","comment":"","type":"Peg.Parser.Parser i -> Peg.Parser.Parser a -> Peg.Parser.Parser b -> Peg.Parser.Parser c -> Peg.Parser.Parser d -> Peg.Parser.Parser e -> Peg.Parser.Parser f -> (a -> b -> c -> d -> e -> f -> result) -> Peg.Parser.Parser result"},{"name":"join","comment":" Generate one-or-more parser with a specified parser in between.\r\n\r\n    chars Char.isAlpha\r\n      |> join (match \", \")\r\n      |> parse \"foo, bar, baz\" -- == [\"foo\", \"bar\", \"baz\"]\r\n","type":"Peg.Parser.Parser i -> Peg.Parser.Parser a -> Peg.Parser.Parser (List.List a)"},{"name":"map","comment":" Generate new parser return mapped result by specifying mapper.\r\n","type":"(a -> b) -> Peg.Parser.Parser a -> Peg.Parser.Parser b"},{"name":"match","comment":" Generate the parser accepts the specified string. The parser returns the same\r\nstring when accepts.\r\n\r\n    parse \"abc\" (match \"abc\") == Just \"abc\"\r\n    parse \"xyz\" (match \"abc\") == Nothing\r\n","type":"String.String -> Peg.Parser.Parser String.String"},{"name":"notPredicate","comment":" Generate not-predicate parser. The parse succeeds if the specified parser\r\nrejects the input and fails if the specified parser accepts, but in either case,\r\n never consumes any input.\r\n\r\n    nums = chars Char.isDigit\r\n    p = seq2 (notPredicate (match \"0\")) nums (\\_ i -> i)\r\n    p |> parse \"1234\" == Just \"1234\"\r\n    p |> parse \"0123\" == Nothing\r\n","type":"Peg.Parser.Parser a -> Peg.Parser.Parser ()"},{"name":"oneOrMore","comment":" Generate one-or-more parser. It accept one or more consecutive repetitions\r\nof string specified parser accepts. it always behaves greedily, consuming as\r\nmuch input as possible.\r\n\r\n    p = oneOrMore (match \"a\")\r\n    p |> parse \"aaa\" == Just [\"a\", \"a\", \"a\"]\r\n    p |> parse \"\" == Nothing\r\n","type":"Peg.Parser.Parser a -> Peg.Parser.Parser (List.List a)"},{"name":"option","comment":" Generate optional parser. It accepts whatever string and consumes only if\r\nspecified parser accepts. The parse result is `Maybe` value.\r\n\r\n    option (match \"foo\") |> parse \"\" == Just Nothing\r\n","type":"Peg.Parser.Parser a -> Peg.Parser.Parser (Maybe.Maybe a)"},{"name":"parse","comment":" Parse the given string and return the result. It returns `Just` value when\r\nthe string is accepted, `Nothing` otherwise.\r\n\r\n    parse \"abc\" (match \"abc\") == Just \"abc\"\r\n    parse \"xyz\" (match \"abc\") == Nothing\r\n","type":"String.String -> Peg.Parser.Parser a -> Maybe.Maybe a"},{"name":"return","comment":" This `Parser` alway succeeds on parse and results in the given argument\r\nwithout consumption. Typically used with `andThen`.\r\n","type":"a -> Peg.Parser.Parser a"},{"name":"seq2","comment":" Concatenate two specified parsers, in other words, generate new parser\r\naccepts the sequence. The result is also merged according to the 3rd parameter.\r\n\r\n    seq2 (match \"con\") (match \"cat\") (++) |> parse \"concat\" == Just \"concat\"\r\n","type":"Peg.Parser.Parser a -> Peg.Parser.Parser b -> (a -> b -> result) -> Peg.Parser.Parser result"},{"name":"seq3","comment":"","type":"Peg.Parser.Parser a -> Peg.Parser.Parser b -> Peg.Parser.Parser c -> (a -> b -> c -> result) -> Peg.Parser.Parser result"},{"name":"seq4","comment":"","type":"Peg.Parser.Parser a -> Peg.Parser.Parser b -> Peg.Parser.Parser c -> Peg.Parser.Parser d -> (a -> b -> c -> d -> result) -> Peg.Parser.Parser result"},{"name":"seq5","comment":"","type":"Peg.Parser.Parser a -> Peg.Parser.Parser b -> Peg.Parser.Parser c -> Peg.Parser.Parser d -> Peg.Parser.Parser e -> (a -> b -> c -> d -> e -> result) -> Peg.Parser.Parser result"},{"name":"seq6","comment":"","type":"Peg.Parser.Parser a -> Peg.Parser.Parser b -> Peg.Parser.Parser c -> Peg.Parser.Parser d -> Peg.Parser.Parser e -> Peg.Parser.Parser f -> (a -> b -> c -> d -> e -> f -> result) -> Peg.Parser.Parser result"},{"name":"zeroOrMore","comment":" Generate zero-or-more parser. It accept zero or more consecutive repetitions\r\nof string specified parser accepts. it always behaves greedily, consuming as\r\nmuch input as possible.\r\n\r\n    p = zeroOrMore (match \"a\")\r\n    p |> parse \"aaa\" == Just [\"a\", \"a\", \"a\"]\r\n    p |> parse \"\" == Just []\r\n","type":"Peg.Parser.Parser a -> Peg.Parser.Parser (List.List a)"}],"binops":[]}]