Dhall.Parser.Token

dhall-1.42.2: A configuration language guaranteed to terminate

Safe Haskell | None
Language | Haskell2010

Dhall.Parser.Token

Description

Parse Dhall tokens. Even though we don't have a tokenizer per-se this

Synopsis

- endOfLine :: Parser Text
- validCodepoint :: Int -> Bool
- whitespace :: Parser ()
- lineComment :: Parser Text
- lineCommentPrefix :: Parser Text
- blockComment :: Parser Text
- nonemptyWhitespace :: Parser ()
- bashEnvironmentVariable :: Parser Text
- posixEnvironmentVariable :: Parser Text
- data ComponentType
  - = URLComponent
  - | FileComponent
- text :: Text -> Parser Text
- char :: Char -> Parser Char
- file_ :: ComponentType -> Parser File
- label :: Parser Text
- anyLabelOrSome :: Parser Text
- anyLabel :: Parser Text
- labels :: Parser [Text]
- httpRaw :: Parser URL
- hexdig :: Char -> Bool
- identifier :: Parser Var
- hexNumber :: Parser Int
- signPrefix :: Num a => Parser (a -> a)
- doubleLiteral :: Parser Double
- doubleInfinity :: Parser Double
- naturalLiteral :: Parser Natural
- integerLiteral :: Parser Integer
- dateFullYear :: Parser Integer
- dateMonth :: Parser Int
- dateMday :: Parser Int
- timeHour :: Parser Int
- timeMinute :: Parser Int
- timeSecond :: Parser Pico
- timeSecFrac :: Parser (Pico, Word)
- _Optional :: Parser ()
- _if :: Parser ()
- _then :: Parser ()
- _else :: Parser ()
- _let :: Parser ()
- _in :: Parser ()
- _as :: Parser ()
- _using :: Parser ()
- _merge :: Parser ()
- _toMap :: Parser ()
- _showConstructor :: Parser ()
- _assert :: Parser ()
- _Some :: Parser ()
- _None :: Parser ()
- _NaturalFold :: Parser ()
- _NaturalBuild :: Parser ()
- _NaturalIsZero :: Parser ()
- _NaturalEven :: Parser ()
- _NaturalOdd :: Parser ()
- _NaturalToInteger :: Parser ()
- _NaturalShow :: Parser ()
- _NaturalSubtract :: Parser ()
- _IntegerClamp :: Parser ()
- _IntegerNegate :: Parser ()
- _IntegerShow :: Parser ()
- _IntegerToDouble :: Parser ()
- _DoubleShow :: Parser ()
- _ListBuild :: Parser ()
- _ListFold :: Parser ()
- _ListLength :: Parser ()
- _ListHead :: Parser ()
- _ListLast :: Parser ()
- _ListIndexed :: Parser ()
- _ListReverse :: Parser ()
- _Bool :: Parser ()
- _Bytes :: Parser ()
- _Natural :: Parser ()
- _Integer :: Parser ()
- _Double :: Parser ()
- _Text :: Parser ()
- _TextReplace :: Parser ()
- _TextShow :: Parser ()
- _Date :: Parser ()
- _DateShow :: Parser ()
- _Time :: Parser ()
- _TimeShow :: Parser ()
- _TimeZone :: Parser ()
- _TimeZoneShow :: Parser ()
- _List :: Parser ()
- _True :: Parser ()
- _False :: Parser ()
- _NaN :: Parser ()
- _Type :: Parser ()
- _Kind :: Parser ()
- _Sort :: Parser ()
- _Location :: Parser ()
- _equal :: Parser ()
- _or :: Parser ()
- _plus :: Parser ()
- _textAppend :: Parser ()
- _listAppend :: Parser ()
- _and :: Parser ()
- _times :: Parser ()
- _doubleEqual :: Parser ()
- _notEqual :: Parser ()
- _dot :: Parser ()
- _openBrace :: Parser ()
- _closeBrace :: Parser ()
- _openBracket :: Parser ()
- _closeBracket :: Parser ()
- _openAngle :: Parser ()
- _closeAngle :: Parser ()
- _bar :: Parser ()
- _comma :: Parser ()
- _openParens :: Parser ()
- _closeParens :: Parser ()
- _colon :: Parser ()
- _at :: Parser ()
- _equivalent :: Parser CharacterSet
- _missing :: Parser ()
- _importAlt :: Parser ()
- _combine :: Parser CharacterSet
- _combineTypes :: Parser CharacterSet
- _prefer :: Parser CharacterSet
- _lambda :: Parser CharacterSet
- _forall :: Parser CharacterSet
- _arrow :: Parser CharacterSet
- _doubleColon :: Parser ()
- _with :: Parser ()

