[{"name":"Parser","comment":" Intuitive and easy to use parser library.\n\n\n# Basic usage\n\n@docs Parser, Error, parse, into, take, drop\n\n\n# Matching characters\n\n@docs anyChar, char, charNoCase, digit, digits, letter, letters, lowercase, uppercase, alphaNum, space, spaces\n\n\n# Text operations\n\n@docs text, textNoCase, textOf, line\n\n\n# List operations\n\n@docs sequence, concat, oneOf, maybe, zeroOrOne, zeroOrMore, oneOrMore, exactly, atLeast, atMost, between, until, untilIncluding, while\n\n\n# Chaining\n\n@docs succeed, expected, andThen, andThen2, andThenIgnore, orElse, orEnd, expecting, end, followedBy, notFollowedBy\n\n\n# Mapping\n\n@docs map, map2, map3, map4, map5, mapList\n\n","unions":[],"aliases":[{"name":"Error","comment":" Contains the description of an error.\nThis includes an error message, the position, and the context stack.\n","args":[],"type":"{ expected : String.String, lastChar : Maybe.Maybe Char.Char, input : String.String, row : Basics.Int, col : Basics.Int, context : List.List Parser.Context }"},{"name":"Parser","comment":" A `Parser` is defined as a function that takes an input state,\nincluding an input text, and returns either an [`Error`](#Error),\nor a value with the next state.\n","args":["a"],"type":"Parser.State -> Result.Result Parser.Error ( a, Parser.State )"}],"values":[{"name":"alphaNum","comment":" Matches exactly one letter or digit character.\nThis is case insensitive.\n\n> ℹ️ Equivalent regular expression: `[a-zA-Z0-9]`\n\n    -- Match a letter or number.\n    parse \"abc\" alphaNum --> Ok 'a'\n    parse \"ABC\" alphaNum --> Ok 'A'\n    parse \"123\" alphaNum --> Ok '1'\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    alphaNum\n        |> parse \"_abc\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a letter or a digit [a-zA-Z0-9].\\nI got stuck when I got the character '_'.\"\n\n","type":"Parser.Parser Char.Char"},{"name":"andThen","comment":" Parse one value `andThen` do something with that value,\nwhich results in another parser.\n\nThis can be used to validate the last thing we parsed,\nor transform the last value,\nor to use the last value for the next parser like a backreference.\n\n    -- Get some characters `andThen` interpret them as an `Int`.\n    import Parser.Error\n\n    textOf (oneOrMore anyChar)\n        |> andThen\n            (\\chars ->\n                case String.toInt chars of\n                    Just n -> succeed n\n                    Nothing -> expected \"an integer, better use Parser.Common.int\"\n            )\n        |> parse \"123\"\n    --> Ok 123\n\n","type":"(a -> Parser.Parser b) -> Parser.Parser a -> Parser.State -> Result.Result Parser.Error ( b, Parser.State )"},{"name":"andThen2","comment":" Parse two values `andThen2` do something with those values,\nwhich results in another parser.\n\nThis can be used to validate the last things we parsed,\nor transform the last values,\nor to ignore eiher of the values,\nor to use the last values for the next parser like a backreference.\n\n    -- Get something like \"=123\" `andThen` interpret it as an `Int`.\n    andThen2\n        (\\_ chars ->\n            case String.toInt chars of\n                Just n -> succeed n\n                Nothing -> expected \"an integer, better use Parser.Common.int\"\n        )\n        (char '=')\n        digits\n        |> parse \"=123\"\n    --> Ok 123\n\n","type":"(a -> b -> Parser.Parser c) -> Parser.Parser a -> Parser.Parser b -> Parser.Parser c"},{"name":"andThenIgnore","comment":" Parse and consume the next parser, but ignore its value.\n\nThis is useful when you want to match and advance the parser,\nbut keep the previous value.\n\n    -- Let's parse a simple email, but we're only interested in the username.\n    letters\n        |> andThenIgnore (char '@')\n        |> andThenIgnore letters\n        |> andThenIgnore (text \".com\")\n        |> parse \"user@example.com\"\n    --> Ok \"user\"\n\n    -- To ignore previous values, you can use a regular andThen\n    letters\n        |> andThen (\\_ -> char '@')\n        |> andThen (\\_ -> letters)\n        |> andThenIgnore (text \".com\")\n        |> parse \"user@example.com\"\n    --> Ok \"example\"\n\n","type":"Parser.Parser ignore -> Parser.Parser a -> Parser.Parser a"},{"name":"anyChar","comment":" Matches any single character.\n\n> ℹ️ Equivalent regular expression: `.`\n\n    -- We can match any character.\n    parse \"abc\" anyChar --> Ok 'a'\n    parse \"#hashtag\" anyChar --> Ok '#'\n\n    -- This can only fail if we run out of inputs.\n    import Parser.Error\n\n    anyChar\n        |> parse \"\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:0: I was expecting a character.\\nI reached the end of the input text.\"\n\n","type":"Parser.State -> Result.Result Parser.Error ( Char.Char, Parser.State )"},{"name":"atLeast","comment":" Parses a value at least a number of times and returns them as a `List`.\n\n> ℹ️ Equivalent regular expression: `{min,}`\n\n    -- We want at least three letters, we are okay with more than three.\n    parse \"abcdef\" (atLeast 3 letter) --> Ok [ 'a', 'b', 'c', 'd', 'e', 'f' ]\n\n    -- But not two, that's sacrilegious.\n    import Parser.Error\n\n    atLeast 3 letter\n        |> parse \"ab_def\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:3: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '_'.\"\n\n","type":"Basics.Int -> Parser.Parser a -> Parser.Parser (List.List a)"},{"name":"atMost","comment":" Parses a value at most a number of times and returns them as a `List`.\n\n> ℹ️ Equivalent regular expression: `{0,max}`\n\n    -- We want a maximum of three letters.\n    parse \"abcdef\" (atMost 3 letter) --> Ok [ 'a', 'b', 'c' ]\n\n    -- Less than that is also okay.\n    parse \"ab_def\" (atMost 3 letter) --> Ok [ 'a', 'b' ]\n\n    -- Even zero letters are fine.\n    parse \"_bcdef\" (atMost 3 letter) --> Ok []\n\n","type":"Basics.Int -> Parser.Parser a -> Parser.Parser (List.List a)"},{"name":"between","comment":" Parses a value between a range of times and returns them as a `List`.\n\n> ℹ️ Equivalent regular expression: `{min,max}`\n\n    -- We want between two and four letters.\n    parse \"abcdef\" (between 2 4 letter) --> Ok [ 'a', 'b', 'c', 'd' ]\n    parse \"abc_ef\" (between 2 4 letter) --> Ok [ 'a', 'b', 'c' ]\n    parse \"ab_def\" (between 2 4 letter) --> Ok [ 'a', 'b' ]\n\n    -- But less than that is not cool.\n    import Parser.Error\n\n    between 2 3 letter\n        |> parse \"a_cdef\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:2: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '_'.\"\n\n","type":"Basics.Int -> Basics.Int -> Parser.Parser a -> Parser.Parser (List.List a)"},{"name":"char","comment":" Matches a specific single character.\nThis is case sensitive.\n\n    -- Match a specific character, case sensitive.\n    parse \"abc\" (char 'a') --> Ok 'a'\n\n    -- It fails if it's not _exactly_ the same.\n    import Parser.Error\n\n    char 'a'\n        |> parse \"ABC\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting the character 'a'.\\nI got stuck when I got the character 'A'.\"\n\n","type":"Char.Char -> Parser.Parser Char.Char"},{"name":"charNoCase","comment":" Matches a specific single character.\nThis is case insensitive.\n\n    -- Match a specific character, case insensitive.\n    parse \"abc\" (charNoCase 'a') --> Ok 'a'\n    parse \"ABC\" (charNoCase 'a') --> Ok 'A'\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    charNoCase 'a'\n        |> parse \"123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting the character 'a' (case insensitive).\\nI got stuck when I got the character '1'.\"\n\n","type":"Char.Char -> Parser.Parser Char.Char"},{"name":"concat","comment":" Concatenates the parsed values from all the parsers into a single list with\nall the values.\n\n    -- We get all these parsers as a single sequence of values.\n    concat\n        [ oneOrMore digit       -- [ '3' ]\n        , zeroOrOne (char '.')  -- [ '.' ]\n        , zeroOrMore digit      -- [ '1', '4' ]\n        ]\n        |> parse \"3.14\"\n    --> Ok [ '3', '.', '1', '4' ]\n\n","type":"List.List (Parser.Parser (List.List a)) -> Parser.Parser (List.List a)"},{"name":"digit","comment":" Matches exactly one digit character.\n\n> ℹ️ Equivalent regular expression: `[0-9]` or `\\d`\n\n    -- Match a digit.\n    parse \"123\" digit --> Ok '1'\n    parse \"3.14\" digit --> Ok '3'\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    digit\n        |> parse \"abc\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a digit [0-9].\\nI got stuck when I got the character 'a'.\"\n\n","type":"Parser.Parser Char.Char"},{"name":"digits","comment":" Matches one or more digit.\n\n> ℹ️ Equivalent regular expression: `[0-9]+` or `\\d+`\n\n    -- Match many digits.\n    parse \"123abc\" digits --> Ok \"123\"\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    digits\n        |> parse \"abc123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting one or more digits [0-9]+.\\nI got stuck when I got the character 'a'.\"\n\n","type":"Parser.Parser String.String"},{"name":"drop","comment":" Ignores a parsed value, but it still must match to continue.\n","type":"Parser.Parser a -> Parser.Parser b -> Parser.Parser b"},{"name":"end","comment":" Succeeds only if there are no more remaining characters in the input text.\nThis does not consume any inputs.\n\n> ℹ️ Equivalent regular expression: `$`\n\n    -- Get some letters, and there are better no input characters left.\n    letters\n        |> end\n        |> parse \"abc\"\n    --> Ok \"abc\"\n\n    -- Or fail otherwise.\n    import Parser.Error\n\n    letters\n        |> end\n        |> parse \"abc123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:4: I was expecting the end of the input text, but 3 characters are still remaining.\\nI got stuck when I got the character '1'.\"\n\n","type":"Parser.Parser a -> Parser.State -> Result.Result Parser.Error ( a, Parser.State )"},{"name":"exactly","comment":" Parses a value exactly a number of times and returns them as a `List`.\n\n> ℹ️ Equivalent regular expression: `{n}`\n\n    -- We want `exactly` three letters.\n    parse \"abcdef\" (exactly 3 letter) --> Ok [ 'a', 'b', 'c' ]\n\n    -- Not two or four, we want three.\n    import Parser.Error\n\n    exactly 3 letter\n        |> parse \"ab_def\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:3: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '_'.\"\n\n","type":"Basics.Int -> Parser.Parser a -> Parser.Parser (List.List a)"},{"name":"expected","comment":" A parser that always fails with the given error message.\n\n    -- Always fails with an error message.\n    import Parser.Error\n\n    expected \"nothing, this always fails\"\n        |> parse \"\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:0: I was expecting nothing, this always fails.\\nI reached the end of the input text.\"\n\n","type":"String.String -> Parser.State -> Result.Result Parser.Error ( a, Parser.State )"},{"name":"expecting","comment":" If there is an error, this replaces the error message.\nThis helps create more descriptive error messages instead of the more generic\nones.\n\nIf you want to use the value that failed some validation in the error message,\nconsider using a more relaxed parser and using [`andThen`](#andThen) to do the\nvalidation.\nIt's a little longer, but that way you get access to the potentially invalid\nparsed value.\n\n    -- We can redefine an error message if something goes wrong.\n    import Parser.Error\n\n    letters\n        |> expecting \"a name consisting of letters\"\n        |> parse \"123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a name consisting of letters.\\nI got stuck when I got the character '1'.\"\n\n","type":"String.String -> Parser.Parser a -> Parser.State -> Result.Result Parser.Error ( a, Parser.State )"},{"name":"followedBy","comment":" Succeeds only if the input text is followed by a _lookahead_ parser.\nThis does not consume any inputs.\n\n> ℹ️ Equivalent regular expression: `(?=...)` _(positive lookahead)_\n\n    -- Match letters only if it's `followedBy` a digit.\n    letters\n        |> followedBy digit\n        |> parse \"abc123\"\n    --> Ok \"abc\"\n\n    -- Even if we match the letters, fail if the next character is not a digit.\n    import Parser.Error\n\n    letters\n        |> followedBy digit\n        |> parse \"abc@def\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:4: I was expecting a digit [0-9].\\nI got stuck when I got the character '@'.\"\n\n","type":"Parser.Parser lookahead -> Parser.Parser a -> Parser.State -> Result.Result Parser.Error ( a, Parser.State )"},{"name":"into","comment":" Starts a parsing pipeline to parse into a data type.\n\nYou should also specify a name for the context,\nthis helps to give better error messages.\n\n    import Parser.Common exposing (number)\n\n    type alias Point =\n        { x : Float\n        , y : Float\n        }\n\n    -- We can use `into` to have more context when an error happens.\n    point : Parser Point\n    point =\n        into \"Point\"\n            (succeed Point\n                |> drop (char '(')\n                |> take number\n                |> drop (char ',')\n                |> take number\n                |> drop (char ')')\n            )\n\n    parse \"(12,34)\" point --> Ok {x = 12, y = 34}\n\n    -- We can get the error context stack as well as where they started matching.\n    parse \"(a,b)\" point\n        |> Result.mapError .context\n    --> Err [{ name = \"Point\", row = 1, col = 1 }]\n\n","type":"String.String -> Parser.Parser a -> Parser.State -> Result.Result Parser.Error ( a, Parser.State )"},{"name":"letter","comment":" Matches exactly one letter character.\nThis is case insensitive.\n\n> ℹ️ Equivalent regular expression: `[a-zA-Z]`\n\n    -- Match any letter, case insensitive.\n    parse \"abc\" letter --> Ok 'a'\n    parse \"ABC\" letter --> Ok 'A'\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    letter\n        |> parse \"123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '1'.\"\n\n","type":"Parser.Parser Char.Char"},{"name":"letters","comment":" Matches one or more letter.\nThis is case insensitive.\n\n> ℹ️ Equivalent regular expression: `[a-zA-Z]+`\n\n    -- Match many letters, case insensitive.\n    parse \"abc123\" letters --> Ok \"abc\"\n    parse \"ABC123\" letters --> Ok \"ABC\"\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    letters\n        |> parse \"123abc\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting one or more letters [a-zA-Z]+.\\nI got stuck when I got the character '1'.\"\n\n","type":"Parser.Parser String.String"},{"name":"line","comment":" Gets a line from the input text, delimited by '\\\\n'.\n\n    -- A line could be delimited by the newline character '\\n'.\n    parse \"abc\\ndef\" line --> Ok \"abc\"\n\n    -- Or this could also be the last line.\n    parse \"abc\" line --> Ok \"abc\"\n\n    -- An empty line still counts.\n    parse \"\" line --> Ok \"\"\n\n","type":"Parser.Parser String.String"},{"name":"lowercase","comment":" Matches exactly one lowercase letter character.\nThis is case sensitive.\n\n> ℹ️ Equivalent regular expression: `[a-z]`\n\n    -- Match a lowercase letter.\n    parse \"abc\" lowercase --> Ok 'a'\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    lowercase\n        |> parse \"ABC\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a lowercase letter [a-z].\\nI got stuck when I got the character 'A'.\"\n\n","type":"Parser.Parser Char.Char"},{"name":"map","comment":" Transform the result of a parser.\n\n    -- Get some letters, and make them lowercase.\n    letters\n        |> map String.toLower\n        |> parse \"ABC\"\n    --> Ok \"abc\"\n\n","type":"(a -> b) -> Parser.Parser a -> Parser.Parser b"},{"name":"map2","comment":" Transform the result of two parsers.\n\n    import Parser.Common exposing (int)\n\n    -- Get an `Int` and apply an unary operator.\n    map2\n        (\\op x ->\n            if op == '-' then\n                -x\n            else\n                x\n        )\n        (oneOf [char '+', char '-'])\n        int\n        |> parse \"-123\"\n    --> Ok -123\n\n","type":"(a -> b -> c) -> Parser.Parser a -> Parser.Parser b -> Parser.Parser c"},{"name":"map3","comment":" Transform the result of three parsers.\n\n    import Parser.Common exposing (int)\n\n    -- Get an `Int` and apply a binary operator.\n    map3\n        (\\x op y ->\n            if op == '+' then\n                x + y\n            else\n                x - y\n        )\n        int\n        (oneOf [char '+', char '-'])\n        int\n        |> parse \"5+2\"\n    --> Ok 7\n\n","type":"(a -> b -> c -> d) -> Parser.Parser a -> Parser.Parser b -> Parser.Parser c -> Parser.Parser d"},{"name":"map4","comment":" Transform the result of four parsers.\n","type":"(a -> b -> c -> d -> e) -> Parser.Parser a -> Parser.Parser b -> Parser.Parser c -> Parser.Parser d -> Parser.Parser e"},{"name":"map5","comment":" Transform the result of five parsers.\n","type":"(a -> b -> c -> d -> e -> f) -> Parser.Parser a -> Parser.Parser b -> Parser.Parser c -> Parser.Parser d -> Parser.Parser e -> Parser.Parser f"},{"name":"mapList","comment":" Transform the result of a list of parsers.\nNote that all parsers must be of the same type, unlike `map2`..`map5`.\n\n    -- Match a list of parsers, and then `map` a function to the results.\n    mapList (String.join \",\")\n        [ text \"ab\"\n        , text \"cd\"\n        , letters\n        ]\n        |> parse \"abcdefg\"\n    --> Ok \"ab,cd,efg\"\n\n","type":"(List.List a -> b) -> List.List (Parser.Parser a) -> Parser.Parser b"},{"name":"maybe","comment":" Parses an optional value and returns it as a `Maybe`.\n\n> ℹ️ Equivalent regular expression: `?`\n\n    -- Maybe we get `Just` a letter.\n    parse \"abc\" (maybe letter) --> Ok (Just 'a')\n\n    -- Or maybe we get `Nothing`.\n    parse \"_abc\" (maybe letter) --> Ok Nothing\n\n","type":"Parser.Parser a -> Parser.Parser (Maybe.Maybe a)"},{"name":"notFollowedBy","comment":" Succeeds only if the input text is _not_ followed by a _lookahead_ parser.\nThis does not consume any inputs.\n\n> ℹ️ It's a good idea to use [`expecting`](#expecting) alongside this function\n> to improve the error messages.\n\n> ℹ️ Equivalent regular expression: `(?!...)` _(negative lookahead)_\n\n    -- Match letters only if it's `notFollowedBy` a digit.\n    letters\n        |> notFollowedBy digit\n        |> expecting \"letters not followed by a number\"\n        |> parse \"abc@def\"\n    --> Ok \"abc\"\n\n    -- Even if we match the letters, fail if the next character is a digit.\n    import Parser.Error\n\n    -- This is the default error message, but you can use `expecting` to improve it.\n    letters\n        |> notFollowedBy digit\n        |> parse \"abc123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:4: I was expecting to not match a pattern, but I did.\\nI got stuck when I got the character '1'.\"\n\n","type":"Parser.Parser lookahead -> Parser.Parser a -> Parser.State -> Result.Result Parser.Error ( a, Parser.State )"},{"name":"oneOf","comment":" Returns the value of the first parser that matches.\nIt tries to match the parsers in order.\n\nIf none of the parsers match, it keeps the error message from the last parser.\nTo give a more descriptive error message, you can use [`expecting`](#expecting).\n\n> ℹ️ It's a good idea to use [`expecting`](#expecting) alongside this function\n> to improve the error messages.\n\n> ℹ️ Equivalent regular expression: `|`\n\n    -- Try the first parser.\n    oneOf [ char '_', letter ]\n        |> parse \"_abc\"\n    --> Ok '_'\n\n    -- If it doesn't work, try the next.\n    oneOf [ char '_', letter ]\n        |> parse \"abc\"\n    --> Ok 'a'\n\n    -- If none of them work, we get the error from the last parser.\n    import Parser.Error\n\n    oneOf [ char '_', letter ]\n        |> parse \"123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '1'.\"\n\n","type":"List.List (Parser.Parser a) -> Parser.Parser a"},{"name":"oneOrMore","comment":" Parses one or more values and returns them as a `List`.\n\n> ℹ️ Equivalent regular expression: `+`\n\n    -- We want as many letters as there are.\n    parse \"abc\" (oneOrMore letter) --> Ok [ 'a', 'b', 'c' ]\n\n    -- But we want at least one.\n    import Parser.Error\n\n    oneOrMore letter\n        |> parse \"_abc\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '_'.\"\n\n","type":"Parser.Parser a -> Parser.Parser (List.List a)"},{"name":"orElse","comment":" If the previous parser failed, try a fallback parser.\n\n    -- Try letters, `orElse` give me some digits.\n    letters\n        |> orElse digits\n        |> parse \"abc\"\n    --> Ok \"abc\"\n\n    -- We didn't get letters, but we still got digits.\n    letters\n        |> orElse digits\n        |> parse \"123\"\n    --> Ok \"123\"\n\n    -- But if we still fail, give the error message of the fallback parser.\n    import Parser.Error\n\n    letters\n        |> orElse digits\n        |> parse \"_\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting one or more digits [0-9]+.\\nI got stuck when I got the character '_'.\"\n\n","type":"Parser.Parser a -> Parser.Parser a -> Parser.State -> Result.Result Parser.Error ( a, Parser.State )"},{"name":"orEnd","comment":" Succeeds either if the parser succeeds,\nor if there are no more input characters.\n\n    -- Get some letters.\n    letters\n        |> orEnd\n        |> parse \"abc123\"\n    --> Ok (Just \"abc\")\n\n    -- If we get to the end of inputs, that's still okay.\n    letters\n        |> orEnd\n        |> parse \"\"\n    --> Ok Nothing\n\n    -- But if we match something different, that's _not_ okay.\n    import Parser.Error\n\n    letters\n        |> orEnd\n        |> parse \"123abc\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting one or more letters [a-zA-Z]+.\\nI got stuck when I got the character '1'.\"\n\n","type":"Parser.Parser a -> Parser.Parser (Maybe.Maybe a)"},{"name":"parse","comment":" Parse an input text, and get either an [`Error`](#Error)\nor the parsed value as a result.\n\n    -- Consumes a single letter, then \"bc\" are still remaining.\n    parse \"abc\" letter --> Ok 'a'\n\n    -- We get an error message if the parser doesn't match.\n    import Parser.Error\n\n    letter\n        |> parse \"123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '1'.\"\n\n","type":"String.String -> Parser.Parser a -> Result.Result Parser.Error a"},{"name":"sequence","comment":" Matches a sequence of parsers in order, and gets the result as a `List`.\n\n    -- Note that all the parsers must be of the same type, like `Parser Char`.\n    sequence [ char '_', letter, digit ]\n        |> parse \"_A5\" --> Ok [ '_', 'A', '5' ]\n\n","type":"List.List (Parser.Parser a) -> Parser.State -> Result.Result Parser.Error ( List.List a, Parser.State )"},{"name":"space","comment":" Matches a blank space character.\nA blank space can be a\nregular space `' '`,\ntab `'\\t'`,\nnew line `'\\n'`,\ncarriage return `'\\r'`,\nform feed `'\\f'`,\nor vertical tab `'\\v'`.\n\n> ℹ️ Equivalent regular expression: `[ \\t\\n\\r\\f\\v]` or `\\s`\n\n    -- Match a blank space.\n    parse \"    abc\" space --> Ok ' '\n    parse \"\\t abc\" space --> Ok '\\t'\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    space\n        |> parse \"abc\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a blank space.\\nI got stuck when I got the character 'a'.\"\n\n","type":"Parser.Parser Char.Char"},{"name":"spaces","comment":" Matches zero or more spaces.\n\n> ℹ️ Equivalent regular expression: `[ \\t\\n\\r\\f\\v]*` or `\\s*`\n\n    -- Match many spaces.\n    parse \"    abc\" spaces --> Ok \"    \"\n\n    parse \"\\t abc\" spaces --> Ok \"\\t \"\n\n    -- Including zero spaces :)\n    parse \"abc\" spaces --> Ok \"\"\n\n","type":"Parser.Parser String.String"},{"name":"succeed","comment":" A parser that always succeeds with the given value.\n\n    -- Always succeed with \"abc\" no matter the input text.\n    parse \"\" (succeed \"abc\") --> Ok \"abc\"\n\n    -- This is usually used to start parser pipelines.\n    import Parser.Common exposing (int)\n\n    type alias Pair =\n        { x : Int\n        , y : Int\n        }\n\n    pair : Parser Pair\n    pair =\n        succeed Pair\n            |> take int\n            |> drop (char ',')\n            |> take int\n\n    parse \"12,34\" pair --> Ok { x = 12, y = 34 }\n\n","type":"a -> Parser.State -> Result.Result Parser.Error ( a, Parser.State )"},{"name":"take","comment":" Takes a parsed value and feeds it to the return value of the parser.\n","type":"Parser.Parser a -> Parser.Parser (a -> b) -> Parser.Parser b"},{"name":"text","comment":" Matches a specific text string.\nThis is case sensitive.\n\n    -- Match an exact text, case sensitive.\n    parse \"abcdef\" (text \"abc\") --> Ok \"abc\"\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    text \"abc\"\n        |> parse \"abCDEF\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:3: I was expecting the text 'abc'.\\nI got stuck when I got the character 'C'.\"\n\n","type":"String.String -> Parser.Parser String.String"},{"name":"textNoCase","comment":" Matches a specific text string.\nThis is case insensitive.\n\n    -- Match an exact text, case insensitive.\n    parse \"abcdef\" (textNoCase \"abc\") --> Ok \"abc\"\n    parse \"ABCDEF\" (textNoCase \"abc\") --> Ok \"ABC\"\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    textNoCase \"abc\"\n        |> parse \"ab@\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:3: I was expecting the text 'abc' (case insensitive).\\nI got stuck when I got the character '@'.\"\n\n","type":"String.String -> Parser.Parser String.String"},{"name":"textOf","comment":" Gets a string from a list of characters.\n\n    -- Get a `String` out of a `List Char`, we could have also used `letters` :)\n    textOf (oneOrMore letter)\n        |> parse \"abc123\" --> Ok \"abc\"\n\n","type":"Parser.Parser (List.List Char.Char) -> Parser.Parser String.String"},{"name":"until","comment":" Parses a values repeatedly until a delimiter parser matches.\nThe delimiter marks the end of the sequence, and it is _not_ consumed.\n\n    -- Get all the letters until we find 'd'.\n    letter\n        |> until (char 'd')\n        |> parse \"abcdef\"\n    --> Ok [ 'a', 'b', 'c' ]\n\n    -- The delimiter is _not_ consumed.\n    succeed (\\str -> str)\n        |> drop (char '<')\n        |> take (textOf (letter |> until (char '>')))\n        |> drop (char '>')\n        |> end\n        |> parse \"<abc>\"\n    --> Ok \"abc\"\n\n    -- If the delimiter is not found, we get an error.\n    import Parser.Error\n\n    letter\n        |> until (char 'd')\n        |> parse \"abc123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:4: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '1'.\"\n\n","type":"Parser.Parser stop -> Parser.Parser a -> Parser.Parser (List.List a)"},{"name":"untilIncluding","comment":" Parses a values repeatedly until a delimiter parser matches.\nThe delimiter marks the end of the sequence, and it is consumed.\n\n    -- Gets all the letters until we find 'd'.\n    letter\n        |> untilIncluding (char 'd')\n        |> parse \"abcdef\"\n    --> Ok ([ 'a', 'b', 'c' ], 'd')\n\n    -- If we don't care about the delimiter, we can extract only the values.\n    letter\n        |> untilIncluding (char 'd')\n        |> map Tuple.first\n        |> parse \"abcdef\"\n    --> Ok [ 'a', 'b', 'c' ]\n\n    -- The delimiter is consumed.\n    succeed (\\str -> str)\n        |> drop (char '<')\n        |> take (textOf (letter |> untilIncluding (char '>') |> map Tuple.first))\n        |> end\n        |> parse \"<abc>\"\n    --> Ok \"abc\"\n\n    -- If the delimiter is not found, we get an error.\n    import Parser.Error\n\n    letter\n        |> untilIncluding (char 'd')\n        |> parse \"abc123\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:4: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '1'.\"\n\n","type":"Parser.Parser stop -> Parser.Parser a -> Parser.Parser ( List.List a, stop )"},{"name":"uppercase","comment":" Matches exactly one uppercase letter character.\nThis is case sensitive.\n\n> ℹ️ Equivalent regular expression: `[A-Z]`\n\n    -- Match an uppercase letter.\n    parse \"ABC\" uppercase --> Ok 'A'\n\n    -- But anything else makes it fail.\n    import Parser.Error\n\n    uppercase\n        |> parse \"abc\"\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting an uppercase letter [A-Z].\\nI got stuck when I got the character 'a'.\"\n\n","type":"Parser.Parser Char.Char"},{"name":"while","comment":" Parses values while a condition is still `True`.\nOnce the condition is `False`,\nthe sequence stops and the current value is not consumed.\n\nIf the condition never gets to `False`, it parses until it stops matching\nor until the end of the input text.\n\nThe condition function takes two inputs:\na list of all the previously matched values,\nand the current value matched.\n\n> ℹ️ This is a low level function, for most cases you can probably find a higher\n> level function that is more readable and easier to use.\n\n    -- Get letters `while` the current letter is not 'd'.\n    -- In other words, stop until we find a 'd'.\n    letter\n        |> while (\\_ value -> value /= 'd')\n        |> parse \"abcdef\"\n    --> Ok [ 'a', 'b', 'c' ]\n\n    -- Get letters `while` we've got less than 3 letters.\n    -- In other words, stop until we have three letters.\n    letter\n        |> while (\\values _ -> List.length values < 3)\n        |> parse \"abcdef\"\n    --> Ok [ 'a', 'b', 'c' ]\n\n    -- If we stop matching, we still succeed with whatever we could get.\n    letter\n        |> while (\\_ value -> value /= 'd')\n        |> parse \"abc123\"\n    --> Ok [ 'a', 'b', 'c' ]\n\n    -- Once the condition fails, that input is _not_ consumed.\n    succeed (\\str -> str)\n        |> drop (char '<')\n        |> take (textOf (letter |> while (\\_ value -> value /= '>')))\n        |> drop (char '>')\n        |> parse \"<abc>\"\n    --> Ok \"abc\"\n\n","type":"(List.List a -> a -> Basics.Bool) -> Parser.Parser a -> Parser.Parser (List.List a)"},{"name":"zeroOrMore","comment":" Parses zero or more values and returns them as a `List`.\n\n> ℹ️ Equivalent regular expression: `*`\n\n    -- We want as many letters as there are.\n    parse \"abc\" (zeroOrMore letter) --> Ok [ 'a', 'b', 'c' ]\n\n    -- Even zero letters is okay.\n    parse \"_abc\" (zeroOrMore letter) --> Ok []\n\n","type":"Parser.Parser a -> Parser.Parser (List.List a)"},{"name":"zeroOrOne","comment":" Parses an optional value and returns it as a `List`.\n\n> ℹ️ Equivalent regular expression: `?`\n\n    -- We want one letter, optionally.\n    parse \"abc\" (zeroOrOne letter) --> Ok [ 'a' ]\n\n    -- If we don't get any, that's still okay.\n    parse \"_abc\" (zeroOrOne letter) --> Ok []\n\n","type":"Parser.Parser a -> Parser.Parser (List.List a)"}],"binops":[]},{"name":"Parser.Common","comment":" Common and other useful parsers.\n\n\n# Common\n\n@docs int, number\n\n","unions":[],"aliases":[],"values":[{"name":"int","comment":" Gets an integer value as an `Int`.\n\n    import Parser exposing (parse)\n    import Parser.Error\n\n    -- You can parse integers as `Int` instead of `String`.\n    parse \"123\" int --> Ok 123\n\n    -- It also works with negative numbers.\n    parse \"-123\" int --> Ok -123\n\n    -- But not with invalid numbers.\n    parse \"abc\" int\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a digit [0-9].\\nI got stuck when I got the character 'a'.\"\n\n","type":"Parser.Parser Basics.Int"},{"name":"number","comment":" Gets a decimal value as a `Float`.\n\n    import Parser exposing (parse)\n    import Parser.Error\n\n    -- You can parse numbers as `Float` instead of `String`.\n    parse \"12\" number --> Ok 12.0\n    parse \"12.\" number --> Ok 12.0\n    parse \"12.34\" number --> Ok 12.34\n    parse \".12\" number --> Ok 0.12\n\n    -- It also works with negative numbers.\n    parse \"-12.34\" number --> Ok -12.34\n    parse \"-.12\" number --> Ok -0.12\n\n    -- But not with invalid numbers.\n    parse \".\" number\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a digit [0-9].\\nI got stuck when I got the character '.'.\"\n\n    parse \"abc\" number\n        |> Result.mapError Parser.Error.message\n    --> Err \"1:1: I was expecting a digit [0-9].\\nI got stuck when I got the character 'a'.\"\n\n","type":"Parser.Parser Basics.Float"}],"binops":[]},{"name":"Parser.Error","comment":" Error reporting utilities.\n\n\n# Error reporting\n\n@docs message, dump, dumpCodeSnippet\n\n","unions":[],"aliases":[],"values":[{"name":"dump","comment":" Dumps the error into a human-readable format.\n\n    import Parser exposing (Parser, andThen, char, drop, into, parse, spaces, succeed, take)\n    import Parser.Common exposing (number)\n\n    spaces\n        |> andThen (\\_ -> number)\n        |> parse \"  abc  \"\n        |> Result.mapError (dump \"filename.txt\")\n    --> Err\n    -->     [ \"[ERROR] filename.txt:1:3: I was expecting a digit [0-9].\\n\"\n    -->         ++ \"I got stuck when I got the character 'a'.\"\n    -->     , \"\"\n    -->     , \"1|  abc  \"\n    -->     , \"    ^\"\n    -->     ]\n\n\n    type alias Point =\n        { x : Float\n        , y : Float\n        }\n\n    point : Parser Point\n    point =\n        into \"Point\"\n            (succeed Point\n                |> drop (char '(')\n                |> take number\n                |> drop (char ',')\n                |> take number\n                |> drop (char ')')\n            )\n\n    spaces\n        |> andThen (\\_ -> point)\n        |> parse \"  (12,)  \"\n        |> Result.mapError (dump \"filename.txt\")\n    --> Err\n    -->     [ \"[ERROR] filename.txt:1:7: I was expecting a digit [0-9].\\n\"\n    -->         ++ \"I got stuck when I got the character ')'.\"\n    -->     , \"  in Point at line 1:3\"\n    -->     , \"\"\n    -->     , \"1|  (12,)  \"\n    -->     , \"    ~~~~^\"\n    -->     ]\n\n    type alias Line =\n        { p1 : Point\n        , p2 : Point\n        }\n\n    line : Parser Line\n    line =\n        into \"Line\"\n            (succeed Line\n                |> drop (char '[')\n                |> take point\n                |> drop (char ',')\n                |> take point\n                |> drop (char ']')\n            )\n\n    spaces\n        |> andThen (\\_ -> line)\n        |> parse \"  [(12,34),(56,)]  \"\n        |> Result.mapError (dump \"filename.txt\")\n    --> Err\n    -->     [ \"[ERROR] filename.txt:1:16: I was expecting a digit [0-9].\\n\"\n    -->         ++ \"I got stuck when I got the character ')'.\"\n    -->     , \"  in Point at line 1:12\"\n    -->     , \"  in Line at line 1:3\"\n    -->     , \"\"\n    -->     , \"1|  [(12,34),(56,)]  \"\n    -->     , \"             ~~~~^\"\n    -->     ]\n\n","type":"String.String -> Parser.Error -> List.List String.String"},{"name":"dumpCodeSnippet","comment":" Dumps a snippet of the input text that caused the parser to fail.\n\n    import Parser exposing (Parser, andThen, char, drop, into, parse, spaces, succeed, take)\n    import Parser.Common exposing (number)\n\n    type alias Point =\n        { x : Float\n        , y : Float\n        }\n\n    point : Parser Point\n    point =\n        into \"Point\"\n            (succeed Point\n                |> drop (char '(')\n                |> drop spaces\n                |> take number\n                |> drop spaces\n                |> drop (char ',')\n                |> drop spaces\n                |> take number\n                |> drop spaces\n                |> drop (char ')')\n            )\n\n    spaces\n        |> andThen (\\_ -> point)\n        |> parse \"  (12,)  \"\n        |> Result.mapError dumpCodeSnippet\n    --> Err\n    -->     [ \"1|  (12,)  \"\n    -->     , \"    ~~~~^\"\n    -->     ]\n\n    spaces\n        |> andThen (\\_ -> point)\n        |> parse\n            (String.join \"\\n\"\n                [ \"  \"\n                , \"  (  \"\n                , \"  12  \"\n                , \"  ,  \"\n                , \"  )  \"\n                , \"  \"\n                ]\n            )\n        |> Result.mapError dumpCodeSnippet\n    --> Err\n    -->     [ \"2|  (  \"\n    -->     , \"3|  12  \"\n    -->     , \"4|  ,  \"\n    -->     , \"5|  )  \"\n    -->     , \" +~~^\"\n    -->     ]\n\n","type":"Parser.Error -> List.List String.String"},{"name":"message","comment":" Creates an error message from an `Error` data.\n\n    import Parser exposing (letter, parse)\n\n    -- Getting a digit instead of a letter.\n    parse \"123\" letter\n        |> Result.mapError message\n    --> Err \"1:1: I was expecting a letter [a-zA-Z].\\nI got stuck when I got the character '1'.\"\n\n    -- Running out of input characters.\n    parse \"\" letter\n        |> Result.mapError message\n    --> Err \"1:0: I was expecting a letter [a-zA-Z].\\nI reached the end of the input text.\"\n\n","type":"Parser.Error -> String.String"}],"binops":[]}]