ifc-expressions
Version:
Parsing and evaluation of IFC expressions
36 lines (35 loc) • 861 B
JavaScript
export class ExprStringBuilder {
constructor(startPos) {
this.product = [];
this._startPos = startPos;
this._endPos = startPos;
}
appendString(s) {
this.product.push(s);
this._endPos = this._endPos + s.length;
return this;
}
appendExpr(expr) {
expr.toExprString(this);
return this;
}
appendExprArray(exprs, separator = ",") {
for (let i = 0; i < exprs.length; i++) {
this.appendExpr(exprs[i]);
if (i < exprs.length - 1) {
this.appendString(separator);
}
}
return this;
}
build() {
return this.product.join("");
}
get endPos() {
return this._endPos;
}
get startPos() {
return this._startPos;
}
}
//# sourceMappingURL=ExprStringBuilder.js.map