| Copyright | (c) Copyright Pedro Tacla Yamada 2016 |
|---|---|
| License | MIT |
| Maintainer | [email protected] |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.HCL
Description
This modules contains the hcl Megaparsec parser for hcl files.
The pretty-printer is at Data.HCL.PrettyPrint.
- parseHCL :: String -> Text -> Either (ParseError Char Dec) HCLDoc
- hcl :: Parser HCLDoc
- runParser :: Parsec e s a -> String -> s -> Either (ParseError (Token s) e) a
- pPrintHCL :: HCLDoc -> Doc
- type HCLDoc = [HCLStatement]
- data HCLStatement
- data HCLValue
- type HCLList = [HCLValue]
- data HCLStringPart
- class Pretty a where
- topValue :: Parser HCLStatement
- bplain :: Text -> HCLValue
- binterp :: Text -> HCLValue
- string :: Parser Text
- stringParts :: Parser [HCLStringPart]
- stringPart :: Parser HCLStringPart
- stringPlain :: Parser Text
- stringPlainMultiline :: Parser Text
- stringInterp :: Parser Text
- assignment :: Parser ([Text], HCLValue)
- object :: Parser HCLValue
- value :: Parser HCLValue
- ident :: Parser Text
- keys :: Parser [Text]
- key :: Parser Text
- list :: Parser HCLList
- number :: Parser HCLValue
Entry-points
parseHCL :: String -> Text -> Either (ParseError Char Dec) HCLDoc Source #
Shortcut for runParser hcl
Arguments
| :: Parsec e s a | Parser to run |
| -> String | Name of source file |
| -> s | Input for parser |
| -> Either (ParseError (Token s) e) a |
runParser p file input runs parser p on the input list of tokens
input, obtained from source file. The file is only used in error
messages and may be the empty string. Returns either a ParseError
(Left) or a value of type a (Right).
parseFromFile p file = runParser p file <$> readFile file
Types
type HCLDoc = [HCLStatement] Source #
The HCL document is just a list of statements
data HCLStatement Source #
Statements may be "objects", of form:
provider "aws" {
# more
}
Or they may be assignments:
a = "b"
Constructors
| HCLStatementObject HCLValue | |
| HCLStatementAssignment ([Text], HCLValue) |
Instances
Pretty-printer
Pretty printing class. The precedence level is used in a similar way as in
the Show class. Minimal complete definition is either pPrintPrec or
pPrint.
Minimal complete definition
Instances
| Pretty Bool | |
| Pretty Char | |
| Pretty Double | |
| Pretty Float | |
| Pretty Int | |
| Pretty Integer | |
| Pretty Ordering | |
| Pretty () | |
| Pretty a => Pretty [a] | |
| Pretty a => Pretty (Maybe a) | |
| (Pretty a, Pretty b) => Pretty (Either a b) | |
| (Pretty a, Pretty b) => Pretty (a, b) | |
| (Pretty a, Pretty b, Pretty c) => Pretty (a, b, c) | |
| (Pretty a, Pretty b, Pretty c, Pretty d) => Pretty (a, b, c, d) | |
| (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e) => Pretty (a, b, c, d, e) | |
| (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f) => Pretty (a, b, c, d, e, f) | |
| (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g) => Pretty (a, b, c, d, e, f, g) | |
| (Pretty a, Pretty b, Pretty c, Pretty d, Pretty e, Pretty f, Pretty g, Pretty h) => Pretty (a, b, c, d, e, f, g, h) | |
Support functions
stringPlain :: Parser Text Source #