Safe Haskell | None |
---|
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
- 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
- | PValue !UValue
- data SelectorCase
- data UValue
- = UBoolean !Bool
- | UString !Text
- | UInterpolable !(Vector UValue)
- | UUndef
- | UResourceReference !Text !Expression
- | UArray !(Vector Expression)
- | UHash !(Vector (Pair Expression Expression))
- | URegexp !Text !Regex
- | UVariableReference !Text
- | UFunctionCall !Text !(Vector Expression)
- | UHFunctionCall !HFunctionCall
- data HigherFuncType
- data HFunctionCall = HFunctionCall {
- _hftype :: !HigherFuncType
- _hfexpr :: !(Maybe Expression)
- _hfparams :: !BlockParameters
- _hfstatements :: !(Vector Statement)
- _hfexpression :: !(Maybe Expression)
- class HasHFunctionCall t where
- hFunctionCall :: Lens' t HFunctionCall
- hfexpr :: Lens' t (Maybe Expression)
- hfexpression :: Lens' t (Maybe Expression)
- hfparams :: Lens' t BlockParameters
- hfstatements :: Lens' t (Vector Statement)
- hftype :: Lens' t HigherFuncType
- data BlockParameters
- data CollectorType
- data Virtuality
- = Normal
- | Virtual
- | Exported
- | ExportedRealized
- data NodeDesc
- data SearchExpression
- data Statement
- = ResourceDeclaration !Text !Expression !(Vector (Pair Text Expression)) !Virtuality !PPosition
- | DefaultDeclaration !Text !(Vector (Pair Text Expression)) !PPosition
- | ResourceOverride !Text !Expression !(Vector (Pair Text Expression)) !PPosition
- | ConditionalStatement !(Vector (Pair Expression (Vector Statement))) !PPosition
- | ClassDeclaration !Text !(Vector (Pair Text (Maybe Expression))) !(Maybe Text) !(Vector Statement) !PPosition
- | DefineDeclaration !Text !(Vector (Pair Text (Maybe Expression))) !(Vector Statement) !PPosition
- | Node !NodeDesc !(Vector Statement) !(Maybe NodeDesc) !PPosition
- | VariableAssignment !Text !Expression !PPosition
- | MainFunctionCall !Text !(Vector Expression) !PPosition
- | SHFunctionCall !HFunctionCall !PPosition
- | ResourceCollection !CollectorType !Text !SearchExpression !(Vector (Pair Text Expression)) !PPosition
- | Dependency !(Pair Text Expression) !(Pair Text Expression) !PPosition
- | TopContainer !(Vector Statement) !Statement
Position management
initialPPos :: Text -> PPosition
Generates an initial position based on a filename.
Lenses
Helpers
capitalize' :: Text -> Text
capitalizeRT :: Text -> Text
Properly capitalizes resource types
array :: [Expression] -> UValue
A helper function for writing array
s.
Types
Expressions
data Expression
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. |
PValue !UValue |
data UValue
An unresolved value, typically the parser's output.
UBoolean !Bool | Special tokens generated when parsing the |
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 |
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 |
data HigherFuncType
The distinct Puppet higher order functions
data HFunctionCall
HFunctionCall | |
|
class HasHFunctionCall t where
hFunctionCall :: Lens' t HFunctionCall
hfexpr :: Lens' t (Maybe Expression)
hfexpression :: Lens' t (Maybe Expression)
hfparams :: Lens' t BlockParameters
hfstatements :: Lens' t (Vector Statement)
hftype :: Lens' t HigherFuncType
data BlockParameters
Currently only two types of block parameters are supported, single values and pairs.
data Virtuality
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
data SearchExpression
Statements
data Statement
All the possible statements