From 4bf66b92954fc818956069c767abb1608371458d Mon Sep 17 00:00:00 2001 From: Ilya Rezvov Date: Tue, 20 Mar 2018 16:51:58 -0700 Subject: [PATCH] fix module idents coding --- src/Language/Wasm/Parser.y | 19 ++++++++++--------- tests/Test.hs | 1 - 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Language/Wasm/Parser.y b/src/Language/Wasm/Parser.y index 7188fe2..732d417 100644 --- a/src/Language/Wasm/Parser.y +++ b/src/Language/Wasm/Parser.y @@ -1291,27 +1291,28 @@ type Script = [Command] type Expression = [Instruction] data ModuleDef - = RawModDef Module - | TextModDef (Maybe TL.Text) [TL.Text] - | BinaryModDef (Maybe TL.Text) [TL.Text] + = RawModDef (Maybe Ident) Module + | TextModDef (Maybe Ident) [TL.Text] + | BinaryModDef (Maybe Ident) [TL.Text] deriving (Show, Eq) data Command = ModuleDef ModuleDef + | Register TL.Text (Maybe Ident) | Action | Assertion | Meta deriving (Show, Eq) data Action - = Invoke (Maybe TL.Text) TL.Text [Expression] - | Get (Maybe TL.Text) TL.Text + = Invoke (Maybe Ident) TL.Text [Expression] + | Get (Maybe Ident) TL.Text deriving (Show, Eq) type FailureString = TL.Text data Assertion - = AssertReturn Action Instruction + = AssertReturn Action [Expression] | AssertReturnCanonicalNaN Action | AssertReturnArithmeticNaN Action | AssertTrap (Either Action ModuleDef) FailureString @@ -1321,9 +1322,9 @@ data Assertion deriving (Show, Eq) data Meta - = Script (Maybe TL.Text) Script - | Input (Maybe TL.Text) TL.Text - | Output (Maybe TL.Text) TL.Text + = Script (Maybe Ident) Script + | Input (Maybe Ident) TL.Text + | Output (Maybe Ident) TL.Text deriving (Show, Eq) type Labels = [Maybe Ident] diff --git a/tests/Test.hs b/tests/Test.hs index 1e6eae7..2a47371 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -60,7 +60,6 @@ main = do let Right mod = Parser.parseModule <$> Lexer.scanner content (modInst, store) <- Interpreter.instantiate Interpreter.emptyStore Interpreter.emptyImports mod (`mapM` ["fac-rec", "fac-rec-named", "fac-iter", "fac-iter-named", "fac-opt"]) $ \fn -> do - -- (`mapM` ["fac-iter-named"]) $ \fn -> do let fac = \n -> Interpreter.invokeExport store modInst fn [Interpreter.VI64 n] fac3 <- fac 3 fac5 <- fac 5