diff --git a/resources/Rosetta/test-multiple.rosetta b/resources/Rosetta/test-multiple.rosetta index c65f3a1..7e37103 100644 --- a/resources/Rosetta/test-multiple.rosetta +++ b/resources/Rosetta/test-multiple.rosetta @@ -63,3 +63,45 @@ type Contract_Get: contract Contract (1..1) type Contract_Anytime: contract Contract (1..1) + +func MkZero: + output: + contract Contract (1..1) + assign-output contract -> zero -> unit: + 1 // create the zero contract dummy value + +func MkExpired: + output: + contract Contract (1..1) + assign-output contract -> expired -> unit: + 1 // create the expired contract dummy value + +func MkOne: + inputs: + currency UnitType (1..1) + output: + contract Contract (1..1) + assign-output contract -> one -> currency: + currency + +func MkOr: + inputs: + left Contract (1..1) + right Contract (1..1) + output: + contract Contract (1..1) + assign-output contract -> orContract -> left: + left + assign-output contract -> orContract -> right: + right + +func MkBoth: + inputs: + left Contract (1..1) + right Contract (1..1) + output: + contract Contract (1..1) + assign-output contract -> both -> left: + left + assign-output contract -> both -> right: + right \ No newline at end of file diff --git a/src/Parser/Function.hs b/src/Parser/Function.hs index 39d0243..1dfc0e8 100644 --- a/src/Parser/Function.hs +++ b/src/Parser/Function.hs @@ -37,8 +37,10 @@ assignmentParser = inputAttributesParser :: Parser [TypeAttribute] inputAttributesParser = do - _ <- lexeme $ string "inputs:" - many $ try attributeParser + inp <- observing $ lexeme $ string "inputs:" + case inp of + Left _ -> return [] + Right _ -> many $ try attributeParser -- |Parses the output attribute of a function statement in Rosetta into a TypeAttribute outputAttributeParser :: Parser TypeAttribute