Class SieveProduction.

Inherits Garbage. Inherited by SieveArgument, SieveArgumentList, SieveBlock, SieveCommand, SieveScript and SieveTest.

The SieveProduction class is the common base class for SieveArgument, SieveCommand and the other classes that describe a single production in the Sieve grammar (or lexer). The "start" symbol is represented by SieveScript.

SieveProduction does very little except remember where in the source it comes from, so errors can be reported well.

SieveProduction::SieveProduction( const char * name )

Constructs a SieveProduction for a production whose sieve name is name.

void SieveProduction::addExtensions( const EStringList * list )

Records that the list of extensions are available in this production and its children.

EStringList * SieveProduction::addedExtensions() const

Returns a pointer to a list of extensions added by ihave or require, or a null pointer if none have been added.

uint SieveProduction::end() const

Returns what setEnd() set, or 0.

EString SieveProduction::error() const

Returns what setError() set, or an empty string if no error has occured.

bool SieveProduction::ihaveFailed() const

Returns true if (some) errors must be suppressed because this production or a child of it might use unsupported extensions.

EString SieveProduction::name() const

Returns the name of this production as defined in RFC 5228 section 8.

SieveProduction * SieveProduction::parent() const

Returns a pointer to this object's parent, or a null pointer if none has been set.

void SieveProduction::require( const EString & extension )

Records that the sieve script requires extension. Should be called whenever a part of the parser sees that the input depends on a given extension. SieveScript::parse() checks that the "require" names this set of extensions.

void SieveProduction::setEnd( uint p )

Notifies this SieveProduction that its parsing ended at position p. The first character in the source is 0, and we count bytes, not lines.

void SieveProduction::setError( const EString & e )

Records that this production suffers from error e. Does nothing if setError has been called already.

void SieveProduction::setIhaveFailed()

Records that an ihave test will fail when executed, so this production (or a child) might contain unknown extensions.

void SieveProduction::setParent( SieveProduction * parent )

Notifies this SieveProduction that it's a child of parent. The parent() is used to construct error messages.

void SieveProduction::setParser( SieveParser * p )

This slightly hacky function records that the production was parsed by p, and p should also be used to report any errors this object might have. Could have been done as a constructor argument, but I've already written the constructors and I don't want to do all the editing.

The initial value is 0.

void SieveProduction::setStart( uint p )

Notifies this SieveProduction that its parsing started at position p. The first character in the source is 0, and we count bytes, not lines.

uint SieveProduction::start() const

Returns what setStart() set, or 0.

static EStringList * SieveProduction::supportedExtensions()

Returns a list of all supported sieve extensions. The list is allocated for the purpose, so the caller can modify it at will.

The extensions are: BODY from RFC 5173. COPY from RFC 3894. DATE from RFC 5260. EREJECT from RFC 5429, IHAVE from RFC 5463. RFC 5228 defines several optional capabilities, we implement all (I think). RELATIONAL is from RFC 5231, SUBADDRESS is from RFC 5233 and VACATION from RFC 5230.

RFC 5260also defines INDEX, which we don't implement, it doesn't seem useful.

This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.