Fix some Sieve parser issues

This commit is contained in:
the-djmaze 2024-01-03 01:47:52 +01:00
parent 62639acc5a
commit f3935b1df4
3 changed files with 6 additions and 5 deletions

View file

@ -18,9 +18,9 @@ import {
*/ */
export class ConditionalCommand extends ControlCommand export class ConditionalCommand extends ControlCommand
{ {
constructor() constructor(identifier)
{ {
super(); super(identifier);
this.test = null; this.test = null;
} }

View file

@ -23,7 +23,8 @@ class FlagCommand extends ActionCommand
toString() toString()
{ {
return this.identifier + ' ' + this._variablename + ' ' + this.list_of_flags + ';'; let name = this._variablename;
return this.identifier + (name.length ? ' ' + this.variablename : '') + ' ' + this.list_of_flags + ';';
} }
get variablename() get variablename()

View file

@ -196,7 +196,7 @@ export class GrammarTestList extends Array
// return '(\r\n\t' + arrayToString(this, ',\r\n\t') + '\r\n)'; // return '(\r\n\t' + arrayToString(this, ',\r\n\t') + '\r\n)';
return '(' + this.join(', ') + ')'; return '(' + this.join(', ') + ')';
} }
return this.length ? this[0] : ''; return this.length ? this[0].toString() : '';
} }
push(value) push(value)
@ -254,7 +254,7 @@ export class GrammarStringList extends Array
if (1 < this.length) { if (1 < this.length) {
return '[' + this.join(',') + ']'; return '[' + this.join(',') + ']';
} }
return this.length ? this[0] : ''; return this.length ? this[0].toString() : '';
} }
push(value) push(value)