# Documentation

endOfLine :: Parser Text #

Match an end-of-line character sequence

validCodepoint :: Int -> Bool #

Returns `True` if the given `Int` is a valid Unicode codepoint

whitespace :: Parser () #

Parse 0 or more whitespace characters (including comments)

This corresponds to the `whsp` rule in the official grammar

lineComment :: Parser Text #

Parse a Dhall's single-line comment, starting from `--` and until the last character of the line before the end-of-line character

lineCommentPrefix :: Parser Text #

Same as `lineComment` except that this doesn't parse the end-of-line character

blockComment :: Parser Text #

Parsed text doesn't include opening braces

nonemptyWhitespace :: Parser () #

Parse 1 or more whitespace characters (including comments)

This corresponds to the `whsp1` rule in the official grammar

bashEnvironmentVariable :: Parser Text #

Parse a valid Bash environment variable name

This corresponds to the `bash-environment-variable` rule in the official grammar

posixEnvironmentVariable :: Parser Text #

Parse a valid POSIX environment variable name, which permits a wider range of characters than a Bash environment variable name

This corresponds to the `posix-environment-variable` rule in the official grammar

data ComponentType #

The `pathComponent` function uses this type to distinguish whether to parse a URL path component or a file path component

Constructors

URLComponent |
FileComponent |

text :: Text -> Parser Text #

A variation on `text` that doesn't quote the expected in error messages

char :: Char -> Parser Char #

A variation on `char` that doesn't quote the expected token in error messages

file_ :: ComponentType -> Parser File #

Parse a `File`

label :: Parser Text #

Parse a label (e.g. a variable/field/alternative name)

Rejects labels that match built-in names (e.g. `Natural/even`)

This corresponds to the `nonreserved-label` rule in the official grammar

anyLabelOrSome :: Parser Text #

Same as `anyLabel` except that `Some` is allowed

This corresponds to the `any-label-or-some` rule in the official grammar

anyLabel :: Parser Text #

Same as `label` except that built-in names are allowed

This corresponds to the `any-label` rule in the official grammar

labels :: Parser [Text] #

Parse a braced sequence of comma-separated labels

For example, this is used to parse the record projection syntax

This corresponds to the `labels` rule in the official grammar

httpRaw :: Parser URL #

Parse an HTTP(S) URL without trailing whitespace

This corresponds to the `http-raw` rule in the official grammar

hexdig :: Char -> Bool #

Parse a hex digit (uppercase or lowercase)

This corresponds to the `HEXDIG` rule in the official grammar

identifier :: Parser Var #

Parse an identifier (i.e. a variable or built-in)

Variables can have an optional index to disambiguate shadowed variables

This corresponds to the `identifier` rule from the official grammar

hexNumber :: Parser Int #

Parse a hexademical number and convert to the corresponding `Int`

signPrefix :: Num a => Parser (a -> a) #

Parse a leading `+` or `-` sign

doubleLiteral :: Parser Double #

Parse a `Double` literal

This corresponds to the `double-literal` rule from the official grammar

doubleInfinity :: Parser Double #

Parse a signed `Infinity`

This corresponds to the `minus-infinity-literal` and `plus-infinity-literal` rules from the official grammar

naturalLiteral :: Parser Natural #

Parse a `Natural` literal

This corresponds to the `natural-literal` rule from the official grammar

integerLiteral :: Parser Integer #

Parse an `Integer` literal

This corresponds to the `integer-literal` rule from the official grammar

dateFullYear :: Parser Integer #

Parse a 4-digit year

This corresponds to the `date-fullyear` rule from the official grammar

dateMonth :: Parser Int #

Parse a 2-digit month

This corresponds to the `date-month` rule from the official grammar

dateMday :: Parser Int #

Parse a 2-digit day of the month

This corresponds to the `date-mday` rule from the official grammar

timeHour :: Parser Int #

Parse a 2-digit hour

This corresponds to the `time-hour` rule from the official grammar

timeMinute :: Parser Int #

Parse a 2-digit minute

This corresponds to the `time-minute` rule from the official grammar

timeSecond :: Parser Pico #

Parse a 2-digit second

This corresponds to the `time-second` rule from the official grammar

timeSecFrac :: Parser (Pico, Word) #

Parse the fractional component of a second

