Permalink
Browse files

NOT should take parenthesis into consideration

  • Loading branch information...
1 parent e5a6c03 commit 5a7a9267f1cff9d6cd15ec1946f83ad17b99aa2e @systay committed Jun 16, 2012
@@ -35,6 +35,7 @@ trait Predicates extends Base with ParserPattern {
expressionOrEntity <~ ignoreCase("is null") ^^ (x => IsNull(x))
| expressionOrEntity <~ ignoreCase("is not null") ^^ (x => Not(IsNull(x)))
| operators
+ | ignoreCase("not") ~> parens(predicate) ^^ ( inner => Not(inner) )
| ignoreCase("not") ~> predicate ^^ ( inner => Not(inner) )
| ignoreCase("has") ~> parens(property) ^^ ( prop => Has(prop.asInstanceOf[Property]))
| parens(predicate)
@@ -1856,6 +1856,15 @@ create a-[r:REL]->b
)
}
+ @Test def not_with_parenthesis() {
+ testFrom_1_8("start a = node(1) where not(1=2) or 2=3 return a",
+ Query.
+ start(NodeById("a", 1)).
+ where(Or(Not(Equals(Literal(1), Literal(2))), Equals(Literal(2), Literal(3)))).
+ returns(ReturnItem(Entity("a"), "a"))
+ )
+ }
+
@Test def full_path_in_create() {
val secondQ = Query.
start(

0 comments on commit 5a7a926

Please sign in to comment.