diff options
Diffstat (limited to 'src/Parser')
-rw-r--r-- | src/Parser/Core.hs | 9 | ||||
-rw-r--r-- | src/Parser/Statement.hs | 6 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/Parser/Core.hs b/src/Parser/Core.hs index f40889a..cb66529 100644 --- a/src/Parser/Core.hs +++ b/src/Parser/Core.hs @@ -139,13 +139,14 @@ unifyExpr off pa expr = if showType ( Just (ArgumentKeyword kw), SomeArgumentType atype ) = "`" <> kw <> " <" <> textExprType atype <> ">'" err = parseError . FancyError off . S.singleton . ErrorFail . T.unpack - defaults <- forM (M.toAscList remaining) $ \case - arg@(_, SomeArgumentType NoDefault) -> err $ "missing " <> showType arg <> " argument" - (kw, SomeArgumentType (ExprDefault def)) -> return (kw, SomeExpr def) + defaults <- fmap catMaybes $ forM (M.toAscList remaining) $ \case + arg@(_, SomeArgumentType RequiredArgument) -> err $ "missing " <> showType arg <> " argument" + (_, SomeArgumentType OptionalArgument) -> return Nothing + (kw, SomeArgumentType (ExprDefault def)) -> return $ Just ( kw, SomeExpr def ) (kw, SomeArgumentType atype@ContextDefault) -> do SomeExpr context <- gets testContext context' <- unifyExpr off atype context - return (kw, SomeExpr context') + return $ Just ( kw, SomeExpr context' ) return (FunctionEval $ ArgsApp (FunctionArguments $ M.fromAscList defaults) expr) | Just (Refl :: DynamicType :~: b) <- eqT diff --git a/src/Parser/Statement.hs b/src/Parser/Statement.hs index 67ffd76..c7cdf5a 100644 --- a/src/Parser/Statement.hs +++ b/src/Parser/Statement.hs @@ -320,11 +320,6 @@ testExpect = command "expect" $ Expect <*> param "capture" <*> innerBlock -testFlush :: TestParser [TestStep] -testFlush = command "flush" $ Flush - <$> paramOrContext "from" - <*> param "" - testDisconnectNode :: TestParser [TestStep] testDisconnectNode = command "disconnect_node" $ DisconnectNode <$> paramOrContext "" @@ -372,7 +367,6 @@ testStep = choice , testNode , testSpawn , testExpect - , testFlush , testDisconnectNode , testDisconnectNodes , testDisconnectUpstream |