This corresponds to the `time-secfrac` rule from the official grammar

_Optional :: Parser () #

Parse the `Optional` built-in

This corresponds to the `Optional` rule from the official grammar

_if :: Parser () #

Parse the `if` keyword

This corresponds to the `if` rule from the official grammar

_then :: Parser () #

Parse the `then` keyword

This corresponds to the `then` rule from the official grammar

_else :: Parser () #

Parse the `else` keyword

This corresponds to the `else` rule from the official grammar

_let :: Parser () #

Parse the `let` keyword

This corresponds to the `let` rule from the official grammar

_in :: Parser () #

Parse the `in` keyword

This corresponds to the `in` rule from the official grammar

_as :: Parser () #

Parse the `as` keyword

This corresponds to the `as` rule from the official grammar

_using :: Parser () #

Parse the `using` keyword

This corresponds to the `using` rule from the official grammar

_merge :: Parser () #

Parse the `merge` keyword

This corresponds to the `merge` rule from the official grammar

_toMap :: Parser () #

Parse the `toMap` keyword

This corresponds to the `toMap` rule from the official grammar

_showConstructor :: Parser () #

Parse the `showConstructor` keyword

This corresponds to the `showConstructor` rule from the official grammar

_assert :: Parser () #

Parse the `assert` keyword

This corresponds to the `assert` rule from the official grammar

_Some :: Parser () #

Parse the `Some` built-in

This corresponds to the `Some` rule from the official grammar

_None :: Parser () #

Parse the `None` built-in

This corresponds to the `None` rule from the official grammar

_NaturalFold :: Parser () #

Parse the `Natural/fold` built-in

This corresponds to the `Natural-fold` rule from the official grammar

_NaturalBuild :: Parser () #

Parse the `Natural/build` built-in

This corresponds to the `Natural-build` rule from the official grammar

_NaturalIsZero :: Parser () #

Parse the `Natural/isZero` built-in

This corresponds to the `Natural-isZero` rule from the official grammar

_NaturalEven :: Parser () #

Parse the `Natural/even` built-in

This corresponds to the `Natural-even` rule from the official grammar

_NaturalOdd :: Parser () #

Parse the `Natural/odd` built-in

This corresponds to the `Natural-odd` rule from the official grammar

_NaturalToInteger :: Parser () #

Parse the `Natural/toInteger` built-in

This corresponds to the `Natural-toInteger` rule from the official grammar

_NaturalShow :: Parser () #

Parse the `Natural/show` built-in

This corresponds to the `Natural-show` rule from the official grammar

_NaturalSubtract :: Parser () #

Parse the `Natural/subtract` built-in

This corresponds to the `Natural-subtract` rule from the official grammar

_IntegerClamp :: Parser () #

Parse the `Integer/clamp` built-in

This corresponds to the `Integer-clamp` rule from the official grammar

_IntegerNegate :: Parser () #

Parse the `Integer/negate` built-in

This corresponds to the `Integer-negate` rule from the official grammar

_IntegerShow :: Parser () #

Parse the `Integer/show` built-in

This corresponds to the `Integer-show` rule from the official grammar

_IntegerToDouble :: Parser () #

Parse the `Integer/toDouble` built-in

This corresponds to the `Integer-toDouble` rule from the official grammar

_DoubleShow :: Parser () #

Parse the `Double/show` built-in

This corresponds to the `Double-show` rule from the official grammar

_ListBuild :: Parser () #

Parse the `List/build` built-in

This corresponds to the `List-build` rule from the official grammar

_ListFold :: Parser () #

Parse the `List/fold` built-in

This corresponds to the `List-fold` rule from the official grammar

_ListLength :: Parser () #

Parse the `List/length` built-in

This corresponds to the `List-length` rule from the official grammar

_ListHead :: Parser () #

Parse the `List/head` built-in

This corresponds to the `List-head` rule from the official grammar

_ListLast :: Parser () #

Parse the `List/last` built-in

This corresponds to the `List-last` rule from the official grammar

_ListIndexed :: Parser () #

Parse the `List/indexed` built-in

This corresponds to the `List-indexed` rule from the official grammar

_ListReverse :: Parser () #

Parse the `List/reverse` built-in

This corresponds to the `List-reverse` rule from the official grammar

_Bool :: Parser () #

Parse the `Bool` built-in

This corresponds to the `Bool` rule from the official grammar

_Bytes :: Parser () #

Parse the `Bytes` built-in

This corresponds to the `Bytes` rule from the official grammar

_Natural :: Parser () #

