language-puppet 0.10.4 → 0.10.5
raw patch · 2 files changed
+25/−8 lines, 2 filesdep ~hsluadep ~luautils
Dependency ranges changed: hslua, luautils
Files
- Puppet/Interpreter/Resolve.hs +22/−5
- language-puppet.cabal +3/−3
Puppet/Interpreter/Resolve.hs view
@@ -599,16 +599,33 @@ -- | Evaluates a statement in "pure" mode. TODO evalPureStatement :: Statement -> InterpreterMonad ()-evalPureStatement = undefined+evalPureStatement _ = throwPosError "So called 'pure' statements are not yet supported" +-- | This extracts the final expression from an HFunctionCall.+-- When it does not exists, it checks if the last statement is in fact+-- a function call+transformPureHf :: HFunctionCall -> InterpreterMonad (HFunctionCall, Expression)+transformPureHf hf =+ case hf ^. hfexpression of+ S.Just x -> return (hf, x)+ S.Nothing -> do+ let statements = hf ^. hfstatements+ if V.null statements+ then throwPosError ("The statement block must not be empty" <+> pretty hf)+ else case V.last statements of+ (MainFunctionCall fn args _) ->+ let expr = PValue (UFunctionCall fn args)+ in return (hf & hfstatements %~ V.init+ & hfexpression .~ S.Just expr+ , expr)+ _ -> throwPosError ("The statement block must end with an expression" <+> pretty hf)+ -- | All the "higher order function" stuff, for "value" mode. In this case -- we are in "pure" mode, and only a few statements are allowed. evaluateHFCPure :: HFunctionCall -> InterpreterMonad PValue-evaluateHFCPure hf = do+evaluateHFCPure hf' = do+ (hf, finalexpression) <- transformPureHf hf' varassocs <- hfGenerateAssociations hf- finalexpression <- case hf ^. hfexpression of- S.Just x -> return x- S.Nothing -> throwPosError ("The statement block must end with an expression" <+> pretty hf) let runblock :: [(T.Text, PValue)] -> InterpreterMonad PValue runblock assocs = do saved <- hfSetvars assocs
language-puppet.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: language-puppet-version: 0.10.4+version: 0.10.5 synopsis: Tools to parse and evaluate the Puppet DSL. description: This is a set of tools that is supposed to fill all your Puppet needs : syntax checks, catalog compilation, PuppetDB queries, simulationg of complex interactions between nodes, Puppet master replacement, and more ! homepage: http://lpuppet.banquise.net/@@ -93,8 +93,8 @@ , ansi-wl-pprint == 0.6.* , unix == 2.6.* , aeson == 0.6.*- , luautils >= 0.1.1- , hslua == 0.3.*+ , luautils >= 0.1.3 && < 0.1.4+ , hslua >= 0.3.10 && < 0.4 , transformers == 0.3.* , hslogger == 1.2.* , time == 1.4.*