ts-fusion-parser
Version:
Parser for Neos Fusion Files
33 lines (32 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FusionFile = void 0;
const VisitableAbstractNode_1 = require("./VisitableAbstractNode");
const AbstractNode_1 = require("../../common/AbstractNode");
class FusionFile extends VisitableAbstractNode_1.VisitableAbstractNode {
constructor(statementList, contextPathAndFileName) {
super({
begin: -1,
end: -1
});
this.nodesByType = new Map();
this.errors = [];
this.statementList = statementList;
AbstractNode_1.AbstractNode.setParentOfNode(this.statementList, this);
this.contextPathAndFileName = contextPathAndFileName;
}
visit(visitor) {
return visitor.visitFusionFile(this);
}
getNodesByType(type) {
const nodes = this.nodesByType.get(type);
return nodes !== undefined ? nodes : undefined;
}
hasErrors() {
return this.errors.length > 0;
}
toString(intend = 0) {
return this.statementList.toString(intend);
}
}
exports.FusionFile = FusionFile;