File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
main/scala/de/upb/cs/swt/delphi/querylanguage
test/scala/de/upb/cs/swt/delphi/querylanguage Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -34,9 +34,7 @@ class Syntax(val input : ParserInput) extends Parser {
3434 Parentheses | SingularConditionRule | NotRule
3535 }
3636 def Parentheses = rule { '(' ~ CombinatorialRule ~ ')' }
37- def NotRule : Rule1 [CombinatorialExpr ] = rule {
38- '!' ~ (NotRule | SingularConditionRule | Parentheses ) ~> NotExpr
39- }
37+ def NotRule = rule { '!' ~ Factor ~> NotExpr }
4038
4139 // Singular conditions.
4240 def SingularConditionRule = rule {
Original file line number Diff line number Diff line change @@ -117,21 +117,23 @@ class SyntaxTest extends FlatSpec with Matchers {
117117 }
118118
119119 " Syntax.notConditionSimple" should " be valid" in {
120- val parseResult = new Syntax (" Filter1&&!Filter2" ).QueryRule .run()
120+ val parseResult = new Syntax (" ! Filter1&&!( Filter2) " ).QueryRule .run()
121121 parseResult shouldBe a [Success [_]]
122122 parseResult match {
123123 case Success (ast) => {
124- ast.toString shouldEqual " AndExpr(TrueExpr(Filter1),NotExpr(TrueExpr(Filter2)))"
124+ ast.toString shouldEqual " AndExpr(NotExpr(TrueExpr(Filter1))," +
125+ " NotExpr(TrueExpr(Filter2)))"
125126 }
126127 }
127128 }
128129
129130 " Syntax.notConditionSimpleParentheses" should " be valid" in {
130- val parseResult = new Syntax (" !(Filter1&&Filter2)" ).QueryRule .run()
131+ val parseResult = new Syntax (" !(Filter1&&! Filter2)" ).QueryRule .run()
131132 parseResult shouldBe a [Success [_]]
132133 parseResult match {
133134 case Success (ast) => {
134- ast.toString shouldEqual " NotExpr(AndExpr(TrueExpr(Filter1),TrueExpr(Filter2)))"
135+ ast.toString shouldEqual " NotExpr(AndExpr(TrueExpr(Filter1)," +
136+ " NotExpr(TrueExpr(Filter2))))"
135137 }
136138 }
137139 }
You can’t perform that action at this time.
0 commit comments