mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 05:59:21 +03:00
Added Sieve parser code in master
This commit is contained in:
parent
e90e8a55ce
commit
f4cd25f8ad
21 changed files with 2126 additions and 8 deletions
47
dev/Sieve/Extensions/rfc6609.js
Normal file
47
dev/Sieve/Extensions/rfc6609.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc6609
|
||||
*/
|
||||
|
||||
import {
|
||||
GrammarCommand,
|
||||
GrammarQuotedString
|
||||
} from 'Sieve/Grammar';
|
||||
|
||||
export class IncludeCommand extends GrammarCommand
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
this.global = false; // ':personal' / ':global';
|
||||
this.once = false;
|
||||
this.optional = false;
|
||||
this.value = new GrammarQuotedString;
|
||||
}
|
||||
|
||||
get require() { return 'include'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return this.identifier
|
||||
+ (this.global ? ' :global' : '')
|
||||
+ (this.once ? ' :once' : '')
|
||||
+ (this.optional ? ' :optional' : '')
|
||||
+ ' ' + this.value + ';';
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach(arg => {
|
||||
if (':global' === arg || ':once' === arg || ':optional' === arg) {
|
||||
this[arg.substr(1)] = true;
|
||||
} else if (arg instanceof GrammarQuotedString) {
|
||||
this.value = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class ReturnCommand extends GrammarCommand
|
||||
{
|
||||
get require() { return 'include'; }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue