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

Safe HaskellNone

Puppet.Parser.Types

Contents

Description

All the types used for parsing, and helpers working on these types.

Synopsis

Position management

type Position = SourcePos

Position in a puppet file. Currently an alias to SourcePos.

type PPosition = Pair Position Position

A pair containing the start and end of a given token.

initialPPos :: Text -> PPosition

Generates an initial position based on a filename.

toPPos :: Text -> Int -> PPosition

Generates a PPosition based on a filename and line number.

Lenses

Helpers

capitalizeRT :: Text -> Text

Properly capitalizes resource types

array :: [Expression] -> UValue

A helper function for writing arrays.

toBool :: UValue -> Bool

Tries to turn an unresolved value into a Bool without any context.

Types

Expressions

data UValue

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 UValue)

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 !Text !Regex

The regular expression compilation is performed during parsing.

UVariableReference !Text 
UFunctionCall !Text !(Vector Expression) 
UHFunctionCall !HFunctionCall 

Instances

data HigherFuncType

The distinct Puppet higher order functions

data BlockParameters

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

Constructors

BPSingle !Text
|k|
BPPair !Text !Text
|k,v|

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 included in the catalog

Search Expressions

Statements

data Statement

All the possible statements