on master help sign in
add boolean atoms to tutoriald parser
commita2b0224fe3e4a328768cf848bf5e04189a6076a5 authorAgentM <agentm@themactionfaction.com> dateMon 30 Oct 2017, 00:26 (9 years ago) parent20bf246
1 file changed+2−3
src/bin/TutorialD/Interpreter/RelationalExpr.hs+2−3
src/bin/TutorialD/Interpreter/RelationalExpr.hs+2−3
@@ -150,8 +150,7 @@ restrictionPredicateP = makeExprParser predicateTerm predicateOperators
150150 predicateTerm = try (parens restrictionPredicateP)
151151 <|> try restrictionAtomExprP
152152 <|> try restrictionAttributeEqualityP
153− <|> try relationalBooleanExprP
154−
153+ <|> relationalBooleanExprP
155154
156155relationalBooleanExprP :: RelationalMarkerExpr a => Parser (RestrictionPredicateExprBase a)
157156relationalBooleanExprP = do
@@ -169,7 +168,7 @@ restrictionAttributeEqualityP = do
169168restrictionAtomExprP :: RelationalMarkerExpr a=> Parser (RestrictionPredicateExprBase a) --atoms which are of type "boolean"
170169restrictionAtomExprP = do
171170 _ <- char '^' -- not ideal, but allows me to continue to use a context-free grammar
172− AtomExprPredicate <$> atomExprP
171+ (try (char 't') >> pure TruePredicate) <|> (try (char 'f') >> pure (NotPredicate TruePredicate)) <|> AtomExprPredicate <$> atomExprP
173172
174173multiTupleExpressionP :: RelationalMarkerExpr a => Parser [ExtendTupleExprBase a]
175174multiTupleExpressionP = sepBy extendTupleExpressionP comma