HEX
Server: LiteSpeed
System: Linux s3604.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: dmstechonline (1480)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/dmstechonline/whatsapp.dmstech.online/node_modules/yaml-eslint-parser/lib/yaml-cst-parse.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAllDocsToCST = void 0;
const yaml_1 = require("yaml");
/** Parse yaml to CST */
function parseAllDocsToCST(ctx) {
    const parser = new yaml_1.Parser();
    const composer = new yaml_1.Composer(Object.assign(Object.assign({}, ctx.options), { keepSourceTokens: true }));
    const cstNodes = [];
    const nodes = [];
    /**
     * Process for Document
     */
    function processDoc(node) {
        for (const error of node.errors) {
            throw ctx.throwError(error.message, error.pos[0]);
        }
        // ignore warns
        // for (const error of doc.warnings) {
        //     throw ctx.throwError(error.message, error.pos[0])
        // }
        nodes.push(node);
    }
    for (const cst of parser.parse(ctx.code)) {
        cstNodes.push(cst);
        for (const doc of composer.next(cst)) {
            processDoc(doc);
        }
    }
    for (const doc of composer.end()) {
        processDoc(doc);
    }
    return { nodes, cstNodes, streamInfo: composer.streamInfo() };
}
exports.parseAllDocsToCST = parseAllDocsToCST;