Documentation
¶
Overview ¶
Package sieve is the top-level façade for the Sieve interpreter.
Typical use:
script, err := sieve.Compile(src)
if err != nil { /* syntax/validation error */ }
if err := script.Run(msg, handler); err != nil { /* runtime error */ }
For one-off validation use Validate. To register additional extensions, use NewInterpreter and access its Registry, then Compile through it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
Handler is the host application's action receiver. Extensions that define additional actions (e.g. fileinto) define richer interfaces in their own packages and type-assert this one.
type Interpreter ¶
type Interpreter = interpreter.Interpreter
Interpreter wraps the registry and core builtins.
func Default ¶
func Default() *Interpreter
Default returns the package-level interpreter used by Compile and Validate. Extension packages call this from their init() to self-register.
func NewInterpreter ¶
func NewInterpreter() *Interpreter
NewInterpreter returns a fresh Interpreter with RFC 5228 builtins registered. Extensions can be added via i.Registry().
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ast defines the Sieve abstract syntax tree.
|
Package ast defines the Sieve abstract syntax tree. |
|
examples
|
|
|
attachments
command
Demonstrates RFC 5703 "mime" extension: filing any message with an attachment into a dedicated folder.
|
Demonstrates RFC 5703 "mime" extension: filing any message with an attachment into a dedicated folder. |
|
simple
command
Command simple shows how a host application embeds the sieve library: parse a script, supply a message, and implement a Handler.
|
Command simple shows how a host application embeds the sieve library: parse a script, supply a message, and implement a Handler. |
|
validate
command
Command validate checks a Sieve script for syntax and semantic errors without running it.
|
Command validate checks a Sieve script for syntax and semantic errors without running it. |
|
extensions
|
|
|
body
Package body implements the Sieve "body" extension (RFC 5173).
|
Package body implements the Sieve "body" extension (RFC 5173). |
|
editheader
Package editheader implements the Sieve "editheader" extension (RFC 5293).
|
Package editheader implements the Sieve "editheader" extension (RFC 5293). |
|
envelope
Package envelope implements the Sieve "envelope" extension (RFC 5228 §5.4).
|
Package envelope implements the Sieve "envelope" extension (RFC 5228 §5.4). |
|
fileinto
Package fileinto implements the Sieve "fileinto" extension (RFC 5232).
|
Package fileinto implements the Sieve "fileinto" extension (RFC 5232). |
|
imap4flags
Package imap4flags implements the Sieve "imap4flags" extension (RFC 5232): the actions `setflag`, `addflag`, `removeflag` and the test `hasflag`.
|
Package imap4flags implements the Sieve "imap4flags" extension (RFC 5232): the actions `setflag`, `addflag`, `removeflag` and the test `hasflag`. |
|
mime
Package mime implements the subset of the Sieve "mime" extension (RFC 5703) that scripts most commonly need: the ":mime" and ":anychild" tags on the existing "header", "address", and "exists" tests.
|
Package mime implements the subset of the Sieve "mime" extension (RFC 5703) that scripts most commonly need: the ":mime" and ":anychild" tags on the existing "header", "address", and "exists" tests. |
|
regex
Package regex implements the Sieve ":regex" match type from draft-ietf-sieve-regex (the "regex" capability).
|
Package regex implements the Sieve ":regex" match type from draft-ietf-sieve-regex (the "regex" capability). |
|
reject
Package reject implements the Sieve "reject" and "ereject" actions (RFC 5429).
|
Package reject implements the Sieve "reject" and "ereject" actions (RFC 5429). |
|
relational
Package relational implements the Sieve "relational" extension (RFC 5231).
|
Package relational implements the Sieve "relational" extension (RFC 5231). |
|
subaddress
Package subaddress implements the Sieve "subaddress" extension (RFC 5233).
|
Package subaddress implements the Sieve "subaddress" extension (RFC 5233). |
|
vacation
Package vacation implements the Sieve "vacation" action (RFC 5230).
|
Package vacation implements the Sieve "vacation" action (RFC 5230). |
|
variables
Package variables implements the Sieve "variables" extension (RFC 5229).
|
Package variables implements the Sieve "variables" extension (RFC 5229). |
|
Package interpreter wires the AST, registry, message, and host Handler together.
|
Package interpreter wires the AST, registry, message, and host Handler together. |
|
Package lexer turns Sieve source text into a stream of tokens.
|
Package lexer turns Sieve source text into a stream of tokens. |
|
Package message defines the abstract view of an email message that Sieve tests and actions consult.
|
Package message defines the abstract view of an email message that Sieve tests and actions consult. |
|
Package parser turns a token stream from package lexer into an ast.Script.
|
Package parser turns a token stream from package lexer into an ast.Script. |
|
Package registry holds the set of Sieve commands, tests, and tagged arguments that an interpreter knows about.
|
Package registry holds the set of Sieve commands, tests, and tagged arguments that an interpreter knows about. |
|
Package token defines the lexical tokens produced by the Sieve lexer.
|
Package token defines the lexical tokens produced by the Sieve lexer. |