I finally made time to read the sieve document carefully. In general, I
think the language is in good shape. I've got a few suggestions which I
think may improve sieve's human readability without changing the
complexity of parsing much. It's not bad as it is, but these might make it
I suggest using "--" instead of "#" as the comment introducer. "--" is
what Applescript uses, and is more likely to make sense to the average
human (rather than a programmer) IMHO.
(2) The "header" test
I'd like it if the <header-name-list> and the <key-list> items could be
either a list or a single quoted string. Thus you would get:
if header "Subject" contains "$$" then
if header ("Subject" "From") contains "B1FF" then
(3) The "header" -nocase arguments
I think nocase should be the default with -case as the modifier. So you'd
get "contains", "is", "matches", "contains-case", "is-case",
"matches-case". This makes it more readable, IMHO, and makes the
more common case easier to type.
(4) Trailing ";"
The grammar seems to require a trailing ";" after every command
(including an endif). I'm starting to think it would be better to simply
have CRLF terminate a command as many of your examples do (and use "\"
CRLF to fold a line).
(5) Optional ","
I'm uncomfortable with "," being optional in any-of and all-of lists. I
think it should either be required or unnecessary.
(6) Normal action
How about calling this "keep"?
if size under 1M then
(7) Message introducer
You currently use "message" to introduce a block of text. I'll point out
that this isn't really a message, as it's lacking headers. I suggest
using "text:" instead of "message".
You are not one of the people I regularly correspond with.
I have deleted your message due to the large volume of
email I regularly receive. If you feel that you need to
speak with me directly, and cannot find your answer in my
web pages, please send mail with the word "URGENT" in the
subject line. Thank you for your time.