ts-fusion-parser
Version:
Parser for Neos Fusion Files
53 lines (49 loc) • 997 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const lexer_1 = require("./dsl/afx/lexer");
const parser_1 = require("./dsl/afx/parser");
const simpleText = `
asfd <
`;
const singleSelfClosing = `
<image />
`;
const singleClosing = `
<div>asf</div>
`;
const singleClosingWithAttributes = `
<div enabled true=true test="attribute value" >asf</div>
More Text
`;
const html = `
<html>
<body>
<h1 style="font-size:300%;" >This is a heading</h1>
<p style="font-size:160%;" >This is a paragraph.</p>
</body>
</html>
`;
const afx = `
<div>
<!--
<a />
-->
<test-a />
</div>
`;
const notWorking = `
<div class="asdf" {...props.testClass}>
before
{props.}
after
</div>
<div>
`;
const parser = new parser_1.Parser(new lexer_1.Lexer(notWorking), undefined, {
allowUnclosedTags: true,
eelParserOptions: {
allowIncompleteObjectPaths: true
}
});
let nodes = parser.parse();
console.log(nodes.map((node) => node.toString()).join("\n"));