dhall-1.42.1: A configuration language guaranteed to terminate

Safe Haskell | None
Language | Haskell2010

Dhall.Parser.Expression

Description

Parsing Dhall expressions.

Synopsis

- getOffset :: MonadParsec e s m => m Int
- setOffset :: MonadParsec e s m => Int -> m ()
- src :: Parser a -> Parser Src
- srcAnd :: Parser a -> Parser (Src, a)
- noted :: Parser (Expr Src a) -> Parser (Expr Src a)
- completeExpression :: Parser a -> Parser (Expr Src a)
- importExpression :: Parser a -> Parser (Expr Src a)
- data Parsers a = Parsers {
  - completeExpression_ :: Parser (Expr Src a)
  - importExpression_ :: Parser (Expr Src a)
  - letBinding :: Parser (Binding Src a)
  }
- timeNumOffset :: Parser (Expr s a)
- timeOffset :: Parser (Expr s a)
- partialTime :: Parser (Expr s a)
- fullDate :: Parser (Expr s a)
- temporalLiteral :: Parser (Expr s a)
- shebang :: Parser ()
- parsers :: Parser a -> Parsers a
- env :: Parser ImportType
- localOnly :: Parser ImportType
- local :: Parser ImportType
- http :: Parser ImportType
- missing :: Parser ImportType
- importType_ :: Parser ImportType
- importHash_ :: Parser SHA256Digest
- importHashed_ :: Parser ImportHashed
- import_ :: Parser Import
- data ApplicationExprInfo
  - = NakedMergeOrSomeOrToMap
  - | ImportExpr
  - | ApplicationExpr

# Documentation

getOffset :: MonadParsec e s m => m Int #

Get the current source offset (in tokens)

setOffset :: MonadParsec e s m => Int -> m () #

Set the current source offset

src :: Parser a -> Parser Src #

Wrap a `Parser` to still match the same text but return only the `Src` span

srcAnd :: Parser a -> Parser (Src, a) #

Same as `src`, except also return the parsed value

noted :: Parser (Expr Src a) -> Parser (Expr Src a) #

Wrap a `Parser` to still match the same text, but to wrap the resulting `Expr` in a `Note` constructor containing the `Src` span

completeExpression :: Parser a -> Parser (Expr Src a) #

Parse a complete expression (with leading and trailing whitespace)

This corresponds to the `complete-expression` rule from the official grammar

importExpression :: Parser a -> Parser (Expr Src a) #

Parse an "import expression"

This is not the same thing as ``fmap` `Embed``. This parses any expression of the same or higher precedence as an import expression (such as a selector expression). For example, this parses `(1)`

This corresponds to the `import-expression` rule from the official grammar

data Parsers a #

For efficiency (and simplicity) we only expose two parsers from the result of the `parsers` function, since these are the only parsers needed outside of this module

Constructors

Parsers |

Fields

- completeExpression_ :: Parser (Expr Src a)
- importExpression_ :: Parser (Expr Src a)
- letBinding :: Parser (Binding Src a)

timeNumOffset :: Parser (Expr s a) #

Parse a numeric `TimeZone`

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

timeOffset :: Parser (Expr s a) #

Parse a numeric `TimeZone` or a `Z`

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

partialTime :: Parser (Expr s a) #

Parse a `Time`

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

fullDate :: Parser (Expr s a) #

Parse a `Date`

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

temporalLiteral :: Parser (Expr s a) #

Parse a `Date`, `Time`, `TimeZone` or any valid permutation of them as a record

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

shebang :: Parser () #

Parse a "shebang" line (i.e. an initial line beginning with `#!`)

parsers :: Parser a -> Parsers a #

Given a parser for imports,

env :: Parser ImportType #

Parse an environment variable import

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

localOnly :: Parser ImportType #

Parse a local import without trailing whitespace

local :: Parser ImportType #

Parse a local import

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

http :: Parser ImportType #

Parse an HTTP(S) import

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

missing :: Parser ImportType #

Parse a `Missing` import

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

importType_ :: Parser ImportType #

Parse an `ImportType`

This corresponds to the `import-type` rule from the official grammar

importHash_ :: Parser SHA256Digest #

Parse a `SHA256Digest`

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

importHashed_ :: Parser ImportHashed #

Parse an `ImportHashed`

This corresponds to the `import-hashed` rule from the official grammar

import_ :: Parser Import #

Parse an `Import`

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

data ApplicationExprInfo #

`ApplicationExprInfo` distinguishes certain subtypes of application expressions.

Constructors

NakedMergeOrSomeOrToMap | `merge x y`, `Some x` or `toMap x`, unparenthesized.
ImportExpr | An import expression.
ApplicationExpr | Any other application expression.