Parse the `Natural` built-in

This corresponds to the `Natural` rule from the official grammar

_Integer :: Parser () #

Parse the `Integer` built-in

This corresponds to the `Integer` rule from the official grammar

_Double :: Parser () #

Parse the `Double` built-in

This corresponds to the `Double` rule from the official grammar

_Text :: Parser () #

Parse the `Text` built-in

This corresponds to the `Text` rule from the official grammar

_TextReplace :: Parser () #

Parse the `Text/replace` built-in

This corresponds to the `Text-replace` rule from the official grammar

_TextShow :: Parser () #

Parse the `Text/show` built-in

This corresponds to the `Text-show` rule from the official grammar

_Date :: Parser () #

Parse the `Date` bult-in

This corresponds to the `Date` rule from the official grammar

_DateShow :: Parser () #

Parse the `Date/show` built-in

This corresponds to the `Date-show` rule from the official grammar

_Time :: Parser () #

Parse the `Time` bult-in

This corresponds to the `Time` rule from the official grammar

_TimeShow :: Parser () #

Parse the `Time/show` built-in

This corresponds to the `Time-show` rule from the official grammar

_TimeZone :: Parser () #

Parse the `TimeZone` bult-in

This corresponds to the `TimeZone` rule from the official grammar

_TimeZoneShow :: Parser () #

Parse the `TimeZone/show` built-in

This corresponds to the `TimeZone-show` rule from the official grammar

_List :: Parser () #

Parse the `List` built-in

This corresponds to the `List` rule from the official grammar

_True :: Parser () #

Parse the `True` built-in

This corresponds to the `True` rule from the official grammar

_False :: Parser () #

Parse the `False` built-in

This corresponds to the `False` rule from the official grammar

_NaN :: Parser () #

Parse a `NaN` literal

This corresponds to the `NaN` rule from the official grammar

_Type :: Parser () #

Parse the `Type` built-in

This corresponds to the `Type` rule from the official grammar

_Kind :: Parser () #

Parse the `Kind` built-in

This corresponds to the `Kind` rule from the official grammar

_Sort :: Parser () #

Parse the `Sort` built-in

This corresponds to the `Sort` rule from the official grammar

_Location :: Parser () #

Parse the `Location` keyword

This corresponds to the `Location` rule from the official grammar

_equal :: Parser () #

Parse the `=` symbol

_or :: Parser () #

Parse the `||` symbol

_plus :: Parser () #

Parse the `+` symbol

_textAppend :: Parser () #

Parse the `++` symbol

_listAppend :: Parser () #

Parse the `#` symbol

_and :: Parser () #

Parse the `&&` symbol

_times :: Parser () #

Parse the `*` symbol

_doubleEqual :: Parser () #

Parse the `==` symbol

_notEqual :: Parser () #

Parse the `!=` symbol

_dot :: Parser () #

Parse the `.` symbol

_openBrace :: Parser () #

Parse the `{` symbol

_closeBrace :: Parser () #

Parse the `}` symbol

_openBracket :: Parser () #

Parse the `[`] symbol

_closeBracket :: Parser () #

Parse the `]` symbol

_openAngle :: Parser () #

Parse the `<` symbol

_closeAngle :: Parser () #

Parse the `>` symbol

_bar :: Parser () #

Parse the `|` symbol

_comma :: Parser () #

Parse the `,` symbol

_openParens :: Parser () #

Parse the `(` symbol

_closeParens :: Parser () #

Parse the `)` symbol

_colon :: Parser () #

Parse the `:` symbol

_at :: Parser () #

Parse the `@` symbol

_equivalent :: Parser CharacterSet #

Parse the equivalence symbol (`===` or `≡`)

_missing :: Parser () #

Parse the `missing` keyword

_importAlt :: Parser () #

Parse the `?` symbol

_combine :: Parser CharacterSet #

Parse the record combine operator (`/\` or `∧`)

_combineTypes :: Parser CharacterSet #

Parse the record type combine operator (`//\\` or `⩓`)

_prefer :: Parser CharacterSet #

Parse the record "prefer" operator (`//` or `⫽`)

_lambda :: Parser CharacterSet #

Parse a lambda (`\` or `λ`)

_forall :: Parser CharacterSet #

Parse a forall (`forall` or `∀`)

_arrow :: Parser CharacterSet #

Parse a right arrow (`->` or `→`)

_doubleColon :: Parser () #

Parse a double colon (`::`)

_with :: Parser () #

Parse the `with` keyword