From 7515dafc006f8b71bc15aa7ed9749c7d4fb00153 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Wed, 27 Jan 2010 22:26:45 +0100 Subject: Allow multiple || and && statements. --- conf/confbase.Y | 4 ++-- filter/test.conf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/confbase.Y b/conf/confbase.Y index a2df85d..6d2607e 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -60,8 +60,8 @@ CF_DECLS %type text_or_none %nonassoc PREFIX_DUMMY -%nonassoc '=' '<' '>' '~' '.' GEQ LEQ NEQ AND OR PO PC -%left '+' '-' +%nonassoc '=' '<' '>' '~' '.' GEQ LEQ NEQ PO PC +%left '+' '-' AND OR %left '*' '/' '%' %left '!' diff --git a/filter/test.conf b/filter/test.conf index 7114fd2..657209a 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -149,7 +149,7 @@ string s; is = [ 2, 3, 4, 7..11 ]; print " must be true: ", 1.2.0.0/16 ~ [ 1.0.0.0/8{ 15 , 17 } ]; print " data types; must be true: ", 1.2.3.4 = 1.2.3.4, ",", 1 ~ [1,2,3], ",", 5 ~ [1..20], ",", 10 ~ is, ",", 2 ~ [ 1, 2, 3 ], ",", 5 ~ [ 4 .. 7 ], ",", 1.2.3.4 ~ [ 1.2.3.3..1.2.3.5 ], ",", 1.2.3.4 ~ 1.0.0.0/8, ",", 1.0.0.0/8 ~ 1.0.0.0/8, ",", 1.0.0.0/8 ~ [ 1.0.0.0/8+ ]; - print " must be true: ", true && true, ",", true || false; + print " must be true: ", true && true, ",", true || false, ",", true || false || false; # print " must be true: ", defined(1), ",", defined(1.2.3.4), ",", 1 != 2, ",", 1 <= 2; print " data types: must be false: ", 1 ~ [ 2, 3, 4 ], ",", 5 ~ is, ",", 1.2.3.4 ~ [ 1.2.3.3, 1.2.3.5 ], ",", (1,2) > (2,2), ",", (1,1) > (1,1), ",", 1.0.0.0/9 ~ [ 1.0.0.0/8- ], ",", 1.2.0.0/17 ~ [ 1.0.0.0/8{ 15 , 16 } ], ",", true && false; -- cgit v1.2.3 From 1960d20350c5191b089f0a233d99969a0ff23ef6 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Wed, 27 Jan 2010 23:45:36 +0100 Subject: Priority for '||' and '&&' fixed. --- conf/confbase.Y | 3 ++- filter/test.conf | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/confbase.Y b/conf/confbase.Y index 6d2607e..91bfb1d 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -60,8 +60,9 @@ CF_DECLS %type text_or_none %nonassoc PREFIX_DUMMY +%left AND OR %nonassoc '=' '<' '>' '~' '.' GEQ LEQ NEQ PO PC -%left '+' '-' AND OR +%left '+' '-' %left '*' '/' '%' %left '!' diff --git a/filter/test.conf b/filter/test.conf index 657209a..2e82863 100644 --- a/filter/test.conf +++ b/filter/test.conf @@ -149,7 +149,7 @@ string s; is = [ 2, 3, 4, 7..11 ]; print " must be true: ", 1.2.0.0/16 ~ [ 1.0.0.0/8{ 15 , 17 } ]; print " data types; must be true: ", 1.2.3.4 = 1.2.3.4, ",", 1 ~ [1,2,3], ",", 5 ~ [1..20], ",", 10 ~ is, ",", 2 ~ [ 1, 2, 3 ], ",", 5 ~ [ 4 .. 7 ], ",", 1.2.3.4 ~ [ 1.2.3.3..1.2.3.5 ], ",", 1.2.3.4 ~ 1.0.0.0/8, ",", 1.0.0.0/8 ~ 1.0.0.0/8, ",", 1.0.0.0/8 ~ [ 1.0.0.0/8+ ]; - print " must be true: ", true && true, ",", true || false, ",", true || false || false; + print " must be true: ", true && true, ",", true || false, ",", ! false && ! false && true, ",", 1 < 2 && 1 != 3; # print " must be true: ", defined(1), ",", defined(1.2.3.4), ",", 1 != 2, ",", 1 <= 2; print " data types: must be false: ", 1 ~ [ 2, 3, 4 ], ",", 5 ~ is, ",", 1.2.3.4 ~ [ 1.2.3.3, 1.2.3.5 ], ",", (1,2) > (2,2), ",", (1,1) > (1,1), ",", 1.0.0.0/9 ~ [ 1.0.0.0/8- ], ",", 1.2.0.0/17 ~ [ 1.0.0.0/8{ 15 , 16 } ], ",", true && false; -- cgit v1.2.3