Added draft code for handling "require []"

This commit is contained in:
djmaze 2021-01-15 00:14:45 +01:00
parent d9865e3a46
commit 43c669e629
8 changed files with 36 additions and 9 deletions

View file

@ -15,9 +15,10 @@ class Body extends Grammar.Test
this.match_type = ':is',
this.body_transform = ''; // :raw, :content <string-list>, :text
this.key_list = new Grammar.StringList;
// this.require = 'body';
}
get require() { return 'body'; }
toString()
{
return 'body'

View file

@ -20,9 +20,10 @@ class Vacation extends Grammar.Command
':handle' : new Grammar.QuotedString
};
this.reason = ''; // QuotedString / MultiLine
// this.require = 'vacation';
}
get require() { return 'vacation'; }
toString()
{
let result = 'vacation';

View file

@ -13,9 +13,10 @@ class Flag extends Grammar.Command
super(identifier);
this._variablename = new Grammar.QuotedString;
this.list_of_flags = new Grammar.StringList;
// this.require = 'imap4flags';
}
get require() { return 'imap4flags'; }
toString()
{
return this.identifier + ' ' + this._variablename + ' ' + this.list_of_flags + ';';
@ -79,9 +80,10 @@ class HasFlag extends Grammar.Test
this.match_type = ':is',
this.variable_list = new Grammar.StringList;
this.list_of_flags = new Grammar.StringList;
// this.require = 'imap4flags';
}
get require() { return 'imap4flags'; }
toString()
{
return 'hasflag'

View file

@ -15,9 +15,12 @@ class SpamTest extends Grammar.Test
this.comparator = 'i;ascii-casemap',
this.match_type = ':is',
this.value = new Grammar.QuotedString;
// this.require = this.percent ? 'spamtestplus' : 'spamtest';
}
// get require() { return this.percent ? 'spamtestplus' : 'spamtest'; }
// get require() { return /:value|:count/.test(this.match_type) ? 'relational' : ''; }
get require() { return 'spamtestplus'; }
toString()
{
return 'spamtest'
@ -56,9 +59,11 @@ class VirusTest extends Grammar.Test
this.comparator = 'i;ascii-casemap',
this.match_type = ':is',
this.value = new Grammar.QuotedString; // 1 - 5
// this.require = 'virustest';
}
// get require() { return /:value|:count/.test(this.match_type) ? ['virustest','relational'] : 'virustest'; }
get require() { return 'virustest'; }
toString()
{
return 'virustest'

View file

@ -15,9 +15,10 @@ class Ereject extends Grammar.Command
{
super('ereject');
this._reason = new Grammar.QuotedString;
// this.require = 'ereject';
}
get require() { return 'ereject'; }
toString()
{
return 'ereject ' + this._reason + ';';
@ -50,9 +51,10 @@ class Reject extends Grammar.Command
{
super('reject');
this._reason = new Grammar.QuotedString;
// this.require = 'reject';
}
get require() { return 'reject'; }
toString()
{
return 'reject ' + this._reason + ';';