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

Safe HaskellNone
LanguageHaskell98

Puppet.Parser.Types

Contents

Description

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

Synopsis

Position management

type Position = SourcePos Source

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

type PPosition = Pair Position Position Source

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

initialPPos :: Text -> PPosition Source

Generates an initial position based on a filename.

toPPos :: Text -> Int -> PPosition Source

Generates a PPosition based on a filename and line number.

Lenses

Helpers

capitalizeRT :: Text -> Text Source

Properly capitalizes resource types

Types

Expressions

data UnresolvedValue Source

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 

data LambdaParameters Source

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

Constructors

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

data CompRegex Source

Constructors

CompRegex !Text !Regex 

data Virtuality Source

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 catalogderiving (Generic, Eq, Show)

data LinkType Source

Relationship link type.

Search Expressions

Statements

data ConditionalDecl Source

All types of conditional statements (case, if, etc.) are 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 ...")

Constructors

ConditionalDecl !(Vector (Pair Expression (Vector Statement))) !PPosition 

data ClassDecl Source

Constructors

ClassDecl !Text !(Vector (Pair Text (Maybe Expression))) !(Maybe Text) !(Vector Statement) !PPosition 

data DepDecl Source

Constructors

DepDecl !(Pair Text Expression) !(Pair Text Expression) !LinkType !PPosition 

data ResDecl Source

Resource declaration: e.g `file { mode => 755}`

Constructors

ResDecl !Text !Expression !(Vector AttributeDecl) !Virtuality !PPosition 

data DefineDecl Source

Constructors

DefineDecl !Text !(Vector (Pair Text (Maybe Expression))) !(Vector Statement) !PPosition 

data NodeDecl Source

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

Constructors

NodeDecl !NodeDesc !(Vector Statement) !(Maybe NodeDesc) !PPosition 

data VarAssignDecl Source

e.g $newvar = world

Constructors

VarAssignDecl !Text !Expression !PPosition