language-puppet-1.3.19: Tools to parse and evaluate the Puppet DSL.

Safe HaskellNone
LanguageHaskell98

Puppet.Parser

Contents

Description

Parse puppet source code from text.

Synopsis

Runner

runPuppetParser :: String -> Text -> Either PuppetParseError (Vector Statement) #

Run a puppet parser against some Text input.

Parsers

puppetParser :: Parser (Vector Statement) #

Parse a collection of puppet Statement.

prettyParseError :: Text -> ParseError Char Void -> PrettyError #

Build a PrettyError from a ParseError given the text source. The source is used to display the line on which the error occurs.

exposed to ease testing

Pretty Print

ppStatements :: Vector Statement -> Doc #

Pretty print a series of statements.

Expressions

data Expression #

data UnresolvedValue #

An unresolved value, typically the parser's output.

Constructors

UBoolean !Bool

Special tokens generated when parsing the true or false literals.

UString !Text

Raw string.

UInterpolable !(Vector Expression)

A string that might contain variable references. The type should be refined at one point.

UUndef

Special token that is generated when parsing the undef literal.

UResourceReference !Text !Expression

A Resource[reference]

UArray !(Vector Expression) 
UHash !(Vector (Pair Expression Expression)) 
URegexp !CompRegex

The regular expression compilation is performed during parsing.

UVariableReference !Text 
UFunctionCall !Text !(Vector Expression) 
UHOLambdaCall !HOLambdaCall 
UNumber !Scientific 
UDataType UDataType 

data LambdaParameters #

Lambda block parameters:

Currently only two types of block parameters are supported: single values and pairs.

data Virtuality #

Constructors

Normal

Normal resource, that will be included in the catalog.

Virtual

Type for virtual resources.

Exported

Type for exported resources.

ExportedRealized

These are resources that are exported AND realized in the catalog.

data LinkType #

Relationship/ordering between resources.

Constructors

RRequire

Applies a resource after the target resource.

RBefore

Applies a resource before the target resource.

RNotify

Applies a resource before the target resource. The target resource refreshes if the notifying resource changes.

RSubscribe

Applies a resource after the target resource. The subscribing resource refreshes if the target resource changes.

Instances

Eq LinkType # 
Show LinkType # 
Generic LinkType # 

Associated Types

type Rep LinkType :: * -> * #

Methods

from :: LinkType -> Rep LinkType x #

to :: Rep LinkType x -> LinkType #

Hashable LinkType # 

Methods

hashWithSalt :: Int -> LinkType -> Int #

hash :: LinkType -> Int #

ToJSON LinkType # 
FromJSON LinkType # 
Pretty LinkType # 

Methods

pretty :: LinkType -> Doc #

prettyList :: [LinkType] -> Doc #

type Rep LinkType # 
type Rep LinkType = D1 * (MetaData "LinkType" "Puppet.Language.Resource" "language-puppet-1.3.19-E5GvKpRNireIAt8kFBmKBu" False) ((:+:) * ((:+:) * (C1 * (MetaCons "RRequire" PrefixI False) (U1 *)) (C1 * (MetaCons "RBefore" PrefixI False) (U1 *))) ((:+:) * (C1 * (MetaCons "RNotify" PrefixI False) (U1 *)) (C1 * (MetaCons "RSubscribe" PrefixI False) (U1 *))))

Datatypes

Search Expressions

Declaration

data ArrowOp #

Constructors

AppendArrow

+>

AssignArrow

`=>`

Instances

data ConditionalDecl #

All types of conditional statements : case, if, ...

Stored as an ordered list of pair (condition, statements) . Interpreted as "if first cond is true, choose first statements, else take the next pair, check the condition ..."

data ResDecl #

Resource declaration:

 file { mode => 755}

Instances

data NodeDecl #

A node is a collection of statements + maybe an inherit node.

data ResCollDecl #

Resource Collector including exported collector (`<<| |>>`)

 User <| title == jenkins |> { groups +> "docker"}

See puppet reference

Prism for Statements

Prism for Expressions