Safe Haskell | None |
---|---|
Language | Haskell98 |
All the types used for parsing, and helpers working on these types.
- type Position = SourcePos
- type PPosition = Pair Position Position
- initialPPos :: Text -> PPosition
- toPPos :: Text -> Int -> PPosition
- lSourceName :: Lens' Position SourceName
- lSourceLine :: Lens' Position Line
- lSourceColumn :: Lens' Position Column
- capitalize' :: Text -> Text
- capitalizeRT :: Text -> Text
- array :: [Expression] -> UValue
- toBool :: UValue -> Bool
- rel2text :: LinkType -> Text
- data Expression
- = Equal !Expression !Expression
- | Different !Expression !Expression
- | Not !Expression
- | And !Expression !Expression
- | Or !Expression !Expression
- | LessThan !Expression !Expression
- | MoreThan !Expression !Expression
- | LessEqualThan !Expression !Expression
- | MoreEqualThan !Expression !Expression
- | RegexMatch !Expression !Expression
- | NotRegexMatch !Expression !Expression
- | Contains !Expression !Expression
- | Addition !Expression !Expression
- | Substraction !Expression !Expression
- | Division !Expression !Expression
- | Multiplication !Expression !Expression
- | Modulo !Expression !Expression
- | RightShift !Expression !Expression
- | LeftShift !Expression !Expression
- | Lookup !Expression !Expression
- | Negate !Expression
- | ConditionalValue !Expression !(Vector (Pair SelectorCase Expression))
- | FunctionApplication !Expression !Expression
- | Terminal !UValue
- data SelectorCase
- data UValue
- = UBoolean !Bool
- | UString !Text
- | UInterpolable !(Vector Expression)
- | UUndef
- | UResourceReference !Text !Expression
- | UArray !(Vector Expression)
- | UHash !(Vector (Pair Expression Expression))
- | URegexp !CompRegex
- | UVariableReference !Text
- | UFunctionCall !Text !(Vector Expression)
- | UHFunctionCall !HFunctionCall
- | UNumber Scientific
- data HigherFuncType
- data HFunctionCall = HFunctionCall {
- _hftype :: !HigherFuncType
- _hfexpr :: !(Maybe Expression)
- _hfparams :: !BlockParameters
- _hfstatements :: !(Vector Statement)
- _hfexpression :: !(Maybe Expression)
- class HasHFunctionCall c where
- hFunctionCall :: Lens' c HFunctionCall
- hfexpr :: Lens' c (Maybe Expression)
- hfexpression :: Lens' c (Maybe Expression)
- hfparams :: Lens' c BlockParameters
- hfstatements :: Lens' c (Vector Statement)
- hftype :: Lens' c HigherFuncType
- data BlockParameters
- data CompRegex = CompRegex !Text !Regex
- data CollectorType
- data Virtuality
- data NodeDesc
- data LinkType
- = RNotify
- | RRequire
- | RBefore
- | RSubscribe
- data SearchExpression
- data Statement
- = 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
- data ResDec = ResDec !Text !Expression !(Vector (Pair Text Expression)) !Virtuality !PPosition
- data DefaultDec = DefaultDec !Text !(Vector (Pair Text Expression)) !PPosition
- data ResOver = ResOver !Text !Expression !(Vector (Pair Text Expression)) !PPosition
- data CondStatement = CondStatement !(Vector (Pair Expression (Vector Statement))) !PPosition
- data ClassDecl = ClassDecl !Text !(Vector (Pair Text (Maybe Expression))) !(Maybe Text) !(Vector Statement) !PPosition
- data DefineDec = DefineDec !Text !(Vector (Pair Text (Maybe Expression))) !(Vector Statement) !PPosition
- data Nd = Nd !NodeDesc !(Vector Statement) !(Maybe NodeDesc) !PPosition
- data VarAss = VarAss !Text !Expression !PPosition
- data MFC = MFC !Text !(Vector Expression) !PPosition
- data SFC = SFC !HFunctionCall !PPosition
- data RColl = RColl !CollectorType !Text !SearchExpression !(Vector (Pair Text Expression)) !PPosition
- data Dep = Dep !(Pair Text Expression) !(Pair Text Expression) !LinkType !PPosition
Position management
initialPPos :: Text -> PPosition Source
Generates an initial position based on a filename.
Lenses
Helpers
capitalize' :: Text -> Text Source
capitalizeRT :: Text -> Text Source
Properly capitalizes resource types
array :: [Expression] -> UValue Source
A helper function for writing array
s.
Types
Expressions
data Expression Source
The Expression
s
Equal !Expression !Expression | |
Different !Expression !Expression | |
Not !Expression | |
And !Expression !Expression | |
Or !Expression !Expression | |
LessThan !Expression !Expression | |
MoreThan !Expression !Expression | |
LessEqualThan !Expression !Expression | |
MoreEqualThan !Expression !Expression | |
RegexMatch !Expression !Expression | |
NotRegexMatch !Expression !Expression | |
Contains !Expression !Expression | |
Addition !Expression !Expression | |
Substraction !Expression !Expression | |
Division !Expression !Expression | |
Multiplication !Expression !Expression | |
Modulo !Expression !Expression | |
RightShift !Expression !Expression | |
LeftShift !Expression !Expression | |
Lookup !Expression !Expression | |
Negate !Expression | |
ConditionalValue !Expression !(Vector (Pair SelectorCase Expression)) | All conditionals are stored in this format. |
FunctionApplication !Expression !Expression | This is for higher order functions. |
Terminal !UValue |
data SelectorCase Source
An unresolved value, typically the parser's output.
UBoolean !Bool | Special tokens generated when parsing the |
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 |
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 HFunctionCall Source
HFunctionCall | |
|
class HasHFunctionCall c where Source
hFunctionCall :: Lens' c HFunctionCall Source
hfexpr :: Lens' c (Maybe Expression) Source
hfexpression :: Lens' c (Maybe Expression) Source
hfparams :: Lens' c BlockParameters Source
hfstatements :: Lens' c (Vector Statement) Source
hftype :: Lens' c HigherFuncType Source
data BlockParameters Source
Currently only two types of block parameters are supported, single values and pairs.
data Virtuality Source
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 |
Relationship link type.
Search Expressions
data SearchExpression Source
Statements
All the possible statements
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. |
ResDec !Text !Expression !(Vector (Pair Text Expression)) !Virtuality !PPosition |
data DefaultDec Source
DefaultDec !Text !(Vector (Pair Text Expression)) !PPosition |
ResOver !Text !Expression !(Vector (Pair Text Expression)) !PPosition |
data CondStatement Source
All types of conditional statements are stored that way (case
, if
, etc.)
For all types of collectors.