tonioo/sievelib

Parsing bug on anyof and allof

Closed this issue · 3 comments

this filter

require ["fileinto", "reject"];

if allof (not allof (address :is ["From","sender"] ["test1@test2.priv","test2@test2.priv"], header :matches "Subject" "INACTIVE*"), address :is "From" "user3@test3.priv")
{
 reject;
}

gets parsed and reconverted to sieve as

require ["fileinto", "reject"];
if allof (not allof (address :is ["From", "sender"] ["test1@test2.priv", "test2@test2.priv"], header :matches "Subject" "INACTIVE*")) {
    reject;
}

thus losing address :is "From" "user3@test3.priv"

it seems triggered by the not before the allof.

a "not allof" or a "not anyof" eats up the following test at the same level:

require ["fileinto", "reject"];
if anyof(not allof (size :over 200K, size :over 500K, size :under 10K), true, false)
{
 reject;
}

is parsed and re-converted into

require ["fileinto", "reject"];
if anyof (not allof (size :over 200K, size :over 500K, size :under 10K), false) {
    reject;
}

a "not" before a simple test behaves correctly:

require         ["fileinto", "reject"];

if anyof(        allof (size :over 200K, not size :over 500K, size :under 10K), true, false)
{
 reject;
}

is correctly parsed and rebuilt into

require ["fileinto", "reject"];
if anyof (allof (size :over 200K, not size :over 500K, size :under 10K), true, false) {
    reject;
}

@Seemone Thank you for the debug, it should be fixed soon :)