Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Fix parsing for boolean expressions starting with negation #66

Merged
merged 1 commit into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ expression
| expression bracketSpecifier # bracketedExpression
| bracketSpecifier # bracketExpression
| expression COMPARATOR expression # comparisonExpression
| '!' expression # notExpression
| expression '&&' expression # andExpression
| expression '||' expression # orExpression
| identifier # identifierExpression
| '!' expression # notExpression
| '(' expression ')' # parenExpression
| wildcard # wildcardExpression
| multiSelectList # multiSelectListExpression
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,32 @@ public void bareNegatedExpression() {
assertThat(actual, is(expected));
}

@Test
public void negatedBooleansTripleConjunctionExpression() {
Expression<Object> expected = And(
And(
Negate(Property("foo")),
Negate(Property("bar"))
),
Negate(Property("buzz"))
);
Expression<Object> actual = compile("!foo && !bar && !buzz");
assertThat(actual, is(expected));
}

@Test
public void negatedBooleansTripleDisjunctionExpression() {
Expression<Object> expected = Or(
Or(
Negate(Property("foo")),
Negate(Property("bar"))
),
Negate(Property("buzz"))
);
Expression<Object> actual = compile("!foo || !bar || !buzz");
assertThat(actual, is(expected));
}

@Test
public void negatedSelectionExpression() {
Expression<Object> expected = Sequence(
Expand Down