fixed functions without input

This commit is contained in:
Macocian Adrian Radu
2022-05-16 13:03:22 +02:00
parent 05d5bf3681
commit 8d3d00b7a5
2 changed files with 46 additions and 2 deletions

View File

@@ -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

View File

@@ -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