Inherits AbnfParser
The SieveParser class does all the ABNF-related work for sieve scripts. The SieveProduction class and its subclasses do the other part of parsing: The Sieve ABNF grammar doesn't guarantee that "if" has a test as argument, etc.
Constructs a Sieve parser for s. Doesn't actually do anything; the caller must call commands() or other functions to parse the script.
Reimplements AbnfParser::AbnfParser().
Parses, constructs and returns a SieveArgument object. Never returns 0.
argument = string-list / number / tag
arguments = *argument [test / test-list]
This is tricky. The first difficult bit. This class takes either a list of SieveArgument objects, or a SieveTest, or a list of SieveTest objects. We implement both the arguments and tests productions in this function.
Returns a list of the SieveProduction objects that have been parsed by this object, have errors and have toplevel as their ultimate SieveProduction::parent().
The list may be empty (hopefully that is the common case) but the returned pointer is never null.
block = "{" *command "}"
Parses/skips a bracket comment: bracket-comment = "/" "*" *not-star 1*STAR *(not-star-slash *not-star 1*STAR) "/"
No "*" "/" allowed inside a comment. (No * is allowed unless it is the last character, or unless it is followed by a character that isn't a slash.)
command = identifier arguments ( ";" / block )
commands = *command
start = commands
Never returns a null pointer.
Parses/skips a comment: comment = bracket-comment / hash-comment.
COMPARATOR = ":comparator" string
Returns just the string, not ":comparator" or the whitespace.
Returns a list of the strings specified to rememberNeededExtension(), freed of duplication. The return value is never a null pointer.
Parses/skips a hash-cmment: hash-comment = "#" *octet-not-crlf CRLF
identifier = (ALPHA / "_") *(ALPHA / DIGIT / "_")
Records an error if no identifier is present.
multi-line = "text:" *(SP / HTAB) (hash-comment / CRLF) *(multiline-literal / multiline-dotstuff) "." CRLF
multiline-literal = [octet-not-period *octet-not-crlf] CRLF
multiline-dotstuff = "." 1*octet-not-crlf CRLF
Returns an empty string if the cursor doesn't point at a multi-line string.
number = 1*DIGIT [ QUANTIFIER ]
QUANTIFIER = "K" / "M" / "G"
Returns 0 and calls setError() in case of error.
Reimplements AbnfParser::number().
quoted-string = DQUOTE quoted-text DQUOTE
quoted-text = *(quoted-safe / quoted-special / quoted-other)
quoted-other = "\" octet-not-qspecial
quoted-safe = CRLF / octet-not-qspecial
quoted-special = "\" ( DQUOTE / "\" )
Adds p to the list of bad sieve productions generated by this parser. Provided as a public function because a sieve production may discover its badness long after SieveParser has done its job.
Adds extension to the list of extensions needed by the generated productions. The SieveProduction subclasses call this, ie. using SieveParser as a common storage object.
string = quoted-string / multi-line
string-list = "[" string *("," string) "]" / string
If there is only a single string, the brackets are optional.
Never returns a null pointer.
tag = ":" identifier
test = identifier arguments
Parses and skips whatever whitespace is at pos().
This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.