UNPKG

ts-fusion-parser

Version:

Parser for Neos Fusion Files

29 lines (28 loc) 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DslExpressionValue = void 0; const AbstractNode_1 = require("../../common/AbstractNode"); const lexer_1 = require("../../dsl/afx/lexer"); const parser_1 = require("../../dsl/afx/parser"); const AbstractPathValue_1 = require("./AbstractPathValue"); class DslExpressionValue extends AbstractPathValue_1.AbstractPathValue { constructor(identifier, code, position, afxParserOptions) { super(code, position); this.htmlNodes = []; this.identifier = identifier; this.afxParserOptions = afxParserOptions; } parse() { const lexer = new lexer_1.Lexer(this.value); const parser = new parser_1.Parser(lexer, this.position.begin + this.identifier.length + 1, this.afxParserOptions); // +1 because of [`] in afx`...` this.htmlNodes = parser.parse(); for (const htmlNode of this.htmlNodes) { AbstractNode_1.AbstractNode.setParentOfNode(htmlNode, this); } return parser.nodesByType; } visit(visitor, ...args) { return visitor.visitDslExpressionValue(this, args.shift()); } } exports.DslExpressionValue = DslExpressionValue;