language-puppet-1.0.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

array :: [Expression] -> UValue Source

A helper function for writing arrays.

toBool :: UValue -> Bool Source

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

Types

Expressions

data UValue 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) 
UHFunctionCall !HFunctionCall 
UNumber Scientific 

data HigherFuncType Source

The distinct Puppet higher order functions

data BlockParameters Source

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 catalog

Search Expressions

Statements

data Statement Source

All the possible statements

Constructors

ResourceDeclaration !ResDec 
DefaultDeclaration !DefaultDec 
ResourceOverride !ResOver 
ConditionalStatement !CondStatement 
ClassDeclaration !ClassDecl 
DefineDeclaration !DefineDec 
Node !Nd 
VariableAssignment !VarAss 
MainFunctionCall !MFC 
SHFunctionCall !SFC 
ResourceCollection !RColl 
Dependency !Dep 
TopContainer !(Vector Statement) !Statement

This is a special statement that is used to include the expressions that are top level. This is certainly buggy, but probably just like the original implementation.

data CondStatement Source

All types of conditional statements are stored that way (case, if, etc.)

data Nd Source

Instances

data VarAss Source

Constructors

VarAss !Text !Expression !PPosition 

Instances

data MFC Source

Constructors

MFC !Text !(Vector Expression) !PPosition 

Instances

data SFC Source

Higher order function call.

Constructors

SFC !HFunctionCall !PPosition 

Instances

data RColl Source

For all types of collectors.

Instances