UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

33 lines 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createUnknownValue = exports.calculateNodeSyntaxErrors = void 0; const errors_1 = require("../errors"); const utils_1 = require("../utils"); const constants_1 = require("../constants"); function calculateNodeSyntaxErrors(program, node) { const text = (0, utils_1.getNodeValue)(program, node); if (text === '') return []; const errorList = []; node.cursor().iterate((n) => { if (n.type.isError) { const textError = (0, utils_1.getNodeValue)(program, n); if (textError !== '') { errorList.push(new errors_1.UnknownTokenError(createUnknownValue(n, textError))); } } }); return errorList; } exports.calculateNodeSyntaxErrors = calculateNodeSyntaxErrors; function createUnknownValue({ from, to }, text = '') { return { type: constants_1.AST_TYPES.unknown, from, to, text, primitive: constants_1.AST_PRIMITIVES.UNKNOWN, }; } exports.createUnknownValue = createUnknownValue; //# sourceMappingURL=syntax-errors.js.map