Re: precedence of if conditions (again)

2011-01-07 Thread Hank A. Paulson

On 6/30/10 9:50 PM, Willy Tarreau wrote:

On Wed, Jun 30, 2010 at 08:53:19PM -0700, Bryan Talbot wrote:

See section 7.7: AND is implicit.


7.7. Using ACLs to form conditions
--

Some actions are only performed upon a valid condition. A condition is a
combination of ACLs with operators. 3 operators are supported :

   - AND (implicit)
   - OR  (explicit with the or keyword or the || operator)
   - Negation with the exclamation mark (!)


I'm realizing that that's not enough to solve Hank's question, because
the precedence is not explained in the doc (it was so obvious to me that
it was like in other languages that it's not explained), so :

reqirep blah if a b or c

is evaluated like this :

(a and b) or c

and :

reqirep blah if a b or c d

is evaluated like this :

(a and b) or (c and d)

Regards,
Willy


I have a more complex grouping and I am still not sure how to create it.
I have one required condition A and one of 4 other conditions B1-B4 so I need
something like:

if A and (B1 or B2 or B3 or B4)

is there a way to do that?




Re: precedence of if conditions (again)

2011-01-07 Thread Bryan Talbot
Doesn't this work?

... if A B1 or A B2 or A B3 or A B4

-Bryan


On Fri, Jan 7, 2011 at 7:16 AM, Hank A. Paulson 
h...@spamproof.nospammail.net wrote:

 On 6/30/10 9:50 PM, Willy Tarreau wrote:

 On Wed, Jun 30, 2010 at 08:53:19PM -0700, Bryan Talbot wrote:

 See section 7.7: AND is implicit.


 7.7. Using ACLs to form conditions
 --

 Some actions are only performed upon a valid condition. A condition is a
 combination of ACLs with operators. 3 operators are supported :

   - AND (implicit)
   - OR  (explicit with the or keyword or the || operator)
   - Negation with the exclamation mark (!)


 I'm realizing that that's not enough to solve Hank's question, because
 the precedence is not explained in the doc (it was so obvious to me that
 it was like in other languages that it's not explained), so :

reqirep blah if a b or c

 is evaluated like this :

(a and b) or c

 and :

reqirep blah if a b or c d

 is evaluated like this :

(a and b) or (c and d)

 Regards,
 Willy


 I have a more complex grouping and I am still not sure how to create it.
 I have one required condition A and one of 4 other conditions B1-B4 so I
 need
 something like:

 if A and (B1 or B2 or B3 or B4)

 is there a way to do that?