on master help sign in
allow negative numbers in tutd
c3a4e2dAgentM
src/bin/TutorialD/Interpreter/Base.hs+1−1
@@ -94,7 +94,7 @@ whiteSpace = Token.whiteSpace lexer
94-}
94-}
95
95
96integer :: Parser Integer
96integer :: Parser Integer
97−integer = Lex.integer
97+integer = Lex.signed spaceConsumer Lex.integer
98
98
99float :: Parser Double
99float :: Parser Double
100float = Lex.float
100float = Lex.float
test/TutorialD/Interpreter.hs+1−1
@@ -86,7 +86,7 @@ main = do
86 ("x:=true=true", Right relationTrue),
86 ("x:=true=true", Right relationTrue),
87 ("x:=true=false", Right relationFalse),
87 ("x:=true=false", Right relationFalse),
88 ("x:=true; undefine x", Left (RelVarNotDefinedError "x")),
88 ("x:=true; undefine x", Left (RelVarNotDefinedError "x")),
89− ("x:=relation {b Integer, a Text}{}; insert x relation{tuple{b 5, a \"spam\"}}", mkRelationFromTuples simpleCAttributes [RelationTuple simpleCAttributes $ V.fromList [TextAtom "spam", IntegerAtom 5]]),
89+ ("x:=relation {b Integer, a Text}{}; insert x relation{tuple{b -5, a \"spam\"}}", mkRelationFromTuples simpleCAttributes [RelationTuple simpleCAttributes $ V.fromList [TextAtom "spam", IntegerAtom (-5)]]),
90 -- test nested relation constructor
90 -- test nested relation constructor
91 ("x:=relation{tuple{a 5, b relation{tuple{a 6}}}}", mkRelation nestedRelationAttributes $ RelationTupleSet [RelationTuple nestedRelationAttributes (V.fromList [IntegerAtom 5, RelationAtom (Relation simpleAAttributes $ RelationTupleSet [RelationTuple simpleAAttributes $ V.fromList [IntegerAtom 6]])])]),
91 ("x:=relation{tuple{a 5, b relation{tuple{a 6}}}}", mkRelation nestedRelationAttributes $ RelationTupleSet [RelationTuple nestedRelationAttributes (V.fromList [IntegerAtom 5, RelationAtom (Relation simpleAAttributes $ RelationTupleSet [RelationTuple simpleAAttributes $ V.fromList [IntegerAtom 6]])])]),
92 ("x:=relation{tuple{b 5,a \"spam\"},tuple{b 6,a \"sam\"}}; delete x where b=6", mkRelation simpleCAttributes $ RelationTupleSet [RelationTuple simpleCAttributes (V.fromList [TextAtom "spam", IntegerAtom 5])]),
92 ("x:=relation{tuple{b 5,a \"spam\"},tuple{b 6,a \"sam\"}}; delete x where b=6", mkRelation simpleCAttributes $ RelationTupleSet [RelationTuple simpleCAttributes (V.fromList [TextAtom "spam", IntegerAtom 5])]),