@ricsam/formula-engine 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/core/managers/dependency-manager.cjs +15 -17
- package/dist/cjs/core/managers/dependency-manager.cjs.map +3 -3
- package/dist/cjs/core/managers/evaluation-manager.cjs +15 -17
- package/dist/cjs/core/managers/evaluation-manager.cjs.map +3 -3
- package/dist/cjs/evaluator/evaluation-context.cjs +22 -6
- package/dist/cjs/evaluator/evaluation-context.cjs.map +3 -3
- package/dist/cjs/evaluator/formula-evaluator.cjs +3 -3
- package/dist/cjs/evaluator/formula-evaluator.cjs.map +3 -3
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/core/managers/dependency-manager.mjs +15 -17
- package/dist/mjs/core/managers/dependency-manager.mjs.map +3 -3
- package/dist/mjs/core/managers/evaluation-manager.mjs +15 -17
- package/dist/mjs/core/managers/evaluation-manager.mjs.map +3 -3
- package/dist/mjs/evaluator/evaluation-context.mjs +23 -6
- package/dist/mjs/evaluator/evaluation-context.mjs.map +3 -3
- package/dist/mjs/evaluator/formula-evaluator.mjs +3 -3
- package/dist/mjs/evaluator/formula-evaluator.mjs.map +3 -3
- package/dist/mjs/package.json +1 -1
- package/dist/types/core/managers/dependency-manager.d.ts +0 -1
- package/dist/types/evaluator/evaluation-context.d.ts +3 -0
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/evaluator/formula-evaluator.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import type {\n LocalCellAddress,\n RangeAddress,\n SingleEvaluationResult,\n} from \"../core/types.mjs\";\nimport {\n FormulaError,\n type CellAddress,\n type CellValue,\n type FunctionEvaluationResult,\n type SpreadsheetRange,\n type SpreadsheetRangeEnd,\n type TableDefinition,\n} from \"../core/types.mjs\";\nimport { parseFormula } from \"../parser/parser.mjs\";\n\nimport type { DependencyManager } from \"../core/managers/dependency-manager.mjs\";\nimport type { NamedExpressionManager } from \"../core/managers/named-expression-manager.mjs\";\nimport type { TableManager } from \"../core/managers/table-manager.mjs\";\nimport {\n captureEvaluationErrors,\n cellAddressToKey,\n getAbsoluteRange,\n getRangeIntersection,\n getRangeKey,\n getRelativeRange,\n isRangeOneCell,\n rangeAddressToKey,\n} from \"../core/utils.mjs\";\nimport {\n getNamedExpressionResourceKey,\n getSheetResourceKey,\n getTableResourceKey,\n getWorkbookResourceKey,\n} from \"../core/resource-keys.mjs\";\nimport {\n evaluateScalarOperator,\n type EvaluateScalarOperatorOptions,\n} from \"../evaluator/evaluate-scalar-operator.mjs\";\nimport { functions } from \"../functions/function-registry.mjs\";\nimport type {\n ArrayNode,\n ASTNode,\n BinaryOpNode,\n FunctionNode,\n NamedExpressionNode,\n RangeNode,\n ReferenceNode,\n StructuredReferenceNode,\n ThreeDRangeNode,\n UnaryOpNode,\n ValueNode,\n} from \"../parser/ast.mjs\";\nimport { add } from \"./arithmetic/add/add.mjs\";\nimport { divide } from \"./arithmetic/divide/divide.mjs\";\nimport { multiply } from \"./arithmetic/multiply/multiply.mjs\";\nimport { power } from \"./arithmetic/power/power.mjs\";\nimport { subtract } from \"./arithmetic/subtract/subtract.mjs\";\nimport { equals } from \"./comparison/equals.mjs\";\nimport { greaterThan } from \"./comparison/greater-than.mjs\";\nimport { greaterThanOrEqual } from \"./comparison/greater-than-or-equal.mjs\";\nimport { lessThan } from \"./comparison/less-than.mjs\";\nimport { lessThanOrEqual } from \"./comparison/less-than-or-equal.mjs\";\nimport { notEquals } from \"./comparison/not-equals.mjs\";\nimport { concatenate } from \"./concatenation/concatenate.mjs\";\nimport { CellValueNode } from \"./dependency-nodes/cell-value-node.mjs\";\nimport { EvaluationContext } from \"./evaluation-context.mjs\";\n\nexport class FormulaEvaluator {\n constructor(\n private tableManager: TableManager,\n private dependencyManager: DependencyManager,\n private namedExpressionManager: NamedExpressionManager\n ) {}\n\n // evaluator methods\n evaluateFormula(\n /**\n * formula is the formula to evaluate, without the leading =\n */\n formula: string,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const ast = parseFormula(formula);\n\n return captureEvaluationErrors(context.dependencyNode, () => {\n const result = this.evaluateNode(ast, context);\n return result;\n });\n }\n\n evaluateNode(\n node: ASTNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const currentContext = {\n ...context.cellAddress,\n tableName: context.tableName,\n };\n\n const astNode = this.dependencyManager.getAstNode(node, currentContext);\n context.dependencyNode.addDependency(astNode);\n\n // if (astNode.evaluationResult.type !== \"awaiting-evaluation\") {\n // return astNode.evaluationResult;\n // }\n\n if (astNode.resolved) {\n const astContextDependency = astNode.getContextDependency();\n context.appendContextDependency(astContextDependency);\n return astNode.evaluationResult;\n }\n\n this.dependencyManager.unregisterNode(astNode);\n astNode.resetDirectDepsUpdated();\n\n function runEvaluation(\n this: FormulaEvaluator,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n switch (node.type) {\n case \"value\":\n return {\n type: \"value\",\n result: this.evaluateValue(node),\n };\n case \"infinity\":\n return {\n type: \"value\",\n result: {\n type: \"infinity\",\n sign: \"positive\",\n },\n };\n case \"binary-op\":\n return this.evaluateBinaryOp(node, context);\n\n case \"reference\":\n return this.evaluateReference(node, context);\n\n case \"named-expression\":\n return this.evaluateNamedExpression(node, context);\n\n case \"structured-reference\":\n return this.evaluateStructuredReference(node, context);\n\n case \"function\":\n return this.evaluateFunction(node, context);\n\n case \"range\":\n return this.evaluateRange(node, context);\n\n case \"unary-op\":\n return this.evaluateUnaryOp(node, context);\n\n case \"3d-range\":\n return this.evaluate3DRange(node, context);\n\n case \"array\":\n return this.evaluateArray(node, context);\n\n default:\n return {\n type: \"error\",\n err: FormulaError.ERROR,\n message: \"WIP: unimplemented support for \" + node.type,\n errAddress: context.dependencyNode,\n };\n }\n }\n const newContext = new EvaluationContext(\n this.tableManager,\n astNode,\n context.cellAddress\n );\n const result = captureEvaluationErrors(astNode, () =>\n runEvaluation.call(this, newContext)\n );\n astNode.setEvaluationResult(result);\n const astContextDependency = newContext.getContextDependency();\n\n astNode.setContextDependency(astContextDependency);\n this.dependencyManager.registerNode(astNode);\n\n context.appendContextDependency(astContextDependency);\n\n return result;\n }\n\n evaluateStructuredReference(\n node: StructuredReferenceNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const resourceWorkbookName =\n node.workbookName ?? context.cellAddress.workbookName;\n if (node.tableName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getTableResourceKey({\n workbookName: resourceWorkbookName,\n tableName: node.tableName,\n })\n )\n );\n }\n\n // the tables are never dependent on the sheet, interesetingly enough\n let table: TableDefinition | undefined;\n if (node.tableName && node.workbookName) {\n // this expression will evaluate to the same value regardless of where in the workbooks we are evaluating it in\n table = this.tableManager\n .getTables(node.workbookName)\n .get(node.tableName);\n } else if (node.tableName) {\n // different workbooks could have different tables with the same name\n // so it can differ based on the workbook we are evaluating it in\n context.addContextDependency(\"workbook\");\n table = this.tableManager\n .getTables(context.cellAddress.workbookName)\n .get(node.tableName);\n } else {\n // If no table nor workbook name is provided, the current cell's table\n // membership determines the result.\n context.addContextDependency(\"workbook\", \"table\");\n table = this.tableManager.isCellInTable(context.cellAddress);\n }\n\n if (node.isCurrentRow) {\n context.addContextDependency(\"row\");\n }\n\n if (!table) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Table ${node.tableName} not found`,\n errAddress: context.dependencyNode,\n };\n }\n\n const rowIndex = context.cellAddress.rowIndex;\n const tableStart = table.start;\n\n // Handle selector-based references\n if (node.selector) {\n let startRow: number;\n let endRow: SpreadsheetRangeEnd;\n\n switch (node.selector) {\n case \"#Headers\":\n startRow = table.start.rowIndex;\n endRow = { type: \"number\", value: table.start.rowIndex };\n break;\n case \"#Data\":\n startRow = table.start.rowIndex + 1;\n endRow = table.endRow;\n break;\n case \"#All\":\n startRow = table.start.rowIndex;\n endRow = table.endRow;\n break;\n default:\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Unknown table selector: ${node.selector}`,\n errAddress: context.dependencyNode,\n };\n }\n\n // If we also have column specification, use those columns\n if (node.cols) {\n const startCol = table.headers.get(node.cols.startCol);\n const endCol = table.headers.get(node.cols.endCol);\n if (!startCol || !endCol) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Column ${node.cols.startCol} or ${node.cols.endCol} not found in table ${table.name}`,\n errAddress: context.dependencyNode,\n };\n }\n const startColIndex = tableStart.colIndex + startCol.index;\n const endColIndex = tableStart.colIndex + endCol.index;\n\n const range: SpreadsheetRange = {\n start: {\n row: startRow,\n col: startColIndex,\n },\n end: {\n row: endRow,\n col: { type: \"number\", value: endColIndex },\n },\n };\n\n return this.evaluateRange(\n {\n type: \"range\",\n range,\n isAbsolute: {\n start: {\n col: true,\n row: true,\n },\n end: {\n col: true,\n row: true,\n },\n },\n sheetName: table.sheetName,\n },\n context\n );\n } else {\n // No column specification, return entire row(s) for the selector\n const range: SpreadsheetRange = {\n start: {\n row: startRow,\n col: tableStart.colIndex,\n },\n end: {\n row: endRow,\n col: {\n type: \"number\",\n value: tableStart.colIndex + table.headers.size - 1,\n },\n },\n };\n\n return this.evaluateRange(\n {\n type: \"range\",\n range,\n isAbsolute: {\n start: {\n col: true,\n row: true,\n },\n end: {\n col: true,\n row: true,\n },\n },\n sheetName: table.sheetName,\n },\n context\n );\n }\n }\n\n // Handle column-only references (no selector)\n if (node.cols) {\n const startCol = table.headers.get(node.cols.startCol);\n const endCol = table.headers.get(node.cols.endCol);\n if (!startCol || !endCol) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Column ${node.cols.startCol} or ${node.cols.endCol} not found in table ${table.name}`,\n errAddress: context.dependencyNode,\n };\n }\n const startColIndex = tableStart.colIndex + startCol.index;\n const endColIndex = tableStart.colIndex + endCol.index;\n const range: SpreadsheetRange = {\n start: {\n row: node.isCurrentRow ? rowIndex : table.start.rowIndex + 1,\n col: startColIndex,\n },\n end: {\n row: node.isCurrentRow\n ? { type: \"number\", value: rowIndex }\n : table.endRow,\n col: { type: \"number\", value: endColIndex },\n },\n };\n\n return this.evaluateRange(\n {\n type: \"range\",\n range,\n isAbsolute: {\n start: {\n col: true,\n row: true,\n },\n end: {\n col: true,\n row: true,\n },\n },\n sheetName: table.sheetName,\n },\n context\n );\n }\n\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Structured reference must specify either a selector or columns\",\n errAddress: context.dependencyNode,\n };\n }\n\n /**\n * Evaluates a value node\n */\n evaluateValue(node: ValueNode): CellValue {\n return node.value;\n }\n\n evaluate3DRange(\n node: ThreeDRangeNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n throw new Error(\"WIP: 3d range is not implemented\");\n /*\n const startSheet = this.sheets.get(node.startSheet);\n const endSheet = this.sheets.get(node.endSheet);\n if (!startSheet || !endSheet) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Sheet ${node.startSheet} or ${node.endSheet} not found`,\n };\n }\n\n let numCols = 0;\n let numRows = 0;\n for (let i = startSheet.index; i <= endSheet.index; i++) {\n if (node.reference.type === \"reference\") {\n numCols += 1;\n } else {\n numCols += node.reference.range.end.col.value - node.reference.range.start.col.value + 1;\n }\n\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Sheet ${i} not found`,\n };\n }\n\n return {\n type: \"spilled-values\",\n spillArea: (origin: CellAddress) => ({\n start: {\n col: origin.colIndex,\n row: origin.rowIndex,\n },\n end: {\n col: { type: \"number\", value: origin.colIndex },\n row: {\n type: \"number\",\n value: origin.rowIndex + numSheets - 1,\n },\n },\n }),\n source: `range`,\n originResult:\n originResult.type === \"value\"\n ? originResult.result\n : originResult.originResult,\n evaluate: (spilledCell, context) => {\n const colIndex = range.start.col + spilledCell.spillOffset.x;\n const rowIndex = range.start.row + spilledCell.spillOffset.y;\n const sheetName = node.sheetName ?? context.currentSheet;\n return this.evalTimeSafeEvaluateCell(\n {\n colIndex,\n rowIndex,\n sheetName,\n },\n context\n );\n },\n };\n */\n }\n\n evaluateRange(\n node: RangeNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n if (isRangeOneCell(node.range)) {\n return this.evaluateReference(\n {\n type: \"reference\",\n address: {\n colIndex: node.range.start.col,\n rowIndex: node.range.start.row,\n },\n isAbsolute: {\n col: node.isAbsolute.start.col || node.isAbsolute.end.col,\n row: node.isAbsolute.start.row || node.isAbsolute.end.row,\n },\n sheetName: node.sheetName,\n },\n context\n );\n }\n\n const debugRange = getRangeKey(node.range);\n\n const rangeAddress: RangeAddress = {\n sheetName: node.sheetName ?? context.cellAddress.sheetName,\n workbookName: node.workbookName ?? context.cellAddress.workbookName,\n range: node.range,\n };\n\n if (node.workbookName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getWorkbookResourceKey(node.workbookName)\n )\n );\n }\n if (node.sheetName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getSheetResourceKey({\n workbookName: rangeAddress.workbookName,\n sheetName: node.sheetName,\n })\n )\n );\n }\n\n return {\n type: \"spilled-values\",\n spillArea: (origin) => this.projectRange(node.range, origin),\n source: `range ${debugRange}`,\n sourceRange: rangeAddress,\n evaluate: (spillOffset, context) => {\n if (!node.sheetName && !node.workbookName) {\n // e.g. the result from A4:A9 will depend in which sheet and workbook we are evaluating it in\n context.addContextDependency(\"workbook\", \"sheet\");\n } else if (!node.sheetName) {\n // e.g. the result from [Workbook1]A4:A9 will depend in which sheet we are evaluating it in\n context.addContextDependency(\"sheet\");\n } else if (!node.workbookName) {\n // e.g. the result from Sheet1!A4:A9 will depend in which workbook we are evaluating it in\n context.addContextDependency(\"workbook\");\n } else {\n // if we have both sheetName and workbookName, we don't need to add any context dependencies\n }\n\n const originSheetName = node.sheetName ?? context.cellAddress.sheetName;\n const originWorkbookName =\n node.workbookName ?? context.cellAddress.workbookName;\n const colIndex = node.range.start.col + spillOffset.x;\n const rowIndex = node.range.start.row + spillOffset.y;\n\n const cellAddress: CellAddress = {\n colIndex,\n rowIndex,\n sheetName: originSheetName,\n workbookName: originWorkbookName,\n };\n\n const evalNode = this.dependencyManager.getCellValueOrEmptyCellNode(\n cellAddressToKey(cellAddress)\n );\n context.dependencyNode.addDependency(evalNode);\n\n const result = evalNode.evaluationResult;\n\n return result;\n },\n evaluateAllCells: function ({\n evaluate,\n intersection,\n context,\n origin,\n lookupOrder,\n }) {\n let range = node.range;\n if (intersection) {\n // When we have an intersection, it's defined relative to where the spilled range\n // will appear (the origin). However, we need to evaluate cells from the source\n // range (node.range). So we must translate the intersection coordinates back\n // to the source range's coordinate system.\n //\n // Example: If source range A1:C3 spills to D5:F7, and we want intersection E6:F7,\n // we need to translate E6:F7 (relative to D5) to B2:C3 (relative to A1).\n\n // Calculate the offset of the intersection from the spill origin\n const relativeRange = getRelativeRange(intersection, origin);\n const start: LocalCellAddress = {\n colIndex: node.range.start.col,\n rowIndex: node.range.start.row,\n };\n const projectedIntersection = getAbsoluteRange(relativeRange, start);\n const calculateIntersection = getRangeIntersection(\n node.range,\n projectedIntersection\n );\n if (calculateIntersection) {\n range = calculateIntersection;\n }\n }\n\n const address: RangeAddress = {\n range,\n sheetName: node.sheetName ?? context.cellAddress.sheetName,\n workbookName: node.workbookName ?? context.cellAddress.workbookName,\n };\n\n const rangeNode = this.dependencyManager.getRangeNode(\n rangeAddressToKey(address)\n );\n\n context.dependencyNode.addDependency(rangeNode);\n\n return this.dependencyManager.getRangeNode(rangeAddressToKey(address))\n .result;\n },\n };\n }\n\n evaluateArray(\n node: ArrayNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const firstRow = node.elements[0];\n if (!firstRow) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Array is empty\",\n errAddress: context.dependencyNode,\n };\n }\n const firstCell = firstRow[0];\n if (!firstCell) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Array is empty\",\n errAddress: context.dependencyNode,\n };\n }\n const originResult = this.evaluateNode(firstCell, context);\n if (\n originResult.type === \"error\" ||\n originResult.type === \"awaiting-evaluation\"\n ) {\n return originResult;\n }\n return {\n type: \"spilled-values\",\n spillArea: (origin) => ({\n start: {\n col: origin.colIndex,\n row: origin.rowIndex,\n },\n end: {\n col: {\n type: \"number\",\n value: origin.colIndex + firstRow.length - 1,\n },\n row: {\n type: \"number\",\n value: origin.rowIndex + node.elements.length - 1,\n },\n },\n }),\n source: `array`,\n evaluate: (spillOffset, context) => {\n const row = node.elements[spillOffset.y];\n if (!row) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Array is empty\",\n errAddress: context.dependencyNode,\n };\n }\n const cell = row[spillOffset.x];\n if (!cell) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Array is empty\",\n errAddress: context.dependencyNode,\n };\n }\n const result = this.evaluateNode(cell, context);\n if (result.type === \"spilled-values\") {\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: \"Arrays cannot contain spilled values\",\n errAddress: context.dependencyNode,\n };\n }\n return result;\n },\n evaluateAllCells: (intersectingRange) => {\n throw new Error(\"WIP: evaluateAllCells for array is not implemented\");\n },\n };\n }\n\n /**\n * Evaluates a unary operation\n */\n evaluateUnaryOp(\n node: UnaryOpNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const operandResult = this.evaluateNode(node.operand, context);\n\n if (\n operandResult.type === \"error\" ||\n operandResult.type === \"awaiting-evaluation\"\n ) {\n return operandResult;\n }\n\n if (operandResult.type === \"spilled-values\") {\n return {\n type: \"spilled-values\",\n spillArea: (origin) => operandResult.spillArea(origin),\n source: `unary ${node.operator} operation`,\n evaluate: (spilledCell, context) => {\n const spillResult = operandResult.evaluate(spilledCell, context);\n if (\n !spillResult ||\n spillResult.type === \"error\" ||\n spillResult.type === \"awaiting-evaluation\"\n ) {\n return spillResult;\n }\n if (spillResult.type !== \"value\") {\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: \"Invalid spilled result for unary operation\",\n errAddress: context.dependencyNode,\n };\n }\n return this.evaluateUnaryScalar(\n node.operator,\n spillResult.result,\n context\n );\n },\n evaluateAllCells: function (options) {\n const cellValues = operandResult.evaluateAllCells.call(this, options);\n if (cellValues.type !== \"values\") {\n return cellValues;\n }\n return {\n type: \"values\",\n values: cellValues.values.map((cellValue) => {\n if (\n cellValue.result.type === \"error\" ||\n cellValue.result.type === \"awaiting-evaluation\"\n ) {\n return cellValue;\n } else {\n return {\n result: this.evaluateUnaryScalar(\n node.operator,\n cellValue.result.result,\n context\n ),\n relativePos: cellValue.relativePos,\n };\n }\n }),\n };\n },\n };\n }\n\n if (operandResult.type === \"value\") {\n return this.evaluateUnaryScalar(\n node.operator,\n operandResult.result,\n context\n );\n }\n\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: \"Invalid operand for unary operation\",\n errAddress: context.dependencyNode,\n };\n }\n\n /**\n * Evaluates a unary scalar operation\n */\n private evaluateUnaryScalar(\n operator: \"+\" | \"-\" | \"%\",\n operand: CellValue,\n context: EvaluationContext\n ): SingleEvaluationResult {\n if (operand.type !== \"number\" && operand.type !== \"infinity\") {\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: `Cannot apply unary ${operator} to non-number`,\n errAddress: context.dependencyNode,\n };\n }\n if (operand.type === \"infinity\") {\n if (operator === \"%\") {\n return {\n type: \"error\",\n err: FormulaError.NUM,\n message: \"Cannot apply % to infinity\",\n errAddress: context.dependencyNode,\n };\n }\n return {\n type: \"value\",\n result: {\n type: \"infinity\",\n sign: operator === \"+\" ? \"positive\" : \"negative\",\n },\n };\n }\n switch (operator) {\n case \"+\":\n return { type: \"value\", result: operand };\n\n case \"-\":\n return {\n type: \"value\",\n result: {\n type: \"number\",\n value: -operand.value,\n },\n };\n\n case \"%\":\n return {\n type: \"value\",\n result: { type: \"number\", value: operand.value / 100 },\n };\n\n default:\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: `Unknown unary operator: ${operator}`,\n errAddress: context.dependencyNode,\n };\n }\n }\n\n /**\n * Evaluates a binary operation\n */\n evaluateBinaryOp(\n node: BinaryOpNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const left = this.evaluateNode(node.left, context);\n const right = this.evaluateNode(node.right, context);\n\n if (left.type === \"error\" || left.type === \"awaiting-evaluation\") {\n return left;\n }\n if (right.type === \"error\" || right.type === \"awaiting-evaluation\") {\n return right;\n }\n\n // Scalar operation\n return this.evaluateBinaryScalar(node.operator, left, right, context);\n }\n\n /**\n * Evaluates a reference node\n */\n evaluateReference(\n node: ReferenceNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const cellAddress: CellAddress = {\n ...node.address,\n sheetName: node.sheetName ?? context.cellAddress.sheetName,\n workbookName: node.workbookName ?? context.cellAddress.workbookName,\n };\n\n if (node.workbookName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getWorkbookResourceKey(node.workbookName)\n )\n );\n }\n if (node.sheetName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getSheetResourceKey({\n workbookName: cellAddress.workbookName,\n sheetName: node.sheetName,\n })\n )\n );\n }\n\n const key = cellAddressToKey(cellAddress);\n const evalNode = this.dependencyManager.getCellValueOrEmptyCellNode(key);\n context.dependencyNode.addDependency(evalNode);\n\n if (!node.sheetName && !node.workbookName) {\n // e.g. the result from A4:A9 will depend in which sheet and workbook we are evaluating it in\n context.addContextDependency(\"workbook\", \"sheet\");\n } else if (!node.sheetName) {\n // e.g. the result from [Workbook1]A4:A9 will depend in which sheet we are evaluating it in\n context.addContextDependency(\"sheet\");\n } else if (!node.workbookName) {\n // e.g. the result from Sheet1!A4:A9 will depend in which workbook we are evaluating it in\n context.addContextDependency(\"workbook\");\n } else {\n // if we have both sheetName and workbookName, we don't need to add any context dependencies\n }\n\n if (evalNode instanceof CellValueNode && evalNode.spillMeta) {\n if (evalNode.spillMeta.evaluationResult.type === \"spilled-values\") {\n return {\n ...evalNode.spillMeta.evaluationResult,\n sourceCell: cellAddress,\n sourceRange: undefined,\n };\n }\n }\n\n return { ...evalNode.evaluationResult, sourceCell: cellAddress };\n }\n\n /**\n * Evaluates a named expression node\n */\n evaluateNamedExpression(\n node: NamedExpressionNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const resolvedExpression =\n this.namedExpressionManager.resolveNamedExpressionWithScope(\n node,\n context\n );\n\n if (!resolvedExpression) {\n return {\n type: \"error\",\n err: FormulaError.NAME,\n message: `Named expression ${node.name} not found`,\n errAddress: context.dependencyNode,\n };\n }\n\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getNamedExpressionResourceKey({\n expressionName: node.name,\n workbookName:\n resolvedExpression.scope.type === \"global\"\n ? undefined\n : resolvedExpression.scope.workbookName,\n sheetName:\n resolvedExpression.scope.type === \"sheet\"\n ? resolvedExpression.scope.sheetName\n : undefined,\n })\n )\n );\n\n return this.evaluateFormula(resolvedExpression.expression, context);\n }\n\n /**\n * Binary scalar operations\n */\n evaluateBinaryScalar(\n operator: string,\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n switch (operator) {\n case \"+\":\n return this.add(left, right, context);\n case \"-\":\n return this.subtract(left, right, context);\n case \"*\":\n return this.multiply(left, right, context);\n case \"/\":\n return this.divide(left, right, context);\n case \"^\":\n return this.power(left, right, context);\n\n case \"&\":\n return this.concatenateOp(left, right, context);\n case \"=\":\n return this.equalsOp(left, right, context);\n case \"<>\":\n return this.notEqualsOp(left, right, context);\n case \"<\":\n return this.lessThanOp(left, right, context);\n case \"<=\":\n return this.lessThanOrEqualOp(left, right, context);\n case \">\":\n return this.greaterThanOp(left, right, context);\n case \">=\":\n return this.greaterThanOrEqualOp(left, right, context);\n default:\n return {\n type: \"error\",\n err: FormulaError.ERROR,\n message: `Unknown binary operator: ${operator}`,\n errAddress: context.dependencyNode,\n };\n }\n }\n\n evaluateFunction(\n node: FunctionNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const func = functions[node.name];\n if (!func) {\n return {\n type: \"error\",\n err: FormulaError.NAME,\n message: `Function ${node.name} not found`,\n errAddress: context.dependencyNode,\n };\n }\n return func.evaluate.call(this, node, context);\n }\n\n // Arithmetic operations\n add(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: add,\n context,\n name: \"add\",\n });\n }\n\n multiply(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: multiply,\n context,\n name: \"multiply\",\n });\n }\n\n divide(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: divide,\n context,\n name: \"divide\",\n });\n }\n\n evaluateScalarOperator(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n options: EvaluateScalarOperatorOptions\n ): FunctionEvaluationResult {\n return evaluateScalarOperator.call(this, left, right, options);\n }\n\n subtract(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: subtract,\n context,\n name: \"subtract\",\n });\n }\n\n power(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: power,\n context,\n name: \"power\",\n });\n }\n\n // Comparison operations\n equalsOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: equals,\n context,\n name: \"equals\",\n });\n }\n\n notEqualsOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: notEquals,\n context,\n name: \"notEquals\",\n });\n }\n\n lessThanOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: lessThan,\n context,\n name: \"lessThan\",\n });\n }\n\n lessThanOrEqualOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: lessThanOrEqual,\n context,\n name: \"lessThanOrEqual\",\n });\n }\n\n greaterThanOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: greaterThan,\n context,\n name: \"greaterThan\",\n });\n }\n\n greaterThanOrEqualOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: greaterThanOrEqual,\n context,\n name: \"greaterThanOrEqual\",\n });\n }\n\n // Concatenation operation\n concatenateOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: concatenate,\n context,\n name: \"concatenate\",\n });\n }\n\n projectRange(\n range: SpreadsheetRange,\n originCellAddress: CellAddress\n ): SpreadsheetRange {\n const offsetLeft = originCellAddress.colIndex - range.start.col;\n const offsetTop = originCellAddress.rowIndex - range.start.row;\n return {\n start: {\n col: range.start.col + offsetLeft,\n row: range.start.row + offsetTop,\n },\n end: {\n col:\n range.end.col.type === \"number\"\n ? { type: \"number\", value: range.end.col.value + offsetLeft }\n : range.end.col,\n row:\n range.end.row.type === \"number\"\n ? { type: \"number\", value: range.end.row.value + offsetTop }\n : range.end.row,\n },\n };\n }\n\n unionRanges(\n range1: SpreadsheetRange,\n range2: SpreadsheetRange\n ): SpreadsheetRange {\n const endCol = ((): SpreadsheetRangeEnd => {\n if (\n range1.end.col.type === \"infinity\" ||\n range2.end.col.type === \"infinity\"\n ) {\n return { type: \"infinity\", sign: \"positive\" };\n }\n return {\n type: \"number\",\n value: Math.max(range1.end.col.value, range2.end.col.value),\n };\n })();\n\n const endRow = ((): SpreadsheetRangeEnd => {\n if (\n range1.end.row.type === \"infinity\" ||\n range2.end.row.type === \"infinity\"\n ) {\n return { type: \"infinity\", sign: \"positive\" };\n }\n return {\n type: \"number\",\n value: Math.max(range1.end.row.value, range2.end.row.value),\n };\n })();\n\n return {\n start: {\n col: Math.min(range1.start.col, range2.start.col),\n row: Math.min(range1.start.row, range2.start.row),\n },\n end: {\n col: endCol,\n row: endRow,\n },\n };\n }\n}\n"
|
|
5
|
+
"import type {\n LocalCellAddress,\n RangeAddress,\n SingleEvaluationResult,\n} from \"../core/types.mjs\";\nimport {\n FormulaError,\n type CellAddress,\n type CellValue,\n type FunctionEvaluationResult,\n type SpreadsheetRange,\n type SpreadsheetRangeEnd,\n type TableDefinition,\n} from \"../core/types.mjs\";\nimport { parseFormula } from \"../parser/parser.mjs\";\n\nimport type { DependencyManager } from \"../core/managers/dependency-manager.mjs\";\nimport type { NamedExpressionManager } from \"../core/managers/named-expression-manager.mjs\";\nimport type { TableManager } from \"../core/managers/table-manager.mjs\";\nimport {\n captureEvaluationErrors,\n cellAddressToKey,\n getAbsoluteRange,\n getRangeIntersection,\n getRangeKey,\n getRelativeRange,\n isRangeOneCell,\n rangeAddressToKey,\n} from \"../core/utils.mjs\";\nimport {\n getNamedExpressionResourceKey,\n getSheetResourceKey,\n getTableResourceKey,\n getWorkbookResourceKey,\n} from \"../core/resource-keys.mjs\";\nimport {\n evaluateScalarOperator,\n type EvaluateScalarOperatorOptions,\n} from \"../evaluator/evaluate-scalar-operator.mjs\";\nimport { functions } from \"../functions/function-registry.mjs\";\nimport type {\n ArrayNode,\n ASTNode,\n BinaryOpNode,\n FunctionNode,\n NamedExpressionNode,\n RangeNode,\n ReferenceNode,\n StructuredReferenceNode,\n ThreeDRangeNode,\n UnaryOpNode,\n ValueNode,\n} from \"../parser/ast.mjs\";\nimport { add } from \"./arithmetic/add/add.mjs\";\nimport { divide } from \"./arithmetic/divide/divide.mjs\";\nimport { multiply } from \"./arithmetic/multiply/multiply.mjs\";\nimport { power } from \"./arithmetic/power/power.mjs\";\nimport { subtract } from \"./arithmetic/subtract/subtract.mjs\";\nimport { equals } from \"./comparison/equals.mjs\";\nimport { greaterThan } from \"./comparison/greater-than.mjs\";\nimport { greaterThanOrEqual } from \"./comparison/greater-than-or-equal.mjs\";\nimport { lessThan } from \"./comparison/less-than.mjs\";\nimport { lessThanOrEqual } from \"./comparison/less-than-or-equal.mjs\";\nimport { notEquals } from \"./comparison/not-equals.mjs\";\nimport { concatenate } from \"./concatenation/concatenate.mjs\";\nimport { CellValueNode } from \"./dependency-nodes/cell-value-node.mjs\";\nimport { EvaluationContext } from \"./evaluation-context.mjs\";\n\nexport class FormulaEvaluator {\n constructor(\n private tableManager: TableManager,\n private dependencyManager: DependencyManager,\n private namedExpressionManager: NamedExpressionManager\n ) {}\n\n // evaluator methods\n evaluateFormula(\n /**\n * formula is the formula to evaluate, without the leading =\n */\n formula: string,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const ast = parseFormula(formula);\n\n return captureEvaluationErrors(context.dependencyNode, () => {\n const result = this.evaluateNode(ast, context);\n return result;\n });\n }\n\n evaluateNode(\n node: ASTNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const currentContext = {\n ...context.cellAddress,\n tableName: context.cacheTableName,\n };\n\n const astNode = this.dependencyManager.getAstNode(node, currentContext);\n context.dependencyNode.addDependency(astNode);\n\n // if (astNode.evaluationResult.type !== \"awaiting-evaluation\") {\n // return astNode.evaluationResult;\n // }\n\n if (astNode.resolved) {\n const astContextDependency = astNode.getContextDependency();\n context.appendContextDependency(astContextDependency);\n return astNode.evaluationResult;\n }\n\n this.dependencyManager.unregisterNode(astNode);\n astNode.resetDirectDepsUpdated();\n\n function runEvaluation(\n this: FormulaEvaluator,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n switch (node.type) {\n case \"value\":\n return {\n type: \"value\",\n result: this.evaluateValue(node),\n };\n case \"infinity\":\n return {\n type: \"value\",\n result: {\n type: \"infinity\",\n sign: \"positive\",\n },\n };\n case \"binary-op\":\n return this.evaluateBinaryOp(node, context);\n\n case \"reference\":\n return this.evaluateReference(node, context);\n\n case \"named-expression\":\n return this.evaluateNamedExpression(node, context);\n\n case \"structured-reference\":\n return this.evaluateStructuredReference(node, context);\n\n case \"function\":\n return this.evaluateFunction(node, context);\n\n case \"range\":\n return this.evaluateRange(node, context);\n\n case \"unary-op\":\n return this.evaluateUnaryOp(node, context);\n\n case \"3d-range\":\n return this.evaluate3DRange(node, context);\n\n case \"array\":\n return this.evaluateArray(node, context);\n\n default:\n return {\n type: \"error\",\n err: FormulaError.ERROR,\n message: \"WIP: unimplemented support for \" + node.type,\n errAddress: context.dependencyNode,\n };\n }\n }\n const newContext = new EvaluationContext(\n this.tableManager,\n astNode,\n context.cellAddress\n );\n const result = captureEvaluationErrors(astNode, () =>\n runEvaluation.call(this, newContext)\n );\n astNode.setEvaluationResult(result);\n const astContextDependency = newContext.getContextDependency();\n\n astNode.setContextDependency(astContextDependency);\n this.dependencyManager.registerNode(astNode);\n\n context.appendContextDependency(astContextDependency);\n\n return result;\n }\n\n evaluateStructuredReference(\n node: StructuredReferenceNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const resourceWorkbookName =\n node.workbookName ?? context.cellAddress.workbookName;\n if (node.tableName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getTableResourceKey({\n workbookName: resourceWorkbookName,\n tableName: node.tableName,\n })\n )\n );\n }\n\n // the tables are never dependent on the sheet, interesetingly enough\n let table: TableDefinition | undefined;\n if (node.tableName && node.workbookName) {\n // this expression will evaluate to the same value regardless of where in the workbooks we are evaluating it in\n table = this.tableManager\n .getTables(node.workbookName)\n .get(node.tableName);\n } else if (node.tableName) {\n // different workbooks could have different tables with the same name\n // so it can differ based on the workbook we are evaluating it in\n context.addContextDependency(\"workbook\");\n table = this.tableManager\n .getTables(context.cellAddress.workbookName)\n .get(node.tableName);\n } else {\n // If no table nor workbook name is provided, the current cell's table\n // membership determines the result.\n context.addContextDependency(\"workbook\", \"sheet\", \"table\");\n table = this.tableManager.isCellInTable(context.cellAddress);\n }\n\n if (node.isCurrentRow) {\n context.addContextDependency(\"row\");\n }\n\n if (!table) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Table ${node.tableName} not found`,\n errAddress: context.dependencyNode,\n };\n }\n\n const rowIndex = context.cellAddress.rowIndex;\n const tableStart = table.start;\n\n // Handle selector-based references\n if (node.selector) {\n let startRow: number;\n let endRow: SpreadsheetRangeEnd;\n\n switch (node.selector) {\n case \"#Headers\":\n startRow = table.start.rowIndex;\n endRow = { type: \"number\", value: table.start.rowIndex };\n break;\n case \"#Data\":\n startRow = table.start.rowIndex + 1;\n endRow = table.endRow;\n break;\n case \"#All\":\n startRow = table.start.rowIndex;\n endRow = table.endRow;\n break;\n default:\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Unknown table selector: ${node.selector}`,\n errAddress: context.dependencyNode,\n };\n }\n\n // If we also have column specification, use those columns\n if (node.cols) {\n const startCol = table.headers.get(node.cols.startCol);\n const endCol = table.headers.get(node.cols.endCol);\n if (!startCol || !endCol) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Column ${node.cols.startCol} or ${node.cols.endCol} not found in table ${table.name}`,\n errAddress: context.dependencyNode,\n };\n }\n const startColIndex = tableStart.colIndex + startCol.index;\n const endColIndex = tableStart.colIndex + endCol.index;\n\n const range: SpreadsheetRange = {\n start: {\n row: startRow,\n col: startColIndex,\n },\n end: {\n row: endRow,\n col: { type: \"number\", value: endColIndex },\n },\n };\n\n return this.evaluateRange(\n {\n type: \"range\",\n range,\n isAbsolute: {\n start: {\n col: true,\n row: true,\n },\n end: {\n col: true,\n row: true,\n },\n },\n sheetName: table.sheetName,\n },\n context\n );\n } else {\n // No column specification, return entire row(s) for the selector\n const range: SpreadsheetRange = {\n start: {\n row: startRow,\n col: tableStart.colIndex,\n },\n end: {\n row: endRow,\n col: {\n type: \"number\",\n value: tableStart.colIndex + table.headers.size - 1,\n },\n },\n };\n\n return this.evaluateRange(\n {\n type: \"range\",\n range,\n isAbsolute: {\n start: {\n col: true,\n row: true,\n },\n end: {\n col: true,\n row: true,\n },\n },\n sheetName: table.sheetName,\n },\n context\n );\n }\n }\n\n // Handle column-only references (no selector)\n if (node.cols) {\n const startCol = table.headers.get(node.cols.startCol);\n const endCol = table.headers.get(node.cols.endCol);\n if (!startCol || !endCol) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Column ${node.cols.startCol} or ${node.cols.endCol} not found in table ${table.name}`,\n errAddress: context.dependencyNode,\n };\n }\n const startColIndex = tableStart.colIndex + startCol.index;\n const endColIndex = tableStart.colIndex + endCol.index;\n const range: SpreadsheetRange = {\n start: {\n row: node.isCurrentRow ? rowIndex : table.start.rowIndex + 1,\n col: startColIndex,\n },\n end: {\n row: node.isCurrentRow\n ? { type: \"number\", value: rowIndex }\n : table.endRow,\n col: { type: \"number\", value: endColIndex },\n },\n };\n\n return this.evaluateRange(\n {\n type: \"range\",\n range,\n isAbsolute: {\n start: {\n col: true,\n row: true,\n },\n end: {\n col: true,\n row: true,\n },\n },\n sheetName: table.sheetName,\n },\n context\n );\n }\n\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Structured reference must specify either a selector or columns\",\n errAddress: context.dependencyNode,\n };\n }\n\n /**\n * Evaluates a value node\n */\n evaluateValue(node: ValueNode): CellValue {\n return node.value;\n }\n\n evaluate3DRange(\n node: ThreeDRangeNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n throw new Error(\"WIP: 3d range is not implemented\");\n /*\n const startSheet = this.sheets.get(node.startSheet);\n const endSheet = this.sheets.get(node.endSheet);\n if (!startSheet || !endSheet) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Sheet ${node.startSheet} or ${node.endSheet} not found`,\n };\n }\n\n let numCols = 0;\n let numRows = 0;\n for (let i = startSheet.index; i <= endSheet.index; i++) {\n if (node.reference.type === \"reference\") {\n numCols += 1;\n } else {\n numCols += node.reference.range.end.col.value - node.reference.range.start.col.value + 1;\n }\n\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: `Sheet ${i} not found`,\n };\n }\n\n return {\n type: \"spilled-values\",\n spillArea: (origin: CellAddress) => ({\n start: {\n col: origin.colIndex,\n row: origin.rowIndex,\n },\n end: {\n col: { type: \"number\", value: origin.colIndex },\n row: {\n type: \"number\",\n value: origin.rowIndex + numSheets - 1,\n },\n },\n }),\n source: `range`,\n originResult:\n originResult.type === \"value\"\n ? originResult.result\n : originResult.originResult,\n evaluate: (spilledCell, context) => {\n const colIndex = range.start.col + spilledCell.spillOffset.x;\n const rowIndex = range.start.row + spilledCell.spillOffset.y;\n const sheetName = node.sheetName ?? context.currentSheet;\n return this.evalTimeSafeEvaluateCell(\n {\n colIndex,\n rowIndex,\n sheetName,\n },\n context\n );\n },\n };\n */\n }\n\n evaluateRange(\n node: RangeNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n if (isRangeOneCell(node.range)) {\n return this.evaluateReference(\n {\n type: \"reference\",\n address: {\n colIndex: node.range.start.col,\n rowIndex: node.range.start.row,\n },\n isAbsolute: {\n col: node.isAbsolute.start.col || node.isAbsolute.end.col,\n row: node.isAbsolute.start.row || node.isAbsolute.end.row,\n },\n sheetName: node.sheetName,\n },\n context\n );\n }\n\n const debugRange = getRangeKey(node.range);\n\n const rangeAddress: RangeAddress = {\n sheetName: node.sheetName ?? context.cellAddress.sheetName,\n workbookName: node.workbookName ?? context.cellAddress.workbookName,\n range: node.range,\n };\n\n if (node.workbookName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getWorkbookResourceKey(node.workbookName)\n )\n );\n }\n if (node.sheetName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getSheetResourceKey({\n workbookName: rangeAddress.workbookName,\n sheetName: node.sheetName,\n })\n )\n );\n }\n\n return {\n type: \"spilled-values\",\n spillArea: (origin) => this.projectRange(node.range, origin),\n source: `range ${debugRange}`,\n sourceRange: rangeAddress,\n evaluate: (spillOffset, context) => {\n if (!node.sheetName && !node.workbookName) {\n // e.g. the result from A4:A9 will depend in which sheet and workbook we are evaluating it in\n context.addContextDependency(\"workbook\", \"sheet\");\n } else if (!node.sheetName) {\n // e.g. the result from [Workbook1]A4:A9 will depend in which sheet we are evaluating it in\n context.addContextDependency(\"sheet\");\n } else if (!node.workbookName) {\n // e.g. the result from Sheet1!A4:A9 will depend in which workbook we are evaluating it in\n context.addContextDependency(\"workbook\");\n } else {\n // if we have both sheetName and workbookName, we don't need to add any context dependencies\n }\n\n const originSheetName = node.sheetName ?? context.cellAddress.sheetName;\n const originWorkbookName =\n node.workbookName ?? context.cellAddress.workbookName;\n const colIndex = node.range.start.col + spillOffset.x;\n const rowIndex = node.range.start.row + spillOffset.y;\n\n const cellAddress: CellAddress = {\n colIndex,\n rowIndex,\n sheetName: originSheetName,\n workbookName: originWorkbookName,\n };\n\n const evalNode = this.dependencyManager.getCellValueOrEmptyCellNode(\n cellAddressToKey(cellAddress)\n );\n context.dependencyNode.addDependency(evalNode);\n\n const result = evalNode.evaluationResult;\n\n return result;\n },\n evaluateAllCells: function ({\n evaluate,\n intersection,\n context,\n origin,\n lookupOrder,\n }) {\n let range = node.range;\n if (intersection) {\n // When we have an intersection, it's defined relative to where the spilled range\n // will appear (the origin). However, we need to evaluate cells from the source\n // range (node.range). So we must translate the intersection coordinates back\n // to the source range's coordinate system.\n //\n // Example: If source range A1:C3 spills to D5:F7, and we want intersection E6:F7,\n // we need to translate E6:F7 (relative to D5) to B2:C3 (relative to A1).\n\n // Calculate the offset of the intersection from the spill origin\n const relativeRange = getRelativeRange(intersection, origin);\n const start: LocalCellAddress = {\n colIndex: node.range.start.col,\n rowIndex: node.range.start.row,\n };\n const projectedIntersection = getAbsoluteRange(relativeRange, start);\n const calculateIntersection = getRangeIntersection(\n node.range,\n projectedIntersection\n );\n if (calculateIntersection) {\n range = calculateIntersection;\n }\n }\n\n const address: RangeAddress = {\n range,\n sheetName: node.sheetName ?? context.cellAddress.sheetName,\n workbookName: node.workbookName ?? context.cellAddress.workbookName,\n };\n\n const rangeNode = this.dependencyManager.getRangeNode(\n rangeAddressToKey(address)\n );\n\n context.dependencyNode.addDependency(rangeNode);\n\n return this.dependencyManager.getRangeNode(rangeAddressToKey(address))\n .result;\n },\n };\n }\n\n evaluateArray(\n node: ArrayNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const firstRow = node.elements[0];\n if (!firstRow) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Array is empty\",\n errAddress: context.dependencyNode,\n };\n }\n const firstCell = firstRow[0];\n if (!firstCell) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Array is empty\",\n errAddress: context.dependencyNode,\n };\n }\n const originResult = this.evaluateNode(firstCell, context);\n if (\n originResult.type === \"error\" ||\n originResult.type === \"awaiting-evaluation\"\n ) {\n return originResult;\n }\n return {\n type: \"spilled-values\",\n spillArea: (origin) => ({\n start: {\n col: origin.colIndex,\n row: origin.rowIndex,\n },\n end: {\n col: {\n type: \"number\",\n value: origin.colIndex + firstRow.length - 1,\n },\n row: {\n type: \"number\",\n value: origin.rowIndex + node.elements.length - 1,\n },\n },\n }),\n source: `array`,\n evaluate: (spillOffset, context) => {\n const row = node.elements[spillOffset.y];\n if (!row) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Array is empty\",\n errAddress: context.dependencyNode,\n };\n }\n const cell = row[spillOffset.x];\n if (!cell) {\n return {\n type: \"error\",\n err: FormulaError.REF,\n message: \"Array is empty\",\n errAddress: context.dependencyNode,\n };\n }\n const result = this.evaluateNode(cell, context);\n if (result.type === \"spilled-values\") {\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: \"Arrays cannot contain spilled values\",\n errAddress: context.dependencyNode,\n };\n }\n return result;\n },\n evaluateAllCells: (intersectingRange) => {\n throw new Error(\"WIP: evaluateAllCells for array is not implemented\");\n },\n };\n }\n\n /**\n * Evaluates a unary operation\n */\n evaluateUnaryOp(\n node: UnaryOpNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const operandResult = this.evaluateNode(node.operand, context);\n\n if (\n operandResult.type === \"error\" ||\n operandResult.type === \"awaiting-evaluation\"\n ) {\n return operandResult;\n }\n\n if (operandResult.type === \"spilled-values\") {\n return {\n type: \"spilled-values\",\n spillArea: (origin) => operandResult.spillArea(origin),\n source: `unary ${node.operator} operation`,\n evaluate: (spilledCell, context) => {\n const spillResult = operandResult.evaluate(spilledCell, context);\n if (\n !spillResult ||\n spillResult.type === \"error\" ||\n spillResult.type === \"awaiting-evaluation\"\n ) {\n return spillResult;\n }\n if (spillResult.type !== \"value\") {\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: \"Invalid spilled result for unary operation\",\n errAddress: context.dependencyNode,\n };\n }\n return this.evaluateUnaryScalar(\n node.operator,\n spillResult.result,\n context\n );\n },\n evaluateAllCells: function (options) {\n const cellValues = operandResult.evaluateAllCells.call(this, options);\n if (cellValues.type !== \"values\") {\n return cellValues;\n }\n return {\n type: \"values\",\n values: cellValues.values.map((cellValue) => {\n if (\n cellValue.result.type === \"error\" ||\n cellValue.result.type === \"awaiting-evaluation\"\n ) {\n return cellValue;\n } else {\n return {\n result: this.evaluateUnaryScalar(\n node.operator,\n cellValue.result.result,\n context\n ),\n relativePos: cellValue.relativePos,\n };\n }\n }),\n };\n },\n };\n }\n\n if (operandResult.type === \"value\") {\n return this.evaluateUnaryScalar(\n node.operator,\n operandResult.result,\n context\n );\n }\n\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: \"Invalid operand for unary operation\",\n errAddress: context.dependencyNode,\n };\n }\n\n /**\n * Evaluates a unary scalar operation\n */\n private evaluateUnaryScalar(\n operator: \"+\" | \"-\" | \"%\",\n operand: CellValue,\n context: EvaluationContext\n ): SingleEvaluationResult {\n if (operand.type !== \"number\" && operand.type !== \"infinity\") {\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: `Cannot apply unary ${operator} to non-number`,\n errAddress: context.dependencyNode,\n };\n }\n if (operand.type === \"infinity\") {\n if (operator === \"%\") {\n return {\n type: \"error\",\n err: FormulaError.NUM,\n message: \"Cannot apply % to infinity\",\n errAddress: context.dependencyNode,\n };\n }\n return {\n type: \"value\",\n result: {\n type: \"infinity\",\n sign: operator === \"+\" ? \"positive\" : \"negative\",\n },\n };\n }\n switch (operator) {\n case \"+\":\n return { type: \"value\", result: operand };\n\n case \"-\":\n return {\n type: \"value\",\n result: {\n type: \"number\",\n value: -operand.value,\n },\n };\n\n case \"%\":\n return {\n type: \"value\",\n result: { type: \"number\", value: operand.value / 100 },\n };\n\n default:\n return {\n type: \"error\",\n err: FormulaError.VALUE,\n message: `Unknown unary operator: ${operator}`,\n errAddress: context.dependencyNode,\n };\n }\n }\n\n /**\n * Evaluates a binary operation\n */\n evaluateBinaryOp(\n node: BinaryOpNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const left = this.evaluateNode(node.left, context);\n const right = this.evaluateNode(node.right, context);\n\n if (left.type === \"error\" || left.type === \"awaiting-evaluation\") {\n return left;\n }\n if (right.type === \"error\" || right.type === \"awaiting-evaluation\") {\n return right;\n }\n\n // Scalar operation\n return this.evaluateBinaryScalar(node.operator, left, right, context);\n }\n\n /**\n * Evaluates a reference node\n */\n evaluateReference(\n node: ReferenceNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const cellAddress: CellAddress = {\n ...node.address,\n sheetName: node.sheetName ?? context.cellAddress.sheetName,\n workbookName: node.workbookName ?? context.cellAddress.workbookName,\n };\n\n if (node.workbookName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getWorkbookResourceKey(node.workbookName)\n )\n );\n }\n if (node.sheetName) {\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getSheetResourceKey({\n workbookName: cellAddress.workbookName,\n sheetName: node.sheetName,\n })\n )\n );\n }\n\n const key = cellAddressToKey(cellAddress);\n const evalNode = this.dependencyManager.getCellValueOrEmptyCellNode(key);\n context.dependencyNode.addDependency(evalNode);\n\n if (!node.sheetName && !node.workbookName) {\n // e.g. the result from A4:A9 will depend in which sheet and workbook we are evaluating it in\n context.addContextDependency(\"workbook\", \"sheet\");\n } else if (!node.sheetName) {\n // e.g. the result from [Workbook1]A4:A9 will depend in which sheet we are evaluating it in\n context.addContextDependency(\"sheet\");\n } else if (!node.workbookName) {\n // e.g. the result from Sheet1!A4:A9 will depend in which workbook we are evaluating it in\n context.addContextDependency(\"workbook\");\n } else {\n // if we have both sheetName and workbookName, we don't need to add any context dependencies\n }\n\n if (evalNode instanceof CellValueNode && evalNode.spillMeta) {\n if (evalNode.spillMeta.evaluationResult.type === \"spilled-values\") {\n return {\n ...evalNode.spillMeta.evaluationResult,\n sourceCell: cellAddress,\n sourceRange: undefined,\n };\n }\n }\n\n return { ...evalNode.evaluationResult, sourceCell: cellAddress };\n }\n\n /**\n * Evaluates a named expression node\n */\n evaluateNamedExpression(\n node: NamedExpressionNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const resolvedExpression =\n this.namedExpressionManager.resolveNamedExpressionWithScope(\n node,\n context\n );\n\n if (!resolvedExpression) {\n return {\n type: \"error\",\n err: FormulaError.NAME,\n message: `Named expression ${node.name} not found`,\n errAddress: context.dependencyNode,\n };\n }\n\n context.dependencyNode.addDependency(\n this.dependencyManager.getResourceNode(\n getNamedExpressionResourceKey({\n expressionName: node.name,\n workbookName:\n resolvedExpression.scope.type === \"global\"\n ? undefined\n : resolvedExpression.scope.workbookName,\n sheetName:\n resolvedExpression.scope.type === \"sheet\"\n ? resolvedExpression.scope.sheetName\n : undefined,\n })\n )\n );\n\n return this.evaluateFormula(resolvedExpression.expression, context);\n }\n\n /**\n * Binary scalar operations\n */\n evaluateBinaryScalar(\n operator: string,\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n switch (operator) {\n case \"+\":\n return this.add(left, right, context);\n case \"-\":\n return this.subtract(left, right, context);\n case \"*\":\n return this.multiply(left, right, context);\n case \"/\":\n return this.divide(left, right, context);\n case \"^\":\n return this.power(left, right, context);\n\n case \"&\":\n return this.concatenateOp(left, right, context);\n case \"=\":\n return this.equalsOp(left, right, context);\n case \"<>\":\n return this.notEqualsOp(left, right, context);\n case \"<\":\n return this.lessThanOp(left, right, context);\n case \"<=\":\n return this.lessThanOrEqualOp(left, right, context);\n case \">\":\n return this.greaterThanOp(left, right, context);\n case \">=\":\n return this.greaterThanOrEqualOp(left, right, context);\n default:\n return {\n type: \"error\",\n err: FormulaError.ERROR,\n message: `Unknown binary operator: ${operator}`,\n errAddress: context.dependencyNode,\n };\n }\n }\n\n evaluateFunction(\n node: FunctionNode,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n const func = functions[node.name];\n if (!func) {\n return {\n type: \"error\",\n err: FormulaError.NAME,\n message: `Function ${node.name} not found`,\n errAddress: context.dependencyNode,\n };\n }\n return func.evaluate.call(this, node, context);\n }\n\n // Arithmetic operations\n add(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: add,\n context,\n name: \"add\",\n });\n }\n\n multiply(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: multiply,\n context,\n name: \"multiply\",\n });\n }\n\n divide(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: divide,\n context,\n name: \"divide\",\n });\n }\n\n evaluateScalarOperator(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n options: EvaluateScalarOperatorOptions\n ): FunctionEvaluationResult {\n return evaluateScalarOperator.call(this, left, right, options);\n }\n\n subtract(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: subtract,\n context,\n name: \"subtract\",\n });\n }\n\n power(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: power,\n context,\n name: \"power\",\n });\n }\n\n // Comparison operations\n equalsOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: equals,\n context,\n name: \"equals\",\n });\n }\n\n notEqualsOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: notEquals,\n context,\n name: \"notEquals\",\n });\n }\n\n lessThanOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: lessThan,\n context,\n name: \"lessThan\",\n });\n }\n\n lessThanOrEqualOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: lessThanOrEqual,\n context,\n name: \"lessThanOrEqual\",\n });\n }\n\n greaterThanOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: greaterThan,\n context,\n name: \"greaterThan\",\n });\n }\n\n greaterThanOrEqualOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: greaterThanOrEqual,\n context,\n name: \"greaterThanOrEqual\",\n });\n }\n\n // Concatenation operation\n concatenateOp(\n left: FunctionEvaluationResult,\n right: FunctionEvaluationResult,\n context: EvaluationContext\n ): FunctionEvaluationResult {\n return this.evaluateScalarOperator(left, right, {\n evaluateScalar: concatenate,\n context,\n name: \"concatenate\",\n });\n }\n\n projectRange(\n range: SpreadsheetRange,\n originCellAddress: CellAddress\n ): SpreadsheetRange {\n const offsetLeft = originCellAddress.colIndex - range.start.col;\n const offsetTop = originCellAddress.rowIndex - range.start.row;\n return {\n start: {\n col: range.start.col + offsetLeft,\n row: range.start.row + offsetTop,\n },\n end: {\n col:\n range.end.col.type === \"number\"\n ? { type: \"number\", value: range.end.col.value + offsetLeft }\n : range.end.col,\n row:\n range.end.row.type === \"number\"\n ? { type: \"number\", value: range.end.row.value + offsetTop }\n : range.end.row,\n },\n };\n }\n\n unionRanges(\n range1: SpreadsheetRange,\n range2: SpreadsheetRange\n ): SpreadsheetRange {\n const endCol = ((): SpreadsheetRangeEnd => {\n if (\n range1.end.col.type === \"infinity\" ||\n range2.end.col.type === \"infinity\"\n ) {\n return { type: \"infinity\", sign: \"positive\" };\n }\n return {\n type: \"number\",\n value: Math.max(range1.end.col.value, range2.end.col.value),\n };\n })();\n\n const endRow = ((): SpreadsheetRangeEnd => {\n if (\n range1.end.row.type === \"infinity\" ||\n range2.end.row.type === \"infinity\"\n ) {\n return { type: \"infinity\", sign: \"positive\" };\n }\n return {\n type: \"number\",\n value: Math.max(range1.end.row.value, range2.end.row.value),\n };\n })();\n\n return {\n start: {\n col: Math.min(range1.start.col, range2.start.col),\n row: Math.min(range1.start.row, range2.start.row),\n },\n end: {\n col: end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IAAI,SAAS,cACxB,OAAO,IAAI,IAAI,SAAS,YACxB;AAAA,QACA,OAAO,EAAE,MAAM,YAAY,MAAM,WAAW;AAAA,MAC9C;AAAA,MACA,OAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,KAAK,IAAI,OAAO,IAAI,IAAI,OAAO,OAAO,IAAI,IAAI,KAAK;AAAA,MAC5D;AAAA,OACC;AAAA,IAEH,MAAM,UAAU,MAA2B;AAAA,MACzC,IACE,OAAO,IAAI,IAAI,SAAS,cACxB,OAAO,IAAI,IAAI,SAAS,YACxB;AAAA,QACA,OAAO,EAAE,MAAM,YAAY,MAAM,WAAW;AAAA,MAC9C;AAAA,MACA,OAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,KAAK,IAAI,OAAO,IAAI,IAAI,OAAO,OAAO,IAAI,IAAI,KAAK;AAAA,MAC5D;AAAA,OACC;AAAA,IAEH,OAAO;AAAA,MACL,OAAO;AAAA,QACL,KAAK,KAAK,IAAI,OAAO,MAAM,KAAK,OAAO,MAAM,GAAG;AAAA,QAChD,KAAK,KAAK,IAAI,OAAO,MAAM,KAAK,OAAO,MAAM,GAAG;AAAA,MAClD;AAAA,MACA,KAAK;AAAA,QACH,KAAK;AAAA,QACL,KAAK;AAAA,MACP;AAAA,IACF;AAAA;AAEJ;",
|
|
8
|
+
"debugId": "4126D554F58B6F4364756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/dist/mjs/package.json
CHANGED
|
@@ -138,7 +138,6 @@ export declare class DependencyManager {
|
|
|
138
138
|
getAstNode(ast: ASTNode, currentContext: Omit<Required<ContextDependency>, "tableName"> & {
|
|
139
139
|
tableName?: string;
|
|
140
140
|
}): AstEvaluationNode;
|
|
141
|
-
private astUsesImplicitCurrentTableReference;
|
|
142
141
|
/**
|
|
143
142
|
* Once an AST node is evaluated, we know if it is context dependent
|
|
144
143
|
* and will thus save it under the correct cache key according to its
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { DependencyNode } from "../core/managers/dependency-node";
|
|
2
2
|
import type { TableManager } from "../core/managers/table-manager";
|
|
3
3
|
import type { CellAddress } from "../core/types";
|
|
4
|
+
export declare const NO_TABLE_CONTEXT_NAME = "__no_current_table__";
|
|
4
5
|
export declare class EvaluationContext {
|
|
5
6
|
private _cellAddress;
|
|
6
7
|
private _tableName;
|
|
8
|
+
private _cacheTableName;
|
|
7
9
|
/**
|
|
8
10
|
* Can be a range or a cell
|
|
9
11
|
*/
|
|
@@ -18,6 +20,7 @@ export declare class EvaluationContext {
|
|
|
18
20
|
*/
|
|
19
21
|
get cellAddress(): CellAddress;
|
|
20
22
|
get tableName(): string | undefined;
|
|
23
|
+
get cacheTableName(): string;
|
|
21
24
|
addContextDependency(...types: ContextDependencyType[]): void;
|
|
22
25
|
/**
|
|
23
26
|
* When evaluating an AST node,
|