Safe Haskell | None |
---|
This module exports the functions that will be useful to parse the DSL. They should be able to parse everything you throw at them. The Puppet language is extremely irregular, and most valid constructs are not documented in the official language guide. This parser has been created by parsing the author's own large manifests and the public Wikimedia ones.
Things that are known to not to be properly supported are :
- "plussignement" such as foo +> bar. How to handle this is far from being obvious, as its actual behaviour is not documented.
- parse :: Stream s Identity t => Parsec s () a -> SourceName -> s -> Either ParseError a
- mparser :: Parser [Statement]
- exprparser :: ParsecT Text () Identity Expression
Documentation
parse :: Stream s Identity t => Parsec s () a -> SourceName -> s -> Either ParseError a
parse p filePath input
runs a parser p
over Identity without user
state. The filePath
is only used in error messages and may be the
empty string. Returns either a ParseError
(Left
)
or a value of type a
(Right
).
main = case (parse numbers "" "11, 2, 43") of Left err -> print err Right xs -> print (sum xs) numbers = commaSep integer
exprparser :: ParsecT Text () Identity ExpressionSource
This is a parser for Puppet Expression
s.