@@ -112,8 +112,7 @@ ungroupP = do
112extendP :: RelationalMarkerExpr a => Parser (RelationalExprBase a -> RelationalExprBase a)
112extendP :: RelationalMarkerExpr a => Parser (RelationalExprBase a -> RelationalExprBase a)
113extendP = do
113extendP = do
114 reservedOp ":"
114 reservedOp ":"
115− tupleExpr <- braces extendTupleExpressionP
115+ Extend <$> braces extendTupleExpressionP
116− return $ Extend tupleExpr
118semijoinP :: RelationalMarkerExpr a => Parser (RelationalExprBase a -> RelationalExprBase a -> RelationalExprBase a)
117semijoinP :: RelationalMarkerExpr a => Parser (RelationalExprBase a -> RelationalExprBase a -> RelationalExprBase a)
119semijoinP = do
118semijoinP = do
@@ -169,17 +168,15 @@ restrictionPredicateP = makeExprParser predicateTerm predicateOperators
169 <|> relationalBooleanExprP
168 <|> relationalBooleanExprP
171relationalBooleanExprP :: RelationalMarkerExpr a => Parser (RestrictionPredicateExprBase a)
170relationalBooleanExprP :: RelationalMarkerExpr a => Parser (RestrictionPredicateExprBase a)
172−relationalBooleanExprP = do
171+relationalBooleanExprP =
173− relexpr <- parens relExprP <|> relTerm
174 --we can't actually detect if the type is relational boolean, so we just pass it to the next phase
172 --we can't actually detect if the type is relational boolean, so we just pass it to the next phase
175− return $ RelationalExprPredicate relexpr
173+ RelationalExprPredicate <$> (parens relExprP <|> relTerm)
177restrictionAttributeEqualityP :: RelationalMarkerExpr a => Parser (RestrictionPredicateExprBase a)
175restrictionAttributeEqualityP :: RelationalMarkerExpr a => Parser (RestrictionPredicateExprBase a)
178restrictionAttributeEqualityP = do
176restrictionAttributeEqualityP = do
179 attributeName <- identifier
177 attributeName <- identifier
180 reservedOp "="
178 reservedOp "="
181− atomexpr <- atomExprP
182− return $ AttributeEqualityPredicate attributeName atomexpr
179+ AttributeEqualityPredicate attributeName <$> atomExprP
184restrictionAtomExprP :: RelationalMarkerExpr a=> Parser (RestrictionPredicateExprBase a) --atoms which are of type "boolean"
181restrictionAtomExprP :: RelationalMarkerExpr a=> Parser (RestrictionPredicateExprBase a) --atoms which are of type "boolean"
185restrictionAtomExprP = do
182restrictionAtomExprP = do
@@ -196,8 +193,7 @@ attributeExtendTupleExpressionP :: RelationalMarkerExpr a => Parser (ExtendTuple
196attributeExtendTupleExpressionP = do
193attributeExtendTupleExpressionP = do
197 newAttr <- identifier
194 newAttr <- identifier
198 reservedOp ":="
195 reservedOp ":="
200− return $ AttributeExtendTupleExpr newAttr atom
196+ AttributeExtendTupleExpr newAttr <$> atomExprP
202atomExprP :: RelationalMarkerExpr a => Parser (AtomExprBase a)
198atomExprP :: RelationalMarkerExpr a => Parser (AtomExprBase a)
203atomExprP = consumeAtomExprP True
199atomExprP = consumeAtomExprP True
@@ -213,8 +209,7 @@ consumeAtomExprP consume = try functionAtomExprP <|>
213attributeAtomExprP :: Parser (AtomExprBase a)
209attributeAtomExprP :: Parser (AtomExprBase a)
214attributeAtomExprP = do
210attributeAtomExprP = do
215 _ <- string "@"
211 _ <- string "@"
216− attrName <- identifier
212+ AttributeAtomExpr <$> identifier
217− return $ AttributeAtomExpr attrName
219nakedAtomExprP :: Parser (AtomExprBase a)
214nakedAtomExprP :: Parser (AtomExprBase a)
220nakedAtomExprP = NakedAtomExpr <$> atomP
215nakedAtomExprP = NakedAtomExpr <$> atomP
@@ -234,11 +229,8 @@ atomP = stringAtomP <|>
234 boolAtomP
229 boolAtomP
236functionAtomExprP :: RelationalMarkerExpr a => Parser (AtomExprBase a)
231functionAtomExprP :: RelationalMarkerExpr a => Parser (AtomExprBase a)
237−functionAtomExprP = do
232+functionAtomExprP =
238− funcName <- identifier
239− argList <- parens (sepBy atomExprP comma)
233+ FunctionAtomExpr <$> identifier <*> parens (sepBy atomExprP comma) <*> parseMarkerP
240− marker <- parseMarkerP
241− return $ FunctionAtomExpr funcName argList marker
243relationalAtomExprP :: RelationalMarkerExpr a => Parser (AtomExprBase a)
235relationalAtomExprP :: RelationalMarkerExpr a => Parser (AtomExprBase a)
244relationalAtomExprP = RelationAtomExpr <$> relExprP
236relationalAtomExprP = RelationAtomExpr <$> relExprP