src/parser.js
function parseTag1(tr) {
    let startToken = tr.getToken();
    let node = initTagNode(startToken);
    while (true) {
        if (tr.accept("text")) {
            node.children.push(parseText(tr));
        } else if (tr.accept("tag_0")) {
            node.children.push(parseTag0(tr));
        } else if (tr.accept("tag_1")) {
            node.children.push(parseTag1(tr));
        } else if (tr.accept("tag_2")) {
            let token = tr.getToken();
            if (token.name !== startToken.name) {
                let msg = `Unexpected closing tag "${token.name}"`;
                throw Tools.syntaxError(msg, token.start);
            }
            return node;
        } else {
            let msg = `Unclosed tag "${startToken.name}"`;
            throw Tools.syntaxError(msg, startToken.start);
        }
    }
}
function parseTag1(tr) {
    let startToken = tr.getToken();
    let node = initTagNode(startToken);
    while (true) {
        if (tr.accept("text")) {
            node.children.push(parseText(tr));
        } else if (tr.accept("tag_0")) {
            node.children.push(parseTag0(tr));
        } else if (tr.accept("tag_1")) {
            node.children.push(parseTag1(tr));
        } else if (tr.accept("tag_2")) {
            let token = tr.getToken();
            if (token.name !== startToken.name) {
                let msg = `Unexpected closing tag "${token.name}"`;
                throw Tools.syntaxError(msg, token.start);
            }
            return node;
        } else {
            let msg = `Unclosed tag "${startToken.name}"`;
            throw Tools.syntaxError(msg, startToken.start);
        }
    }
}
object => object