From dc2202f36f8ee220293cc6f230be604a19be8cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 7 Aug 2024 20:59:18 +0200 Subject: Replace first command (wait) with a builtin --- src/Parser/Core.hs | 3 --- src/Parser/Statement.hs | 12 ++++++------ 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src/Parser') diff --git a/src/Parser/Core.hs b/src/Parser/Core.hs index da93905..b932523 100644 --- a/src/Parser/Core.hs +++ b/src/Parser/Core.hs @@ -24,9 +24,6 @@ data TestParserState = TestParserState , testContext :: SomeExpr } -data SomeExpr = forall a. ExprType a => SomeExpr (Expr a) -data SomeExprType = forall a. ExprType a => SomeExprType (Proxy a) - someEmptyVar :: SomeExprType -> SomeVarValue someEmptyVar (SomeExprType (Proxy :: Proxy a)) = SomeVarValue $ emptyVarValue @a diff --git a/src/Parser/Statement.hs b/src/Parser/Statement.hs index 8906cec..8dd285a 100644 --- a/src/Parser/Statement.hs +++ b/src/Parser/Statement.hs @@ -75,6 +75,11 @@ forStatement = do body <- testBlock indent return [For line tname (unpack <$> e) body] +exprStatement :: TestParser [ TestStep ] +exprStatement = do + expr <- typedExpr + return [ ExprStatement expr ] + class (Typeable a, Typeable (ParamRep a)) => ParamType a where type ParamRep a :: Type type ParamRep a = a @@ -335,11 +340,6 @@ testPacketLoss = command "packet_loss" $ PacketLoss <*> innerBlock -testWait :: TestParser [TestStep] -testWait = do - wsymbol "wait" - return [Wait] - testBlock :: Pos -> TestParser [TestStep] testBlock indent = concat <$> go where @@ -369,5 +369,5 @@ testStep = choice , testDisconnectNodes , testDisconnectUpstream , testPacketLoss - , testWait + , exprStatement ] -- cgit v1.2.3