mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +03:00
drop sieve parser from sievescripts branch
This commit is contained in:
parent
2024088ea0
commit
ca91a6e408
18 changed files with 1 additions and 2138 deletions
|
|
@ -1,48 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5173
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class Body extends Grammar.Test
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('body');
|
||||
this.body_transform = ''; // :raw, :content <string-list>, :text
|
||||
this.key_list = new Grammar.StringList;
|
||||
}
|
||||
|
||||
get require() { return 'body'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'body'
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.body_transform
|
||||
+ ' ' + this.key_list.toString();
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach((arg, i) => {
|
||||
if (':raw' === arg || ':text' === arg) {
|
||||
this.body_transform = arg;
|
||||
} else if (arg instanceof Grammar.StringList || arg instanceof Grammar.StringType) {
|
||||
if (':content' === args[i-1]) {
|
||||
this.body_transform = ':content ' + arg;
|
||||
} else {
|
||||
this[args[i+1] ? 'content_list' : 'key_list'] = arg;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Sieve.Commands.body = Body;
|
||||
|
||||
})(this.Sieve);
|
||||
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5183
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class Environment extends Grammar.Test
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('environment');
|
||||
this.name = new Grammar.QuotedString;
|
||||
this.key_list = new Grammar.StringList;
|
||||
}
|
||||
|
||||
get require() { return 'environment'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'body'
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.name
|
||||
+ ' ' + this.key_list.toString();
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.name = args[args.length-2];
|
||||
this.key_list = args[args.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
Sieve.Commands.environment = Environment;
|
||||
|
||||
})(this.Sieve);
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5229
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class Set extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('set');
|
||||
this.modifiers = [];
|
||||
this._name = new Grammar.QuotedString;
|
||||
this._value = new Grammar.QuotedString;
|
||||
}
|
||||
|
||||
get require() { return 'variables'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'set'
|
||||
+ ' ' + this.modifiers.join(' ')
|
||||
+ ' ' + this._name
|
||||
+ ' ' + this._value;
|
||||
}
|
||||
|
||||
get name() { return this._name.value; }
|
||||
set name(str) { this._name.value = str; }
|
||||
|
||||
get value() { return this._value.value; }
|
||||
set value(str) { this._value.value = str; }
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
[':lower', ':upper', ':lowerfirst', ':upperfirst', ':quotewildcard', ':length'].forEach(modifier => {
|
||||
args.includes(modifier) && this.modifiers.push(modifier);
|
||||
});
|
||||
this._name = args[args.length-2];
|
||||
this._value = args[args.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
class String extends Grammar.Test
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('string');
|
||||
this.source = new Grammar.StringList;
|
||||
this.key_list = new Grammar.StringList;
|
||||
}
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'string'
|
||||
+ ' ' + this.match_type
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.source.toString()
|
||||
+ ' ' + this.key_list.toString();
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.source = args[args.length-2];
|
||||
this.key_list = args[args.length-1];
|
||||
}
|
||||
}
|
||||
|
||||
Sieve.Commands.set = Set;
|
||||
Sieve.Commands.string = String;
|
||||
|
||||
})(this.Sieve);
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5230
|
||||
* https://tools.ietf.org/html/rfc6131
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class Vacation extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('vacation');
|
||||
this._days = new Grammar.Number;
|
||||
// this._seconds = new Grammar.Number;
|
||||
this._subject = new Grammar.QuotedString;
|
||||
this._from = new Grammar.QuotedString;
|
||||
this.addresses = new Grammar.StringList;
|
||||
this.mime = false;
|
||||
this._handle = new Grammar.QuotedString;
|
||||
this._reason = new Grammar.QuotedString; // QuotedString / MultiLine
|
||||
}
|
||||
|
||||
// get require() { return ['vacation','vacation-seconds']; }
|
||||
get require() { return 'vacation'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
let result = 'vacation';
|
||||
if (0 < this._days.value) {
|
||||
result += ' :days ' + this._days;
|
||||
// } else if (0 < this._seconds.value) {
|
||||
// result += ' :seconds ' + this._seconds;
|
||||
}
|
||||
if (this._subject.length) {
|
||||
result += ' :subject ' + this._subject;
|
||||
}
|
||||
if (this._from.length) {
|
||||
result += ' :from ' + this.arguments[':from'];
|
||||
}
|
||||
if (this.addresses.length) {
|
||||
result += ' :addresses ' + this.addresses.toString();
|
||||
}
|
||||
if (this.mime) {
|
||||
result += ' :mime';
|
||||
}
|
||||
if (this._handle.length) {
|
||||
result += ' :handle ' + this._handle;
|
||||
}
|
||||
return result + ' ' + this._reason;
|
||||
}
|
||||
|
||||
get days() { return this._days.value; }
|
||||
// get seconds() { return this._seconds.value; }
|
||||
get subject() { return this._subject.value; }
|
||||
get from() { return this._from.value; }
|
||||
get handle() { return this._handle.value; }
|
||||
get reason() { return this._reason.value; }
|
||||
|
||||
set days(int) { this._days.value = int; }
|
||||
// set seconds(int) { this._seconds.value = int; }
|
||||
set subject(str) { this._subject.value = str; }
|
||||
set from(str) { this._from.value = str; }
|
||||
set handle(str) { this._handle.value = str; }
|
||||
set reason(str) { this._reason.value = str; }
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach((arg, i) => {
|
||||
if (':mime' === arg) {
|
||||
this.mime = true;
|
||||
} else if (i === args.length-1) {
|
||||
this._reason.value = arg.value; // Grammar.QuotedString
|
||||
} else switch (args[i-1]) {
|
||||
case ':days':
|
||||
this._days.value = arg.value; // Grammar.Number
|
||||
break;
|
||||
// case ':seconds':
|
||||
// this._seconds.value = arg.value; // Grammar.Number
|
||||
// break;
|
||||
case ':subject':
|
||||
this._subject.value = arg.value; // Grammar.QuotedString
|
||||
break;
|
||||
case ':from':
|
||||
this._from.value = arg.value; // Grammar.QuotedString
|
||||
break;
|
||||
case ':addresses':
|
||||
this.addresses = arg; // Grammar.StringList
|
||||
break;
|
||||
case ':handle':
|
||||
this._from.value = arg.value; // Grammar.QuotedString
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Sieve.Commands.vacation = Vacation;
|
||||
|
||||
})(this.Sieve);
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5232
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class Flag extends Grammar.Command
|
||||
{
|
||||
constructor(identifier)
|
||||
{
|
||||
super(identifier);
|
||||
this._variablename = new Grammar.QuotedString;
|
||||
this.list_of_flags = new Grammar.StringList;
|
||||
}
|
||||
|
||||
get require() { return 'imap4flags'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return this.identifier + ' ' + this._variablename + ' ' + this.list_of_flags.toString() + ';';
|
||||
}
|
||||
|
||||
get variablename()
|
||||
{
|
||||
return this._variablename.value;
|
||||
}
|
||||
|
||||
set variablename(value)
|
||||
{
|
||||
this._variablename.value = value;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
if (args[1]) {
|
||||
if (args[0] instanceof Grammar.QuotedString) {
|
||||
this._variablename = args[0];
|
||||
}
|
||||
if (args[1] instanceof Grammar.StringType) {
|
||||
this.list_of_flags = args[1];
|
||||
}
|
||||
} else if (args[0] instanceof Grammar.StringType) {
|
||||
this.list_of_flags = args[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SetFlag extends Flag
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('setflag');
|
||||
}
|
||||
}
|
||||
|
||||
class AddFlag extends Flag
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('addflag');
|
||||
}
|
||||
}
|
||||
|
||||
class RemoveFlag extends Flag
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('removeflag');
|
||||
}
|
||||
}
|
||||
|
||||
class HasFlag extends Grammar.Test
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('hasflag');
|
||||
this.variable_list = new Grammar.StringList;
|
||||
this.list_of_flags = new Grammar.StringList;
|
||||
}
|
||||
|
||||
get require() { return 'imap4flags'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'hasflag'
|
||||
+ ' ' + this.match_type
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.variable_list.toString()
|
||||
+ ' ' + this.list_of_flags.toString();
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach((arg, i) => {
|
||||
if (arg instanceof Grammar.StringList || arg instanceof Grammar.StringType) {
|
||||
this[args[i+1] ? 'variable_list' : 'list_of_flags'] = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(Sieve.Commands, {
|
||||
setflag: SetFlag,
|
||||
addflag: AddFlag,
|
||||
removeflag: RemoveFlag,
|
||||
hasflag: HasFlag
|
||||
// mark and unmark never made it into the RFC
|
||||
});
|
||||
|
||||
})(this.Sieve);
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5235
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class SpamTest extends Grammar.Test
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('spamtest');
|
||||
this.percent = false, // 0 - 100 else 0 - 10
|
||||
this.value = new Grammar.QuotedString;
|
||||
}
|
||||
|
||||
// get require() { return this.percent ? 'spamtestplus' : 'spamtest'; }
|
||||
get require() { return /:value|:count/.test(this.match_type) ? ['spamtestplus','relational'] : 'spamtestplus'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'spamtest'
|
||||
+ (this.percent ? ' :percent' : '')
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.value;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach(arg => {
|
||||
if (':percent' === arg) {
|
||||
this.percent = true;
|
||||
} else if (arg instanceof Grammar.StringType) {
|
||||
this.value = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class VirusTest extends Grammar.Test
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('virustest');
|
||||
this.value = new Grammar.QuotedString; // 1 - 5
|
||||
}
|
||||
|
||||
get require() { return /:value|:count/.test(this.match_type) ? ['virustest','relational'] : 'virustest'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'virustest'
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.value;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
args.forEach(arg => {
|
||||
if (arg instanceof Grammar.StringType) {
|
||||
this.value = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(Sieve.Commands, {
|
||||
spamtest: SpamTest,
|
||||
virustest: VirusTest
|
||||
});
|
||||
|
||||
|
||||
})(this.Sieve);
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5260
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class DateTest extends Grammar.Test
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('date');
|
||||
this.zone = new Grammar.QuotedString;
|
||||
this.originalzone = false;
|
||||
this.header_name = new Grammar.QuotedString;
|
||||
this.date_part = new Grammar.QuotedString;
|
||||
this.key_list = new Grammar.StringList;
|
||||
// rfc5260#section-6
|
||||
this.index = new Grammar.Number;
|
||||
this.last = false;
|
||||
}
|
||||
|
||||
// get require() { return ['date','index']; }
|
||||
get require() { return 'date'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'date'
|
||||
+ (this.last ? ' :last' : (this.index.value ? ' :index ' + this.index : ''))
|
||||
+ (this.originalzone ? ' :originalzone' : (this.zone.length ? ' :zone ' + this.zone : ''))
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.header_name
|
||||
+ ' ' + this.date_part
|
||||
+ ' ' + this.key_list.toString();
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
let l = args.length - 1;
|
||||
args.forEach((arg, i) => {
|
||||
if (':originalzone' === arg) {
|
||||
this.originalzone = true;
|
||||
} else if (':last' === arg) {
|
||||
this.last = true;
|
||||
} else if (':zone' === args[i-1]) {
|
||||
this.zone.value = arg.value;
|
||||
} else if (':index' === args[i-1]) {
|
||||
this.index.value = arg.value;
|
||||
} else if (l-2 === i) {
|
||||
this.header_name = arg;
|
||||
} else if (l-1 === i) {
|
||||
this.date_part = arg;
|
||||
} else if (l === i) {
|
||||
this.key_list = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class CurrentDate extends Grammar.Test
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('date');
|
||||
this.zone = new Grammar.QuotedString;
|
||||
this.date_part = new Grammar.QuotedString;
|
||||
this.key_list = new Grammar.StringList;
|
||||
}
|
||||
|
||||
get require() { return 'date'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'date'
|
||||
+ (this.zone.length ? ' :zone ' + this.zone : '')
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.date_part
|
||||
+ ' ' + this.key_list.toString();
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
let l = args.length - 1;
|
||||
args.forEach((arg, i) => {
|
||||
if (':zone' === args[i-1]) {
|
||||
this.zone.value = arg.value;
|
||||
} else if (l-1 === i) {
|
||||
this.date_part = arg;
|
||||
} else if (l === i) {
|
||||
this.key_list = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Sieve.Commands.date = DateTest;
|
||||
Sieve.Commands.currentdate = CurrentDate;
|
||||
|
||||
})(this.Sieve);
|
||||
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5293
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class AddHeader extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('addheader');
|
||||
this.last = false;
|
||||
this.field_name = new Grammar.QuotedString;
|
||||
this.value = new Grammar.QuotedString;
|
||||
}
|
||||
|
||||
get require() { return 'editheader'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return this.identifier
|
||||
+ (this.last ? ' :last' : '')
|
||||
+ ' ' + this.field_name
|
||||
+ ' ' + this.value + ';';
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
this.last = args.includes(':last');
|
||||
this.field_name = args[args.length - 2];
|
||||
this.value = args[args.length - 1];
|
||||
}
|
||||
}
|
||||
|
||||
class DeleteHeader extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('deleteheader');
|
||||
this.index = new Grammar.Number;
|
||||
this.last = false;
|
||||
this.comparator = '',
|
||||
this.match_type = ':is',
|
||||
this.field_name = new Grammar.QuotedString;
|
||||
this.value_patterns = new Grammar.StringList;
|
||||
}
|
||||
|
||||
get require() { return 'editheader'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return this.identifier
|
||||
+ (this.last ? ' :last' : (this.index.value ? ' :index ' + this.index : ''))
|
||||
+ (this.comparator ? ' :comparator ' + this.comparator : '')
|
||||
+ ' ' + this.match_type
|
||||
+ ' ' + this.field_name
|
||||
+ ' ' + this.value_patterns + ';';
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
let l = args.length - 1;
|
||||
args.forEach((arg, i) => {
|
||||
if (':last' === arg) {
|
||||
this.last = true;
|
||||
} else if (':index' === args[i-1]) {
|
||||
this.index.value = arg.value;
|
||||
args[i] = null;
|
||||
}
|
||||
});
|
||||
|
||||
if (args[l-1] instanceof Grammar.StringType) {
|
||||
this.field_name = args[l-1];
|
||||
this.value_patterns = args[l];
|
||||
} else {
|
||||
this.field_name = args[l];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(Sieve.Commands, {
|
||||
addheader: AddHeader,
|
||||
deleteheader: DeleteHeader
|
||||
});
|
||||
|
||||
})(this.Sieve);
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc5429
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
/**
|
||||
* https://tools.ietf.org/html/rfc5429#section-2.1
|
||||
*/
|
||||
class Ereject extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('ereject');
|
||||
this._reason = new Grammar.QuotedString;
|
||||
}
|
||||
|
||||
get require() { return 'ereject'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'ereject ' + this._reason + ';';
|
||||
}
|
||||
|
||||
get reason()
|
||||
{
|
||||
return this._reason.value;
|
||||
}
|
||||
|
||||
set reason(value)
|
||||
{
|
||||
this._reason.value = value;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
if (args[0] instanceof Grammar.StringType) {
|
||||
this._reason = args[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* https://tools.ietf.org/html/rfc5429#section-2.2
|
||||
*/
|
||||
class Reject extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('reject');
|
||||
this._reason = new Grammar.QuotedString;
|
||||
}
|
||||
|
||||
get require() { return 'reject'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'reject ' + this._reason + ';';
|
||||
}
|
||||
|
||||
get reason()
|
||||
{
|
||||
return this._reason.value;
|
||||
}
|
||||
|
||||
set reason(value)
|
||||
{
|
||||
this._reason.value = value;
|
||||
}
|
||||
|
||||
pushArguments(args)
|
||||
{
|
||||
if (args[0] instanceof Grammar.StringType) {
|
||||
this._reason = args[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Sieve.Commands.ereject = Ereject;
|
||||
Sieve.Commands.reject = Reject;
|
||||
|
||||
})(this.Sieve);
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
/**
|
||||
* https://tools.ietf.org/html/rfc6609
|
||||
*/
|
||||
|
||||
(Sieve => {
|
||||
|
||||
const Grammar = Sieve.Grammar;
|
||||
|
||||
class Include extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('include');
|
||||
this.global = false; // ':personal' / ':global';
|
||||
this.once = false;
|
||||
this.optional = false;
|
||||
this.value = new Grammar.QuotedString;
|
||||
}
|
||||
|
||||
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 Grammar.QuotedString) {
|
||||
this.value = arg;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class Return extends Grammar.Command
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super('return');
|
||||
}
|
||||
|
||||
get require() { return 'include'; }
|
||||
|
||||
toString()
|
||||
{
|
||||
return 'return;';
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(Sieve.Commands, {
|
||||
include: Include,
|
||||
return: Return
|
||||
});
|
||||
|
||||
})(this.Sieve);
|
||||
Loading…
Add table
Add a link
Reference in a new issue