UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

29 lines 893 B
import { UnknownTokenError } from '../errors'; import { getNodeValue } from '../utils'; import { AST_PRIMITIVES, AST_TYPES } from '../constants'; export function calculateNodeSyntaxErrors(program, node) { const text = getNodeValue(program, node); if (text === '') return []; const errorList = []; node.cursor().iterate((n) => { if (n.type.isError) { const textError = getNodeValue(program, n); if (textError !== '') { errorList.push(new UnknownTokenError(createUnknownValue(n, textError))); } } }); return errorList; } export function createUnknownValue({ from, to }, text = '') { return { type: AST_TYPES.unknown, isValidAggregate: false, from, to, text, primitive: AST_PRIMITIVES.UNKNOWN, }; } //# sourceMappingURL=syntax-errors.js.map