Improved Sieve Script editor with lists of available Actions, Controls and Tests

This commit is contained in:
the-djmaze 2022-03-17 10:21:23 +01:00
parent ff9a89380c
commit f47eb61aee
14 changed files with 269 additions and 164 deletions

View file

@ -3,13 +3,13 @@
*/
import {
GrammarCommand,
ActionCommand,
GrammarQuotedString,
GrammarStringList,
TestCommand
} from 'Sieve/Grammar';
export class SetCommand extends GrammarCommand
export class SetCommand extends ActionCommand
{
constructor()
{

View file

@ -6,13 +6,13 @@
import { capa } from 'Sieve/Utils';
import {
GrammarCommand,
ActionCommand,
GrammarNumber,
GrammarQuotedString,
GrammarStringList
} from 'Sieve/Grammar';
export class VacationCommand extends GrammarCommand
export class VacationCommand extends ActionCommand
{
constructor()
{

View file

@ -3,14 +3,14 @@
*/
import {
GrammarCommand,
ActionCommand,
GrammarQuotedString,
GrammarString,
GrammarStringList,
TestCommand
} from 'Sieve/Grammar';
class FlagCommand extends GrammarCommand
class FlagCommand extends ActionCommand
{
constructor()
{

View file

@ -3,14 +3,14 @@
*/
import {
GrammarCommand,
ActionCommand,
GrammarNumber,
GrammarQuotedString,
GrammarString,
GrammarStringList
} from 'Sieve/Grammar';
export class AddHeaderCommand extends GrammarCommand
export class AddHeaderCommand extends ActionCommand
{
constructor()
{
@ -38,7 +38,7 @@ export class AddHeaderCommand extends GrammarCommand
}
}
export class DeleteHeaderCommand extends GrammarCommand
export class DeleteHeaderCommand extends ActionCommand
{
constructor()
{

View file

@ -3,7 +3,7 @@
*/
import {
GrammarCommand,
ActionCommand,
GrammarQuotedString,
GrammarString
} from 'Sieve/Grammar';
@ -11,7 +11,7 @@ import {
/**
* https://tools.ietf.org/html/rfc5429#section-2.1
*/
export class ErejectCommand extends GrammarCommand
export class ErejectCommand extends ActionCommand
{
constructor()
{
@ -47,7 +47,7 @@ export class ErejectCommand extends GrammarCommand
/**
* https://tools.ietf.org/html/rfc5429#section-2.2
*/
export class RejectCommand extends GrammarCommand
export class RejectCommand extends ActionCommand
{
constructor()
{

View file

@ -3,7 +3,7 @@
*/
import {
GrammarCommand,
ActionCommand,
GrammarNumber,
GrammarQuotedString,
GrammarStringList,
@ -13,7 +13,7 @@ import {
/**
* https://datatracker.ietf.org/doc/html/rfc5435#section-3
*/
export class NotifyCommand extends GrammarCommand
export class NotifyCommand extends ActionCommand
{
constructor()
{

View file

@ -3,7 +3,7 @@
*/
import {
GrammarCommand,
ControlCommand,
TestCommand,
GrammarQuotedString,
GrammarStringList
@ -36,7 +36,7 @@ export class IHaveTest extends TestCommand
/**
* https://datatracker.ietf.org/doc/html/rfc5463#section-5
*/
export class ErrorCommand extends GrammarCommand
export class ErrorCommand extends ControlCommand
{
constructor()
{

View file

@ -3,7 +3,8 @@
*/
import {
GrammarCommand,
ActionCommand,
ControlCommand,
GrammarNumber,
GrammarQuotedString,
GrammarString,
@ -13,7 +14,7 @@ import {
/**
* https://datatracker.ietf.org/doc/html/rfc5703#section-3
*/
export class ForEveryPartCommand extends GrammarCommand
export class ForEveryPartCommand extends ControlCommand
{
constructor()
{
@ -57,7 +58,7 @@ export class BreakCommand extends ForEveryPartCommand
/**
* https://datatracker.ietf.org/doc/html/rfc5703#section-5
*/
export class ReplaceCommand extends GrammarCommand
export class ReplaceCommand extends ActionCommand
{
constructor()
{
@ -103,7 +104,7 @@ export class ReplaceCommand extends GrammarCommand
/**
* https://datatracker.ietf.org/doc/html/rfc5703#section-6
*/
export class EncloseCommand extends GrammarCommand
export class EncloseCommand extends ActionCommand
{
constructor()
{
@ -140,7 +141,7 @@ export class EncloseCommand extends GrammarCommand
/**
* https://datatracker.ietf.org/doc/html/rfc5703#section-7
*/
export class ExtractTextCommand extends GrammarCommand
export class ExtractTextCommand extends ActionCommand
{
constructor()
{

View file

@ -3,11 +3,12 @@
*/
import {
GrammarCommand,
GrammarQuotedString
ControlCommand,
GrammarQuotedString,
GrammarStringList
} from 'Sieve/Grammar';
export class IncludeCommand extends GrammarCommand
export class IncludeCommand extends ControlCommand
{
constructor()
{
@ -22,7 +23,7 @@ export class IncludeCommand extends GrammarCommand
toString()
{
return this.identifier
return 'include'
+ (this.global ? ' :global' : '')
+ (this.once ? ' :once' : '')
+ (this.optional ? ' :optional' : '')
@ -41,7 +42,28 @@ export class IncludeCommand extends GrammarCommand
}
}
export class ReturnCommand extends GrammarCommand
export class ReturnCommand extends ControlCommand
{
get require() { return 'include'; }
}
export class GlobalCommand extends ControlCommand
{
constructor()
{
super();
this.value = new GrammarStringList;
}
get require() { return ['include', 'variables']; }
toString()
{
return 'global ' + this.value + ';';
}
pushArguments(args)
{
this.value = args.pop();
}
}