procmail
[Top] [All Lists]

Re: Syntax of scoring command negation

1997-02-06 22:09:04
Stan Ryckman <stanr(_at_)sunspot(_dot_)tiac(_dot_)net> writes:
At 10:19 AM 2/6/97 -0600, Philip Guenther wrote:

[snip]
[most of BNF snipped]

condition ::= NUMBER "^" NUMBER condition
         | "!" condition
         | "$" condition
         | VAR "??" condition
         | "?" COMMAND
         | REGEXP
         | ">" NUMBER
         | "<" NUMBER

Sorry if I'm not an expert at BNF grammar, but doesn't this mean that:

  1^1 1^2 ! $ 2^0 VAR1 ?? VAR2 ?? 1^3 $ ! 2^2 2^1 REGEXP

would be a valid condition?  Is it?  (I missed it in the examples  :)

Well, give it a shot!


lunen% cat foo
VERBOSE = on

VAR2 = 'foo foo'
:0c
* 1^1 1^2 ! $ 2^0 VAR1 ?? VAR2 ?? 1^3 $ ! 2^2 2^1 foo
/dev/null

VAR2 = bar
:0
* 1^1 1^2 ! $ 2^0 VAR1 ?? VAR2 ?? 1^3 $ ! 2^2 2^1 foo
/dev/null

lunen% procmail -m foo < /dev/null
procmail: [20050] Thu Feb  6 22:51:41 1997
procmail: Assigning "VAR2=foo foo"
procmail: Score:       4       4 "foo"
procmail: Assigning "LASTFOLDER=/dev/null"
procmail: Opening "/dev/null"
procmail: Assigning "VAR2=bar"
procmail: Score:       0       0 "foo"
  Folder: **Bounced**                                                         0
lunen%

Looks like it did the "Right Thing" (?) and took the last of the
weights and the last of "var ??" specials.  The '!'s canceled, but the
'$'s accumulate (well, they're processed as you go left to right), and
while I didn't how it with the simple regexp "foo" above, that regexp
was actually '$' expanded twice.  If I had said:

foo = bar
bar = baz
:0
* $ $ \$$foo
/dev/null

Then the actual regexp used would have been "baz".  Cute, eh?

Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>