Safe Haskell | None |
---|---|
Language | Haskell98 |
This module contains Dhall's parsing logic
- exprFromText :: Delta -> Text -> Either ParseError (Expr Src Path)
- exprAndHeaderFromText :: Delta -> Text -> Either ParseError (Text, Expr Src Path)
- expr :: Parser (Expr Src Path)
- exprA :: Parser a -> Parser (Expr Src a)
- data Src = Src Delta Delta ByteString
- newtype ParseError = ParseError Doc
- newtype Parser a = Parser {}
Utilities
exprFromText :: Delta -> Text -> Either ParseError (Expr Src Path) Source #
Parse an expression from Text
containing a Dhall program
exprAndHeaderFromText :: Delta -> Text -> Either ParseError (Text, Expr Src Path) Source #
Like exprFromText
but also returns the leading comments and whitespace
(i.e. header) up to the last newline before the code begins
In other words, if you have a Dhall file of the form:
-- Comment 1 2
Then this will preserve Comment 1
, but not Comment 2
This is used by dhall-format
to preserve leading comments and whitespace
Parsers
exprA :: Parser a -> Parser (Expr Src a) Source #
Parser for a top-level Dhall expression. The expression is parameterized over any parseable type, allowing the language to be extended as needed.
Types
Source code extract
newtype ParseError Source #
A parsing error
A Parser
that is almost identical to
Text.Trifecta.
except treating Haskell-style
comments as whitespaceParser