@ricsam/formula-engine 0.0.1
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/README.md +100 -0
- package/dist/cjs/core/ast-traverser.cjs +124 -0
- package/dist/cjs/core/ast-traverser.cjs.map +10 -0
- package/dist/cjs/core/autofill-utils.cjs +304 -0
- package/dist/cjs/core/autofill-utils.cjs.map +10 -0
- package/dist/cjs/core/engine.cjs +390 -0
- package/dist/cjs/core/engine.cjs.map +10 -0
- package/dist/cjs/core/managers/cache-manager.cjs +58 -0
- package/dist/cjs/core/managers/cache-manager.cjs.map +10 -0
- package/dist/cjs/core/managers/dependency-manager.cjs +620 -0
- package/dist/cjs/core/managers/dependency-manager.cjs.map +10 -0
- package/dist/cjs/core/managers/dependency-node.cjs +24 -0
- package/dist/cjs/core/managers/dependency-node.cjs.map +9 -0
- package/dist/cjs/core/managers/evaluation-manager.cjs +433 -0
- package/dist/cjs/core/managers/evaluation-manager.cjs.map +10 -0
- package/dist/cjs/core/managers/event-manager.cjs +49 -0
- package/dist/cjs/core/managers/event-manager.cjs.map +10 -0
- package/dist/cjs/core/managers/frontier-dependency-manager.cjs +181 -0
- package/dist/cjs/core/managers/frontier-dependency-manager.cjs.map +10 -0
- package/dist/cjs/core/managers/index.cjs +49 -0
- package/dist/cjs/core/managers/index.cjs.map +10 -0
- package/dist/cjs/core/managers/isDependencyNode.cjs +44 -0
- package/dist/cjs/core/managers/isDependencyNode.cjs.map +10 -0
- package/dist/cjs/core/managers/named-expression-manager.cjs +379 -0
- package/dist/cjs/core/managers/named-expression-manager.cjs.map +10 -0
- package/dist/cjs/core/managers/range-eval-order-builder.cjs +644 -0
- package/dist/cjs/core/managers/range-eval-order-builder.cjs.map +10 -0
- package/dist/cjs/core/managers/table-manager.cjs +254 -0
- package/dist/cjs/core/managers/table-manager.cjs.map +10 -0
- package/dist/cjs/core/managers/workbook-manager.cjs +474 -0
- package/dist/cjs/core/managers/workbook-manager.cjs.map +10 -0
- package/dist/cjs/core/map-serializer.cjs +69 -0
- package/dist/cjs/core/map-serializer.cjs.map +10 -0
- package/dist/cjs/core/named-expression-renamer.cjs +88 -0
- package/dist/cjs/core/named-expression-renamer.cjs.map +10 -0
- package/dist/cjs/core/sheet-renamer.cjs +89 -0
- package/dist/cjs/core/sheet-renamer.cjs.map +10 -0
- package/dist/cjs/core/sheet-utils.cjs +39 -0
- package/dist/cjs/core/sheet-utils.cjs.map +10 -0
- package/dist/cjs/core/table-renamer.cjs +88 -0
- package/dist/cjs/core/table-renamer.cjs.map +10 -0
- package/dist/cjs/core/types.cjs +48 -0
- package/dist/cjs/core/types.cjs.map +10 -0
- package/dist/cjs/core/utils/range-serializer.cjs +65 -0
- package/dist/cjs/core/utils/range-serializer.cjs.map +10 -0
- package/dist/cjs/core/utils/spreadsheet-visualizer.cjs +142 -0
- package/dist/cjs/core/utils/spreadsheet-visualizer.cjs.map +10 -0
- package/dist/cjs/core/utils.cjs +434 -0
- package/dist/cjs/core/utils.cjs.map +10 -0
- package/dist/cjs/core/workbook-renamer.cjs +106 -0
- package/dist/cjs/core/workbook-renamer.cjs.map +10 -0
- package/dist/cjs/debug/flags.cjs +47 -0
- package/dist/cjs/debug/flags.cjs.map +10 -0
- package/dist/cjs/evaluator/arithmetic/add/add.cjs +82 -0
- package/dist/cjs/evaluator/arithmetic/add/add.cjs.map +10 -0
- package/dist/cjs/evaluator/arithmetic/divide/divide.cjs +107 -0
- package/dist/cjs/evaluator/arithmetic/divide/divide.cjs.map +10 -0
- package/dist/cjs/evaluator/arithmetic/multiply/multiply.cjs +93 -0
- package/dist/cjs/evaluator/arithmetic/multiply/multiply.cjs.map +10 -0
- package/dist/cjs/evaluator/arithmetic/power/power.cjs +125 -0
- package/dist/cjs/evaluator/arithmetic/power/power.cjs.map +10 -0
- package/dist/cjs/evaluator/arithmetic/subtract/subtract.cjs +84 -0
- package/dist/cjs/evaluator/arithmetic/subtract/subtract.cjs.map +10 -0
- package/dist/cjs/evaluator/comparison/equals.cjs +64 -0
- package/dist/cjs/evaluator/comparison/equals.cjs.map +10 -0
- package/dist/cjs/evaluator/comparison/greater-than-or-equal.cjs +61 -0
- package/dist/cjs/evaluator/comparison/greater-than-or-equal.cjs.map +10 -0
- package/dist/cjs/evaluator/comparison/greater-than.cjs +61 -0
- package/dist/cjs/evaluator/comparison/greater-than.cjs.map +10 -0
- package/dist/cjs/evaluator/comparison/less-than-or-equal.cjs +69 -0
- package/dist/cjs/evaluator/comparison/less-than-or-equal.cjs.map +10 -0
- package/dist/cjs/evaluator/comparison/less-than.cjs +68 -0
- package/dist/cjs/evaluator/comparison/less-than.cjs.map +10 -0
- package/dist/cjs/evaluator/comparison/not-equals.cjs +53 -0
- package/dist/cjs/evaluator/comparison/not-equals.cjs.map +10 -0
- package/dist/cjs/evaluator/concatenation/concatenate.cjs +72 -0
- package/dist/cjs/evaluator/concatenation/concatenate.cjs.map +10 -0
- package/dist/cjs/evaluator/dependency-nodes/ast-evaluation-node.cjs +58 -0
- package/dist/cjs/evaluator/dependency-nodes/ast-evaluation-node.cjs.map +10 -0
- package/dist/cjs/evaluator/dependency-nodes/base-eval-node.cjs +112 -0
- package/dist/cjs/evaluator/dependency-nodes/base-eval-node.cjs.map +10 -0
- package/dist/cjs/evaluator/dependency-nodes/cell-value-node.cjs +54 -0
- package/dist/cjs/evaluator/dependency-nodes/cell-value-node.cjs.map +10 -0
- package/dist/cjs/evaluator/dependency-nodes/empty-cell-evaluation-node.cjs +108 -0
- package/dist/cjs/evaluator/dependency-nodes/empty-cell-evaluation-node.cjs.map +10 -0
- package/dist/cjs/evaluator/dependency-nodes/spill-meta-node.cjs +50 -0
- package/dist/cjs/evaluator/dependency-nodes/spill-meta-node.cjs.map +10 -0
- package/dist/cjs/evaluator/evaluate-scalar-operator.cjs +254 -0
- package/dist/cjs/evaluator/evaluate-scalar-operator.cjs.map +10 -0
- package/dist/cjs/evaluator/evaluation-context.cjs +154 -0
- package/dist/cjs/evaluator/evaluation-context.cjs.map +10 -0
- package/dist/cjs/evaluator/evaluation-error.cjs +75 -0
- package/dist/cjs/evaluator/evaluation-error.cjs.map +10 -0
- package/dist/cjs/evaluator/formula-evaluator.cjs +797 -0
- package/dist/cjs/evaluator/formula-evaluator.cjs.map +10 -0
- package/dist/cjs/evaluator/range-evaluation-node.cjs +88 -0
- package/dist/cjs/evaluator/range-evaluation-node.cjs.map +10 -0
- package/dist/cjs/functions/_template/template.cjs +42 -0
- package/dist/cjs/functions/_template/template.cjs.map +10 -0
- package/dist/cjs/functions/array/sequence/sequence.cjs +315 -0
- package/dist/cjs/functions/array/sequence/sequence.cjs.map +10 -0
- package/dist/cjs/functions/criteria-parser.cjs +217 -0
- package/dist/cjs/functions/criteria-parser.cjs.map +10 -0
- package/dist/cjs/functions/criteria-utils.cjs +291 -0
- package/dist/cjs/functions/criteria-utils.cjs.map +10 -0
- package/dist/cjs/functions/function-utils.cjs +63 -0
- package/dist/cjs/functions/function-utils.cjs.map +10 -0
- package/dist/cjs/functions/index.cjs +125 -0
- package/dist/cjs/functions/index.cjs.map +10 -0
- package/dist/cjs/functions/information/cell/cell.cjs +196 -0
- package/dist/cjs/functions/information/cell/cell.cjs.map +10 -0
- package/dist/cjs/functions/information/column/column.cjs +144 -0
- package/dist/cjs/functions/information/column/column.cjs.map +10 -0
- package/dist/cjs/functions/information/row/row.cjs +150 -0
- package/dist/cjs/functions/information/row/row.cjs.map +10 -0
- package/dist/cjs/functions/logical/and/and.cjs +112 -0
- package/dist/cjs/functions/logical/and/and.cjs.map +10 -0
- package/dist/cjs/functions/logical/if/if.cjs +195 -0
- package/dist/cjs/functions/logical/if/if.cjs.map +10 -0
- package/dist/cjs/functions/logical/iferror/iferror.cjs +126 -0
- package/dist/cjs/functions/logical/iferror/iferror.cjs.map +10 -0
- package/dist/cjs/functions/logical/or/or.cjs +112 -0
- package/dist/cjs/functions/logical/or/or.cjs.map +10 -0
- package/dist/cjs/functions/lookup/count/count-utils.cjs +65 -0
- package/dist/cjs/functions/lookup/count/count-utils.cjs.map +10 -0
- package/dist/cjs/functions/lookup/count/count.cjs +48 -0
- package/dist/cjs/functions/lookup/count/count.cjs.map +10 -0
- package/dist/cjs/functions/lookup/count/countif.cjs +94 -0
- package/dist/cjs/functions/lookup/count/countif.cjs.map +10 -0
- package/dist/cjs/functions/lookup/count/countifs.cjs +63 -0
- package/dist/cjs/functions/lookup/count/countifs.cjs.map +10 -0
- package/dist/cjs/functions/lookup/index-lookup/index-lookup.cjs +187 -0
- package/dist/cjs/functions/lookup/index-lookup/index-lookup.cjs.map +10 -0
- package/dist/cjs/functions/lookup/match/match.cjs +168 -0
- package/dist/cjs/functions/lookup/match/match.cjs.map +10 -0
- package/dist/cjs/functions/lookup/xlookup/xlookup.cjs +410 -0
- package/dist/cjs/functions/lookup/xlookup/xlookup.cjs.map +10 -0
- package/dist/cjs/functions/math/average/average-utils.cjs +72 -0
- package/dist/cjs/functions/math/average/average-utils.cjs.map +10 -0
- package/dist/cjs/functions/math/average/average.cjs +48 -0
- package/dist/cjs/functions/math/average/average.cjs.map +10 -0
- package/dist/cjs/functions/math/average/averageif.cjs +83 -0
- package/dist/cjs/functions/math/average/averageif.cjs.map +10 -0
- package/dist/cjs/functions/math/average/averageifs.cjs +61 -0
- package/dist/cjs/functions/math/average/averageifs.cjs.map +10 -0
- package/dist/cjs/functions/math/ceiling/ceiling.cjs +219 -0
- package/dist/cjs/functions/math/ceiling/ceiling.cjs.map +10 -0
- package/dist/cjs/functions/math/max/max-utils.cjs +71 -0
- package/dist/cjs/functions/math/max/max-utils.cjs.map +10 -0
- package/dist/cjs/functions/math/max/max.cjs +48 -0
- package/dist/cjs/functions/math/max/max.cjs.map +10 -0
- package/dist/cjs/functions/math/max/maxif.cjs +83 -0
- package/dist/cjs/functions/math/max/maxif.cjs.map +10 -0
- package/dist/cjs/functions/math/max/maxifs.cjs +61 -0
- package/dist/cjs/functions/math/max/maxifs.cjs.map +10 -0
- package/dist/cjs/functions/math/min/min-utils.cjs +71 -0
- package/dist/cjs/functions/math/min/min-utils.cjs.map +10 -0
- package/dist/cjs/functions/math/min/min.cjs +48 -0
- package/dist/cjs/functions/math/min/min.cjs.map +10 -0
- package/dist/cjs/functions/math/min/minif.cjs +83 -0
- package/dist/cjs/functions/math/min/minif.cjs.map +10 -0
- package/dist/cjs/functions/math/min/minifs.cjs +61 -0
- package/dist/cjs/functions/math/min/minifs.cjs.map +10 -0
- package/dist/cjs/functions/math/sum/sum.cjs +48 -0
- package/dist/cjs/functions/math/sum/sum.cjs.map +10 -0
- package/dist/cjs/functions/math/sum/sumif.cjs +83 -0
- package/dist/cjs/functions/math/sum/sumif.cjs.map +10 -0
- package/dist/cjs/functions/math/sum/sumifs.cjs +60 -0
- package/dist/cjs/functions/math/sum/sumifs.cjs.map +10 -0
- package/dist/cjs/functions/math/sum/summation-utils.cjs +57 -0
- package/dist/cjs/functions/math/sum/summation-utils.cjs.map +10 -0
- package/dist/cjs/functions/reference/address/address.cjs +163 -0
- package/dist/cjs/functions/reference/address/address.cjs.map +10 -0
- package/dist/cjs/functions/reference/indirect/indirect.cjs +102 -0
- package/dist/cjs/functions/reference/indirect/indirect.cjs.map +10 -0
- package/dist/cjs/functions/reference/offset/offset.cjs +233 -0
- package/dist/cjs/functions/reference/offset/offset.cjs.map +10 -0
- package/dist/cjs/functions/text/concatenate/concatenate.cjs +167 -0
- package/dist/cjs/functions/text/concatenate/concatenate.cjs.map +10 -0
- package/dist/cjs/functions/text/exact/exact.cjs +171 -0
- package/dist/cjs/functions/text/exact/exact.cjs.map +10 -0
- package/dist/cjs/functions/text/find/find.cjs +397 -0
- package/dist/cjs/functions/text/find/find.cjs.map +10 -0
- package/dist/cjs/functions/text/left/left.cjs +109 -0
- package/dist/cjs/functions/text/left/left.cjs.map +10 -0
- package/dist/cjs/functions/text/len/len.cjs +119 -0
- package/dist/cjs/functions/text/len/len.cjs.map +10 -0
- package/dist/cjs/functions/text/mid/mid.cjs +103 -0
- package/dist/cjs/functions/text/mid/mid.cjs.map +10 -0
- package/dist/cjs/functions/text/right/right.cjs +167 -0
- package/dist/cjs/functions/text/right/right.cjs.map +10 -0
- package/dist/cjs/functions/text/text-helpers.cjs +179 -0
- package/dist/cjs/functions/text/text-helpers.cjs.map +10 -0
- package/dist/cjs/functions/text/textjoin/textjoin.cjs +173 -0
- package/dist/cjs/functions/text/textjoin/textjoin.cjs.map +10 -0
- package/dist/cjs/package.json +5 -0
- package/dist/cjs/parser/ast.cjs +175 -0
- package/dist/cjs/parser/ast.cjs.map +10 -0
- package/dist/cjs/parser/formatter.cjs +319 -0
- package/dist/cjs/parser/formatter.cjs.map +10 -0
- package/dist/cjs/parser/grammar.cjs +375 -0
- package/dist/cjs/parser/grammar.cjs.map +10 -0
- package/dist/cjs/parser/lexer.cjs +443 -0
- package/dist/cjs/parser/lexer.cjs.map +10 -0
- package/dist/cjs/parser/parser.cjs +1700 -0
- package/dist/cjs/parser/parser.cjs.map +10 -0
- package/dist/cjs/react/hooks.cjs +59 -0
- package/dist/cjs/react/hooks.cjs.map +10 -0
- package/dist/mjs/core/ast-traverser.mjs +94 -0
- package/dist/mjs/core/ast-traverser.mjs.map +10 -0
- package/dist/mjs/core/autofill-utils.mjs +274 -0
- package/dist/mjs/core/autofill-utils.mjs.map +10 -0
- package/dist/mjs/core/engine.mjs +366 -0
- package/dist/mjs/core/engine.mjs.map +10 -0
- package/dist/mjs/core/managers/cache-manager.mjs +27 -0
- package/dist/mjs/core/managers/cache-manager.mjs.map +10 -0
- package/dist/mjs/core/managers/dependency-manager.mjs +593 -0
- package/dist/mjs/core/managers/dependency-manager.mjs.map +10 -0
- package/dist/mjs/core/managers/dependency-node.mjs +2 -0
- package/dist/mjs/core/managers/dependency-node.mjs.map +9 -0
- package/dist/mjs/core/managers/evaluation-manager.mjs +415 -0
- package/dist/mjs/core/managers/evaluation-manager.mjs.map +10 -0
- package/dist/mjs/core/managers/event-manager.mjs +18 -0
- package/dist/mjs/core/managers/event-manager.mjs.map +10 -0
- package/dist/mjs/core/managers/frontier-dependency-manager.mjs +151 -0
- package/dist/mjs/core/managers/frontier-dependency-manager.mjs.map +10 -0
- package/dist/mjs/core/managers/index.mjs +21 -0
- package/dist/mjs/core/managers/index.mjs.map +10 -0
- package/dist/mjs/core/managers/isDependencyNode.mjs +14 -0
- package/dist/mjs/core/managers/isDependencyNode.mjs.map +10 -0
- package/dist/mjs/core/managers/named-expression-manager.mjs +348 -0
- package/dist/mjs/core/managers/named-expression-manager.mjs.map +10 -0
- package/dist/mjs/core/managers/range-eval-order-builder.mjs +618 -0
- package/dist/mjs/core/managers/range-eval-order-builder.mjs.map +10 -0
- package/dist/mjs/core/managers/table-manager.mjs +224 -0
- package/dist/mjs/core/managers/table-manager.mjs.map +10 -0
- package/dist/mjs/core/managers/workbook-manager.mjs +447 -0
- package/dist/mjs/core/managers/workbook-manager.mjs.map +10 -0
- package/dist/mjs/core/map-serializer.mjs +39 -0
- package/dist/mjs/core/map-serializer.mjs.map +10 -0
- package/dist/mjs/core/named-expression-renamer.mjs +58 -0
- package/dist/mjs/core/named-expression-renamer.mjs.map +10 -0
- package/dist/mjs/core/sheet-renamer.mjs +59 -0
- package/dist/mjs/core/sheet-renamer.mjs.map +10 -0
- package/dist/mjs/core/sheet-utils.mjs +8 -0
- package/dist/mjs/core/sheet-utils.mjs.map +10 -0
- package/dist/mjs/core/table-renamer.mjs +58 -0
- package/dist/mjs/core/table-renamer.mjs.map +10 -0
- package/dist/mjs/core/types.mjs +18 -0
- package/dist/mjs/core/types.mjs.map +10 -0
- package/dist/mjs/core/utils/range-serializer.mjs +35 -0
- package/dist/mjs/core/utils/range-serializer.mjs.map +10 -0
- package/dist/mjs/core/utils/spreadsheet-visualizer.mjs +112 -0
- package/dist/mjs/core/utils/spreadsheet-visualizer.mjs.map +10 -0
- package/dist/mjs/core/utils.mjs +409 -0
- package/dist/mjs/core/utils.mjs.map +10 -0
- package/dist/mjs/core/workbook-renamer.mjs +76 -0
- package/dist/mjs/core/workbook-renamer.mjs.map +10 -0
- package/dist/mjs/debug/flags.mjs +17 -0
- package/dist/mjs/debug/flags.mjs.map +10 -0
- package/dist/mjs/evaluator/arithmetic/add/add.mjs +52 -0
- package/dist/mjs/evaluator/arithmetic/add/add.mjs.map +10 -0
- package/dist/mjs/evaluator/arithmetic/divide/divide.mjs +77 -0
- package/dist/mjs/evaluator/arithmetic/divide/divide.mjs.map +10 -0
- package/dist/mjs/evaluator/arithmetic/multiply/multiply.mjs +63 -0
- package/dist/mjs/evaluator/arithmetic/multiply/multiply.mjs.map +10 -0
- package/dist/mjs/evaluator/arithmetic/power/power.mjs +95 -0
- package/dist/mjs/evaluator/arithmetic/power/power.mjs.map +10 -0
- package/dist/mjs/evaluator/arithmetic/subtract/subtract.mjs +54 -0
- package/dist/mjs/evaluator/arithmetic/subtract/subtract.mjs.map +10 -0
- package/dist/mjs/evaluator/comparison/equals.mjs +34 -0
- package/dist/mjs/evaluator/comparison/equals.mjs.map +10 -0
- package/dist/mjs/evaluator/comparison/greater-than-or-equal.mjs +31 -0
- package/dist/mjs/evaluator/comparison/greater-than-or-equal.mjs.map +10 -0
- package/dist/mjs/evaluator/comparison/greater-than.mjs +31 -0
- package/dist/mjs/evaluator/comparison/greater-than.mjs.map +10 -0
- package/dist/mjs/evaluator/comparison/less-than-or-equal.mjs +39 -0
- package/dist/mjs/evaluator/comparison/less-than-or-equal.mjs.map +10 -0
- package/dist/mjs/evaluator/comparison/less-than.mjs +38 -0
- package/dist/mjs/evaluator/comparison/less-than.mjs.map +10 -0
- package/dist/mjs/evaluator/comparison/not-equals.mjs +23 -0
- package/dist/mjs/evaluator/comparison/not-equals.mjs.map +10 -0
- package/dist/mjs/evaluator/concatenation/concatenate.mjs +42 -0
- package/dist/mjs/evaluator/concatenation/concatenate.mjs.map +10 -0
- package/dist/mjs/evaluator/dependency-nodes/ast-evaluation-node.mjs +28 -0
- package/dist/mjs/evaluator/dependency-nodes/ast-evaluation-node.mjs.map +10 -0
- package/dist/mjs/evaluator/dependency-nodes/base-eval-node.mjs +81 -0
- package/dist/mjs/evaluator/dependency-nodes/base-eval-node.mjs.map +10 -0
- package/dist/mjs/evaluator/dependency-nodes/cell-value-node.mjs +24 -0
- package/dist/mjs/evaluator/dependency-nodes/cell-value-node.mjs.map +10 -0
- package/dist/mjs/evaluator/dependency-nodes/empty-cell-evaluation-node.mjs +78 -0
- package/dist/mjs/evaluator/dependency-nodes/empty-cell-evaluation-node.mjs.map +10 -0
- package/dist/mjs/evaluator/dependency-nodes/spill-meta-node.mjs +20 -0
- package/dist/mjs/evaluator/dependency-nodes/spill-meta-node.mjs.map +10 -0
- package/dist/mjs/evaluator/evaluate-scalar-operator.mjs +226 -0
- package/dist/mjs/evaluator/evaluate-scalar-operator.mjs.map +10 -0
- package/dist/mjs/evaluator/evaluation-context.mjs +123 -0
- package/dist/mjs/evaluator/evaluation-context.mjs.map +10 -0
- package/dist/mjs/evaluator/evaluation-error.mjs +44 -0
- package/dist/mjs/evaluator/evaluation-error.mjs.map +10 -0
- package/dist/mjs/evaluator/formula-evaluator.mjs +780 -0
- package/dist/mjs/evaluator/formula-evaluator.mjs.map +10 -0
- package/dist/mjs/evaluator/range-evaluation-node.mjs +58 -0
- package/dist/mjs/evaluator/range-evaluation-node.mjs.map +10 -0
- package/dist/mjs/functions/_template/template.mjs +12 -0
- package/dist/mjs/functions/_template/template.mjs.map +10 -0
- package/dist/mjs/functions/array/sequence/sequence.mjs +287 -0
- package/dist/mjs/functions/array/sequence/sequence.mjs.map +10 -0
- package/dist/mjs/functions/criteria-parser.mjs +187 -0
- package/dist/mjs/functions/criteria-parser.mjs.map +10 -0
- package/dist/mjs/functions/criteria-utils.mjs +268 -0
- package/dist/mjs/functions/criteria-utils.mjs.map +10 -0
- package/dist/mjs/functions/function-utils.mjs +33 -0
- package/dist/mjs/functions/function-utils.mjs.map +10 -0
- package/dist/mjs/functions/index.mjs +95 -0
- package/dist/mjs/functions/index.mjs.map +10 -0
- package/dist/mjs/functions/information/cell/cell.mjs +168 -0
- package/dist/mjs/functions/information/cell/cell.mjs.map +10 -0
- package/dist/mjs/functions/information/column/column.mjs +120 -0
- package/dist/mjs/functions/information/column/column.mjs.map +10 -0
- package/dist/mjs/functions/information/row/row.mjs +126 -0
- package/dist/mjs/functions/information/row/row.mjs.map +10 -0
- package/dist/mjs/functions/logical/and/and.mjs +84 -0
- package/dist/mjs/functions/logical/and/and.mjs.map +10 -0
- package/dist/mjs/functions/logical/if/if.mjs +167 -0
- package/dist/mjs/functions/logical/if/if.mjs.map +10 -0
- package/dist/mjs/functions/logical/iferror/iferror.mjs +98 -0
- package/dist/mjs/functions/logical/iferror/iferror.mjs.map +10 -0
- package/dist/mjs/functions/logical/or/or.mjs +84 -0
- package/dist/mjs/functions/logical/or/or.mjs.map +10 -0
- package/dist/mjs/functions/lookup/count/count-utils.mjs +35 -0
- package/dist/mjs/functions/lookup/count/count-utils.mjs.map +10 -0
- package/dist/mjs/functions/lookup/count/count.mjs +18 -0
- package/dist/mjs/functions/lookup/count/count.mjs.map +10 -0
- package/dist/mjs/functions/lookup/count/countif.mjs +68 -0
- package/dist/mjs/functions/lookup/count/countif.mjs.map +10 -0
- package/dist/mjs/functions/lookup/count/countifs.mjs +37 -0
- package/dist/mjs/functions/lookup/count/countifs.mjs.map +10 -0
- package/dist/mjs/functions/lookup/index-lookup/index-lookup.mjs +159 -0
- package/dist/mjs/functions/lookup/index-lookup/index-lookup.mjs.map +10 -0
- package/dist/mjs/functions/lookup/match/match.mjs +140 -0
- package/dist/mjs/functions/lookup/match/match.mjs.map +10 -0
- package/dist/mjs/functions/lookup/xlookup/xlookup.mjs +382 -0
- package/dist/mjs/functions/lookup/xlookup/xlookup.mjs.map +10 -0
- package/dist/mjs/functions/math/average/average-utils.mjs +44 -0
- package/dist/mjs/functions/math/average/average-utils.mjs.map +10 -0
- package/dist/mjs/functions/math/average/average.mjs +18 -0
- package/dist/mjs/functions/math/average/average.mjs.map +10 -0
- package/dist/mjs/functions/math/average/averageif.mjs +58 -0
- package/dist/mjs/functions/math/average/averageif.mjs.map +10 -0
- package/dist/mjs/functions/math/average/averageifs.mjs +35 -0
- package/dist/mjs/functions/math/average/averageifs.mjs.map +10 -0
- package/dist/mjs/functions/math/ceiling/ceiling.mjs +191 -0
- package/dist/mjs/functions/math/ceiling/ceiling.mjs.map +10 -0
- package/dist/mjs/functions/math/max/max-utils.mjs +43 -0
- package/dist/mjs/functions/math/max/max-utils.mjs.map +10 -0
- package/dist/mjs/functions/math/max/max.mjs +18 -0
- package/dist/mjs/functions/math/max/max.mjs.map +10 -0
- package/dist/mjs/functions/math/max/maxif.mjs +58 -0
- package/dist/mjs/functions/math/max/maxif.mjs.map +10 -0
- package/dist/mjs/functions/math/max/maxifs.mjs +35 -0
- package/dist/mjs/functions/math/max/maxifs.mjs.map +10 -0
- package/dist/mjs/functions/math/min/min-utils.mjs +43 -0
- package/dist/mjs/functions/math/min/min-utils.mjs.map +10 -0
- package/dist/mjs/functions/math/min/min.mjs +18 -0
- package/dist/mjs/functions/math/min/min.mjs.map +10 -0
- package/dist/mjs/functions/math/min/minif.mjs +58 -0
- package/dist/mjs/functions/math/min/minif.mjs.map +10 -0
- package/dist/mjs/functions/math/min/minifs.mjs +35 -0
- package/dist/mjs/functions/math/min/minifs.mjs.map +10 -0
- package/dist/mjs/functions/math/sum/sum.mjs +18 -0
- package/dist/mjs/functions/math/sum/sum.mjs.map +10 -0
- package/dist/mjs/functions/math/sum/sumif.mjs +58 -0
- package/dist/mjs/functions/math/sum/sumif.mjs.map +10 -0
- package/dist/mjs/functions/math/sum/sumifs.mjs +34 -0
- package/dist/mjs/functions/math/sum/sumifs.mjs.map +10 -0
- package/dist/mjs/functions/math/sum/summation-utils.mjs +27 -0
- package/dist/mjs/functions/math/sum/summation-utils.mjs.map +10 -0
- package/dist/mjs/functions/reference/address/address.mjs +135 -0
- package/dist/mjs/functions/reference/address/address.mjs.map +10 -0
- package/dist/mjs/functions/reference/indirect/indirect.mjs +74 -0
- package/dist/mjs/functions/reference/indirect/indirect.mjs.map +10 -0
- package/dist/mjs/functions/reference/offset/offset.mjs +205 -0
- package/dist/mjs/functions/reference/offset/offset.mjs.map +10 -0
- package/dist/mjs/functions/text/concatenate/concatenate.mjs +139 -0
- package/dist/mjs/functions/text/concatenate/concatenate.mjs.map +10 -0
- package/dist/mjs/functions/text/exact/exact.mjs +143 -0
- package/dist/mjs/functions/text/exact/exact.mjs.map +10 -0
- package/dist/mjs/functions/text/find/find.mjs +369 -0
- package/dist/mjs/functions/text/find/find.mjs.map +10 -0
- package/dist/mjs/functions/text/left/left.mjs +81 -0
- package/dist/mjs/functions/text/left/left.mjs.map +10 -0
- package/dist/mjs/functions/text/len/len.mjs +91 -0
- package/dist/mjs/functions/text/len/len.mjs.map +10 -0
- package/dist/mjs/functions/text/mid/mid.mjs +75 -0
- package/dist/mjs/functions/text/mid/mid.mjs.map +10 -0
- package/dist/mjs/functions/text/right/right.mjs +143 -0
- package/dist/mjs/functions/text/right/right.mjs.map +10 -0
- package/dist/mjs/functions/text/text-helpers.mjs +151 -0
- package/dist/mjs/functions/text/text-helpers.mjs.map +10 -0
- package/dist/mjs/functions/text/textjoin/textjoin.mjs +145 -0
- package/dist/mjs/functions/text/textjoin/textjoin.mjs.map +10 -0
- package/dist/mjs/package.json +5 -0
- package/dist/mjs/parser/ast.mjs +145 -0
- package/dist/mjs/parser/ast.mjs.map +10 -0
- package/dist/mjs/parser/formatter.mjs +289 -0
- package/dist/mjs/parser/formatter.mjs.map +10 -0
- package/dist/mjs/parser/grammar.mjs +345 -0
- package/dist/mjs/parser/grammar.mjs.map +10 -0
- package/dist/mjs/parser/lexer.mjs +412 -0
- package/dist/mjs/parser/lexer.mjs.map +10 -0
- package/dist/mjs/parser/parser.mjs +1692 -0
- package/dist/mjs/parser/parser.mjs.map +10 -0
- package/dist/mjs/react/hooks.mjs +16 -0
- package/dist/mjs/react/hooks.mjs.map +10 -0
- package/dist/types/core/ast-traverser.d.ts +28 -0
- package/dist/types/core/autofill-utils.d.ts +32 -0
- package/dist/types/core/engine.d.ts +184 -0
- package/dist/types/core/managers/cache-manager.d.ts +14 -0
- package/dist/types/core/managers/dependency-manager.d.ts +147 -0
- package/dist/types/core/managers/dependency-node.d.ts +13 -0
- package/dist/types/core/managers/evaluation-manager.d.ts +30 -0
- package/dist/types/core/managers/event-manager.d.ts +8 -0
- package/dist/types/core/managers/frontier-dependency-manager.d.ts +69 -0
- package/dist/types/core/managers/index.d.ts +7 -0
- package/dist/types/core/managers/isDependencyNode.d.ts +2 -0
- package/dist/types/core/managers/named-expression-manager.d.ts +101 -0
- package/dist/types/core/managers/range-eval-order-builder.d.ts +33 -0
- package/dist/types/core/managers/table-manager.d.ts +84 -0
- package/dist/types/core/managers/workbook-manager.d.ts +136 -0
- package/dist/types/core/map-serializer.d.ts +4 -0
- package/dist/types/core/named-expression-renamer.d.ts +21 -0
- package/dist/types/core/sheet-renamer.d.ts +28 -0
- package/dist/types/core/sheet-utils.d.ts +2 -0
- package/dist/types/core/table-renamer.d.ts +21 -0
- package/dist/types/core/types.d.ts +272 -0
- package/dist/types/core/utils/cell-address-parsing.test.d.ts +1 -0
- package/dist/types/core/utils/range-serializer.d.ts +22 -0
- package/dist/types/core/utils/range-serializer.test.d.ts +1 -0
- package/dist/types/core/utils/spreadsheet-visualizer.d.ts +30 -0
- package/dist/types/core/utils.d.ts +48 -0
- package/dist/types/core/workbook-renamer.d.ts +28 -0
- package/dist/types/debug/flags.d.ts +11 -0
- package/dist/types/evaluator/arithmetic/add/add.d.ts +2 -0
- package/dist/types/evaluator/arithmetic/add/add.test.d.ts +1 -0
- package/dist/types/evaluator/arithmetic/divide/divide.d.ts +2 -0
- package/dist/types/evaluator/arithmetic/divide/divide.test.d.ts +1 -0
- package/dist/types/evaluator/arithmetic/multiply/multiply.d.ts +2 -0
- package/dist/types/evaluator/arithmetic/multiply/multiply.test.d.ts +1 -0
- package/dist/types/evaluator/arithmetic/power/power.d.ts +2 -0
- package/dist/types/evaluator/arithmetic/power/power.test.d.ts +1 -0
- package/dist/types/evaluator/arithmetic/subtract/subtract.d.ts +2 -0
- package/dist/types/evaluator/arithmetic/subtract/subtract.test.d.ts +1 -0
- package/dist/types/evaluator/comparison/comparison-operators.test.d.ts +1 -0
- package/dist/types/evaluator/comparison/equals.d.ts +6 -0
- package/dist/types/evaluator/comparison/greater-than-or-equal.d.ts +6 -0
- package/dist/types/evaluator/comparison/greater-than.d.ts +6 -0
- package/dist/types/evaluator/comparison/less-than-or-equal.d.ts +6 -0
- package/dist/types/evaluator/comparison/less-than.d.ts +6 -0
- package/dist/types/evaluator/comparison/not-equals.d.ts +6 -0
- package/dist/types/evaluator/concatenation/concatenate.d.ts +6 -0
- package/dist/types/evaluator/concatenation/concatenate.test.d.ts +1 -0
- package/dist/types/evaluator/dependency-nodes/ast-evaluation-node.d.ts +12 -0
- package/dist/types/evaluator/dependency-nodes/base-eval-node.d.ts +31 -0
- package/dist/types/evaluator/dependency-nodes/cell-value-node.d.ts +10 -0
- package/dist/types/evaluator/dependency-nodes/empty-cell-evaluation-node.d.ts +17 -0
- package/dist/types/evaluator/dependency-nodes/spill-meta-node.d.ts +7 -0
- package/dist/types/evaluator/evaluate-scalar-operator.d.ts +12 -0
- package/dist/types/evaluator/evaluation-context.d.ts +66 -0
- package/dist/types/evaluator/evaluation-error.d.ts +20 -0
- package/dist/types/evaluator/formula-evaluator.d.ts +67 -0
- package/dist/types/evaluator/open-range-evaluator.test.d.ts +1 -0
- package/dist/types/evaluator/range-evaluation-node.d.ts +16 -0
- package/dist/types/functions/_template/template.d.ts +5 -0
- package/dist/types/functions/_template/template.test.d.ts +1 -0
- package/dist/types/functions/array/sequence/performance-test.d.ts +1 -0
- package/dist/types/functions/array/sequence/sequence.d.ts +14 -0
- package/dist/types/functions/array/sequence/sequence.test.d.ts +1 -0
- package/dist/types/functions/criteria-parser.d.ts +27 -0
- package/dist/types/functions/criteria-utils.d.ts +61 -0
- package/dist/types/functions/function-utils.d.ts +21 -0
- package/dist/types/functions/index.d.ts +2 -0
- package/dist/types/functions/information/cell/cell.d.ts +24 -0
- package/dist/types/functions/information/cell/cell.test.d.ts +1 -0
- package/dist/types/functions/information/column/column.d.ts +14 -0
- package/dist/types/functions/information/column/column.test.d.ts +1 -0
- package/dist/types/functions/information/row/row.d.ts +14 -0
- package/dist/types/functions/information/row/row.test.d.ts +1 -0
- package/dist/types/functions/logical/and/and.d.ts +5 -0
- package/dist/types/functions/logical/and/and.test.d.ts +1 -0
- package/dist/types/functions/logical/if/if.d.ts +5 -0
- package/dist/types/functions/logical/if/if.test.d.ts +1 -0
- package/dist/types/functions/logical/iferror/iferror.d.ts +5 -0
- package/dist/types/functions/logical/iferror/iferror.test.d.ts +1 -0
- package/dist/types/functions/logical/or/or.d.ts +5 -0
- package/dist/types/functions/logical/or/or.test.d.ts +1 -0
- package/dist/types/functions/lookup/count/count-utils.d.ts +14 -0
- package/dist/types/functions/lookup/count/count.d.ts +21 -0
- package/dist/types/functions/lookup/count/count.test.d.ts +1 -0
- package/dist/types/functions/lookup/count/countif.d.ts +26 -0
- package/dist/types/functions/lookup/count/countif.test.d.ts +1 -0
- package/dist/types/functions/lookup/count/countifs.d.ts +21 -0
- package/dist/types/functions/lookup/count/countifs.test.d.ts +1 -0
- package/dist/types/functions/lookup/index-lookup/index-lookup.d.ts +2 -0
- package/dist/types/functions/lookup/index-lookup/index-lookup.test.d.ts +1 -0
- package/dist/types/functions/lookup/match/match.d.ts +2 -0
- package/dist/types/functions/lookup/match/match.test.d.ts +1 -0
- package/dist/types/functions/lookup/xlookup/xlookup.d.ts +2 -0
- package/dist/types/functions/lookup/xlookup/xlookup.test.d.ts +1 -0
- package/dist/types/functions/math/average/average-utils.d.ts +10 -0
- package/dist/types/functions/math/average/average.d.ts +18 -0
- package/dist/types/functions/math/average/average.test.d.ts +1 -0
- package/dist/types/functions/math/average/averageif.d.ts +23 -0
- package/dist/types/functions/math/average/averageif.test.d.ts +1 -0
- package/dist/types/functions/math/average/averageifs.d.ts +21 -0
- package/dist/types/functions/math/average/averageifs.test.d.ts +1 -0
- package/dist/types/functions/math/ceiling/ceiling.d.ts +5 -0
- package/dist/types/functions/math/ceiling/ceiling.test.d.ts +1 -0
- package/dist/types/functions/math/max/max-utils.d.ts +20 -0
- package/dist/types/functions/math/max/max.d.ts +18 -0
- package/dist/types/functions/math/max/max.test.d.ts +1 -0
- package/dist/types/functions/math/max/maxif.d.ts +23 -0
- package/dist/types/functions/math/max/maxif.test.d.ts +1 -0
- package/dist/types/functions/math/max/maxifs.d.ts +21 -0
- package/dist/types/functions/math/max/maxifs.test.d.ts +1 -0
- package/dist/types/functions/math/min/min-utils.d.ts +20 -0
- package/dist/types/functions/math/min/min.d.ts +5 -0
- package/dist/types/functions/math/min/min.test.d.ts +1 -0
- package/dist/types/functions/math/min/minif.d.ts +23 -0
- package/dist/types/functions/math/min/minif.test.d.ts +1 -0
- package/dist/types/functions/math/min/minifs.d.ts +21 -0
- package/dist/types/functions/math/min/minifs.test.d.ts +1 -0
- package/dist/types/functions/math/sum/sum.d.ts +5 -0
- package/dist/types/functions/math/sum/sum.test.d.ts +1 -0
- package/dist/types/functions/math/sum/sumif.d.ts +23 -0
- package/dist/types/functions/math/sum/sumif.test.d.ts +1 -0
- package/dist/types/functions/math/sum/sumifs.d.ts +21 -0
- package/dist/types/functions/math/sum/sumifs.test.d.ts +1 -0
- package/dist/types/functions/math/sum/summation-utils.d.ts +19 -0
- package/dist/types/functions/reference/address/address.d.ts +18 -0
- package/dist/types/functions/reference/address/address.test.d.ts +1 -0
- package/dist/types/functions/reference/indirect/indirect.d.ts +20 -0
- package/dist/types/functions/reference/indirect/indirect.test.d.ts +1 -0
- package/dist/types/functions/reference/offset/offset.d.ts +23 -0
- package/dist/types/functions/reference/offset/offset.test.d.ts +1 -0
- package/dist/types/functions/text/concatenate/concatenate.d.ts +5 -0
- package/dist/types/functions/text/concatenate/concatenate.test.d.ts +1 -0
- package/dist/types/functions/text/exact/exact.d.ts +5 -0
- package/dist/types/functions/text/exact/exact.test.d.ts +1 -0
- package/dist/types/functions/text/find/find.d.ts +20 -0
- package/dist/types/functions/text/find/find.test.d.ts +1 -0
- package/dist/types/functions/text/left/left.d.ts +19 -0
- package/dist/types/functions/text/left/left.test.d.ts +1 -0
- package/dist/types/functions/text/len/len.d.ts +16 -0
- package/dist/types/functions/text/len/len.test.d.ts +1 -0
- package/dist/types/functions/text/mid/mid.d.ts +20 -0
- package/dist/types/functions/text/mid/mid.test.d.ts +1 -0
- package/dist/types/functions/text/right/right.d.ts +2 -0
- package/dist/types/functions/text/right/right.test.d.ts +1 -0
- package/dist/types/functions/text/text-helpers.d.ts +27 -0
- package/dist/types/functions/text/textjoin/textjoin.d.ts +5 -0
- package/dist/types/functions/text/textjoin/textjoin.test.d.ts +1 -0
- package/dist/types/parser/ast.d.ts +275 -0
- package/dist/types/parser/formatter.d.ts +6 -0
- package/dist/types/parser/grammar.d.ts +203 -0
- package/dist/types/parser/lexer.d.ts +144 -0
- package/dist/types/parser/parser.d.ts +159 -0
- package/dist/types/react/hooks.d.ts +5 -0
- package/package.json +41 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract Syntax Tree (AST) node definitions for formula parsing
|
|
3
|
+
*/
|
|
4
|
+
import type { CellValue, FormulaError, SpreadsheetRange } from "../core/types";
|
|
5
|
+
/**
|
|
6
|
+
* Base interface for all AST nodes
|
|
7
|
+
*/
|
|
8
|
+
type ASTNodeBase = {
|
|
9
|
+
position?: {
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Literal value node (number, string, boolean, error)
|
|
16
|
+
*/
|
|
17
|
+
export type ValueNode = ASTNodeBase & {
|
|
18
|
+
type: "value";
|
|
19
|
+
value: CellValue;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Cell reference node (e.g., A1, Sheet1!B2)
|
|
23
|
+
*/
|
|
24
|
+
export type ReferenceNode = ASTNodeBase & {
|
|
25
|
+
type: "reference";
|
|
26
|
+
address: {
|
|
27
|
+
colIndex: number;
|
|
28
|
+
rowIndex: number;
|
|
29
|
+
};
|
|
30
|
+
sheetName?: string;
|
|
31
|
+
workbookName?: string;
|
|
32
|
+
isAbsolute: {
|
|
33
|
+
col: boolean;
|
|
34
|
+
row: boolean;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Range reference node (e.g., A1:B10)
|
|
39
|
+
*/
|
|
40
|
+
export type RangeNode = ASTNodeBase & {
|
|
41
|
+
type: "range";
|
|
42
|
+
sheetName?: string;
|
|
43
|
+
workbookName?: string;
|
|
44
|
+
range: SpreadsheetRange;
|
|
45
|
+
isAbsolute: {
|
|
46
|
+
start: {
|
|
47
|
+
col: boolean;
|
|
48
|
+
row: boolean;
|
|
49
|
+
};
|
|
50
|
+
end: {
|
|
51
|
+
col: boolean;
|
|
52
|
+
row: boolean;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Function call node (e.g., SUM(A1:A10))
|
|
58
|
+
*/
|
|
59
|
+
export type FunctionNode = ASTNodeBase & {
|
|
60
|
+
type: "function";
|
|
61
|
+
name: string;
|
|
62
|
+
args: ASTNode[];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Unary operator node (e.g., -A1, +B2)
|
|
66
|
+
*/
|
|
67
|
+
export type UnaryOpNode = ASTNodeBase & {
|
|
68
|
+
type: "unary-op";
|
|
69
|
+
operator: "+" | "-" | "%";
|
|
70
|
+
operand: ASTNode;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Binary operator node (e.g., A1+B1, C1*D1)
|
|
74
|
+
*/
|
|
75
|
+
export type BinaryOpNode = ASTNodeBase & {
|
|
76
|
+
type: "binary-op";
|
|
77
|
+
operator: "+" | "-" | "*" | "/" | "^" | "&" | "=" | "<>" | "<" | ">" | "<=" | ">=";
|
|
78
|
+
left: ASTNode;
|
|
79
|
+
right: ASTNode;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Array literal node (e.g., {1,2,3;4,5,6})
|
|
83
|
+
*/
|
|
84
|
+
export type ArrayNode = ASTNodeBase & {
|
|
85
|
+
type: "array";
|
|
86
|
+
elements: ASTNode[][];
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* 3D range node (e.g., Sheet1:Sheet3!A1)
|
|
90
|
+
*/
|
|
91
|
+
export type ThreeDRangeNode = ASTNodeBase & {
|
|
92
|
+
type: "3d-range";
|
|
93
|
+
startSheet: string;
|
|
94
|
+
endSheet: string;
|
|
95
|
+
workbookName?: string;
|
|
96
|
+
reference: ReferenceNode | RangeNode;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Structured reference node (e.g., Table1[Column1])
|
|
100
|
+
*/
|
|
101
|
+
export type StructuredReferenceNode = ASTNodeBase & {
|
|
102
|
+
type: "structured-reference";
|
|
103
|
+
tableName?: string;
|
|
104
|
+
sheetName?: string;
|
|
105
|
+
workbookName?: string;
|
|
106
|
+
cols?: {
|
|
107
|
+
startCol: string;
|
|
108
|
+
endCol: string;
|
|
109
|
+
};
|
|
110
|
+
selector?: "#All" | "#Data" | "#Headers";
|
|
111
|
+
isCurrentRow: boolean;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Infinity literal node
|
|
115
|
+
*/
|
|
116
|
+
export type InfinityNode = ASTNodeBase & {
|
|
117
|
+
type: "infinity";
|
|
118
|
+
};
|
|
119
|
+
export type ASTNode = ValueNode | ReferenceNode | RangeNode | FunctionNode | UnaryOpNode | BinaryOpNode | ArrayNode | NamedExpressionNode | ErrorNode | EmptyNode | ThreeDRangeNode | StructuredReferenceNode | InfinityNode;
|
|
120
|
+
/**
|
|
121
|
+
* Named expression reference node
|
|
122
|
+
*/
|
|
123
|
+
export type NamedExpressionNode = ASTNodeBase & {
|
|
124
|
+
type: "named-expression";
|
|
125
|
+
name: string;
|
|
126
|
+
sheetName?: string;
|
|
127
|
+
workbookName?: string;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Error node for parsing errors
|
|
131
|
+
*/
|
|
132
|
+
export type ErrorNode = ASTNodeBase & {
|
|
133
|
+
type: "error";
|
|
134
|
+
error: FormulaError;
|
|
135
|
+
message: string;
|
|
136
|
+
};
|
|
137
|
+
export type EmptyNode = ASTNodeBase & {
|
|
138
|
+
type: "empty";
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Helper function to create a value node
|
|
142
|
+
*/
|
|
143
|
+
export declare function createValueNode(value: CellValue, position?: {
|
|
144
|
+
start: number;
|
|
145
|
+
end: number;
|
|
146
|
+
}): ValueNode;
|
|
147
|
+
export declare function createEmptyNode(position?: {
|
|
148
|
+
start: number;
|
|
149
|
+
end: number;
|
|
150
|
+
}): EmptyNode;
|
|
151
|
+
/**
|
|
152
|
+
* Helper function to create a reference node
|
|
153
|
+
*/
|
|
154
|
+
export declare function createReferenceNode({ address, isAbsolute, position, sheetName, workbookName, }: {
|
|
155
|
+
address: {
|
|
156
|
+
colIndex: number;
|
|
157
|
+
rowIndex: number;
|
|
158
|
+
};
|
|
159
|
+
isAbsolute: {
|
|
160
|
+
col: boolean;
|
|
161
|
+
row: boolean;
|
|
162
|
+
};
|
|
163
|
+
position?: {
|
|
164
|
+
start: number;
|
|
165
|
+
end: number;
|
|
166
|
+
};
|
|
167
|
+
sheetName?: string;
|
|
168
|
+
workbookName?: string;
|
|
169
|
+
}): ReferenceNode;
|
|
170
|
+
/**
|
|
171
|
+
* Helper function to create a range node
|
|
172
|
+
*/
|
|
173
|
+
export declare function createRangeNode({ sheetName, workbookName, range, isAbsolute, position, }: {
|
|
174
|
+
sheetName?: string;
|
|
175
|
+
workbookName?: string;
|
|
176
|
+
range: SpreadsheetRange;
|
|
177
|
+
isAbsolute: RangeNode["isAbsolute"];
|
|
178
|
+
position?: {
|
|
179
|
+
start: number;
|
|
180
|
+
end: number;
|
|
181
|
+
};
|
|
182
|
+
}): RangeNode;
|
|
183
|
+
/**
|
|
184
|
+
* Helper function to create a function node
|
|
185
|
+
*/
|
|
186
|
+
export declare function createFunctionNode(name: string, args: ASTNode[], position?: {
|
|
187
|
+
start: number;
|
|
188
|
+
end: number;
|
|
189
|
+
}): FunctionNode;
|
|
190
|
+
/**
|
|
191
|
+
* Helper function to create a unary operator node
|
|
192
|
+
*/
|
|
193
|
+
export declare function createUnaryOpNode(operator: UnaryOpNode["operator"], operand: ASTNode, position?: {
|
|
194
|
+
start: number;
|
|
195
|
+
end: number;
|
|
196
|
+
}): UnaryOpNode;
|
|
197
|
+
/**
|
|
198
|
+
* Helper function to create a binary operator node
|
|
199
|
+
*/
|
|
200
|
+
export declare function createBinaryOpNode(operator: BinaryOpNode["operator"], left: ASTNode, right: ASTNode, position?: {
|
|
201
|
+
start: number;
|
|
202
|
+
end: number;
|
|
203
|
+
}): BinaryOpNode;
|
|
204
|
+
/**
|
|
205
|
+
* Helper function to create an array node
|
|
206
|
+
*/
|
|
207
|
+
export declare function createArrayNode(elements: ASTNode[][], position?: {
|
|
208
|
+
start: number;
|
|
209
|
+
end: number;
|
|
210
|
+
}): ArrayNode;
|
|
211
|
+
/**
|
|
212
|
+
* Helper function to create a named expression node
|
|
213
|
+
*/
|
|
214
|
+
export declare function createNamedExpressionNode(name: string, position?: {
|
|
215
|
+
start: number;
|
|
216
|
+
end: number;
|
|
217
|
+
}, sheetName?: string, workbookName?: string): NamedExpressionNode;
|
|
218
|
+
/**
|
|
219
|
+
* Helper function to create an error node
|
|
220
|
+
*/
|
|
221
|
+
export declare function createErrorNode(error: FormulaError, message: string, position?: {
|
|
222
|
+
start: number;
|
|
223
|
+
end: number;
|
|
224
|
+
}): ErrorNode;
|
|
225
|
+
/**
|
|
226
|
+
* Helper function to create a 3D range node
|
|
227
|
+
*/
|
|
228
|
+
export declare function createThreeDRangeNode(startSheet: string, endSheet: string, reference: ReferenceNode | RangeNode, position?: {
|
|
229
|
+
start: number;
|
|
230
|
+
end: number;
|
|
231
|
+
}, workbookName?: string): ThreeDRangeNode;
|
|
232
|
+
/**
|
|
233
|
+
* Helper function to create a structured reference node
|
|
234
|
+
*/
|
|
235
|
+
export declare function createStructuredReferenceNode({ tableName, sheetName, workbookName, cols, selector, isCurrentRow, position, }: {
|
|
236
|
+
tableName?: string;
|
|
237
|
+
sheetName?: string;
|
|
238
|
+
workbookName?: string;
|
|
239
|
+
cols?: {
|
|
240
|
+
startCol: string;
|
|
241
|
+
endCol: string;
|
|
242
|
+
};
|
|
243
|
+
selector?: "#All" | "#Data" | "#Headers";
|
|
244
|
+
isCurrentRow?: boolean;
|
|
245
|
+
position?: {
|
|
246
|
+
start: number;
|
|
247
|
+
end: number;
|
|
248
|
+
};
|
|
249
|
+
}): StructuredReferenceNode;
|
|
250
|
+
/**
|
|
251
|
+
* Helper function to create an infinity node
|
|
252
|
+
*/
|
|
253
|
+
export declare function createInfinityNode(position?: {
|
|
254
|
+
start: number;
|
|
255
|
+
end: number;
|
|
256
|
+
}): InfinityNode;
|
|
257
|
+
/**
|
|
258
|
+
* AST visitor interface for traversing the tree
|
|
259
|
+
*/
|
|
260
|
+
export interface ASTVisitor<T = void> {
|
|
261
|
+
visitValue?(node: ValueNode): T;
|
|
262
|
+
visitReference?(node: ReferenceNode): T;
|
|
263
|
+
visitRange?(node: RangeNode): T;
|
|
264
|
+
visitFunction?(node: FunctionNode): T;
|
|
265
|
+
visitUnaryOp?(node: UnaryOpNode): T;
|
|
266
|
+
visitBinaryOp?(node: BinaryOpNode): T;
|
|
267
|
+
visitArray?(node: ArrayNode): T;
|
|
268
|
+
visitNamedExpression?(node: NamedExpressionNode): T;
|
|
269
|
+
visitError?(node: ErrorNode): T;
|
|
270
|
+
visitEmpty?(node: EmptyNode): T;
|
|
271
|
+
visitThreeDRange?(node: ThreeDRangeNode): T;
|
|
272
|
+
visitStructuredReference?(node: StructuredReferenceNode): T;
|
|
273
|
+
visitInfinity?(node: InfinityNode): T;
|
|
274
|
+
}
|
|
275
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SerializedCellValue } from "../core/types";
|
|
2
|
+
import type { ASTNode } from "./ast";
|
|
3
|
+
export declare function astToString(ast: ASTNode): string;
|
|
4
|
+
export declare function formatFormula(formula: string): string;
|
|
5
|
+
export declare function normalizeSerializedCellValue(value: SerializedCellValue): SerializedCellValue;
|
|
6
|
+
export declare function isSerializedCellValueEqual(a: SerializedCellValue, b: SerializedCellValue): boolean;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grammar rules and operator precedence for formula parsing
|
|
3
|
+
*/
|
|
4
|
+
import type { BinaryOpNode } from "./ast";
|
|
5
|
+
/**
|
|
6
|
+
* Operator precedence levels (higher number = higher precedence)
|
|
7
|
+
*/
|
|
8
|
+
export declare const OPERATOR_PRECEDENCE: Record<string, number>;
|
|
9
|
+
/**
|
|
10
|
+
* Operator associativity
|
|
11
|
+
*/
|
|
12
|
+
type Associativity = "left" | "right";
|
|
13
|
+
export declare const OPERATOR_ASSOCIATIVITY: Record<string, Associativity>;
|
|
14
|
+
/**
|
|
15
|
+
* Check if a string is a valid binary operator
|
|
16
|
+
*/
|
|
17
|
+
export declare function isBinaryOperator(op: string): op is BinaryOpNode["operator"];
|
|
18
|
+
/**
|
|
19
|
+
* Get operator precedence
|
|
20
|
+
*/
|
|
21
|
+
export declare function getOperatorPrecedence(op: string): number;
|
|
22
|
+
/**
|
|
23
|
+
* Get operator associativity
|
|
24
|
+
*/
|
|
25
|
+
export declare function getOperatorAssociativity(op: string): Associativity;
|
|
26
|
+
/**
|
|
27
|
+
* Compare operator precedence
|
|
28
|
+
* Returns:
|
|
29
|
+
* - positive if op1 has higher precedence than op2
|
|
30
|
+
* - negative if op1 has lower precedence than op2
|
|
31
|
+
* - 0 if they have the same precedence
|
|
32
|
+
*/
|
|
33
|
+
export declare function compareOperatorPrecedence(op1: string, op2: string): number;
|
|
34
|
+
/**
|
|
35
|
+
* Built-in function names that don't require parentheses in some contexts
|
|
36
|
+
*/
|
|
37
|
+
export declare const SPECIAL_FUNCTIONS: Set<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Special constants
|
|
40
|
+
*/
|
|
41
|
+
export declare const SPECIAL_CONSTANTS: Set<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Functions that accept variable number of arguments
|
|
44
|
+
*/
|
|
45
|
+
export declare const VARIADIC_FUNCTIONS: Set<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Functions that require at least one argument
|
|
48
|
+
*/
|
|
49
|
+
export declare const REQUIRED_ARG_FUNCTIONS: Set<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Reserved keywords that cannot be used as names
|
|
52
|
+
*/
|
|
53
|
+
export declare const RESERVED_KEYWORDS: Set<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Check if a name is a reserved keyword
|
|
56
|
+
*/
|
|
57
|
+
export declare function isReservedKeyword(name: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Grammar production rules (in BNF-like notation):
|
|
60
|
+
*
|
|
61
|
+
* Formula ::= Expression
|
|
62
|
+
*
|
|
63
|
+
* Expression ::= ComparisonExpr
|
|
64
|
+
*
|
|
65
|
+
* ComparisonExpr ::= ConcatExpr (ComparisonOp ConcatExpr)*
|
|
66
|
+
* ComparisonOp ::= '=' | '<>' | '<' | '>' | '<=' | '>='
|
|
67
|
+
*
|
|
68
|
+
* ConcatExpr ::= AddExpr ('&' AddExpr)*
|
|
69
|
+
*
|
|
70
|
+
* AddExpr ::= MultExpr (AddOp MultExpr)*
|
|
71
|
+
* AddOp ::= '+' | '-'
|
|
72
|
+
*
|
|
73
|
+
* MultExpr ::= PowerExpr (MultOp PowerExpr)*
|
|
74
|
+
* MultOp ::= '*' | '/'
|
|
75
|
+
*
|
|
76
|
+
* PowerExpr ::= UnaryExpr ('^' PowerExpr)? // Right associative
|
|
77
|
+
*
|
|
78
|
+
* UnaryExpr ::= UnaryOp UnaryExpr | PostfixExpr
|
|
79
|
+
* UnaryOp ::= '+' | '-'
|
|
80
|
+
*
|
|
81
|
+
* PostfixExpr ::= PrimaryExpr ('%')?
|
|
82
|
+
*
|
|
83
|
+
* PrimaryExpr ::= Number
|
|
84
|
+
* | String
|
|
85
|
+
* | Boolean
|
|
86
|
+
* | Error
|
|
87
|
+
* | CellReference
|
|
88
|
+
* | RangeReference
|
|
89
|
+
* | NamedExpression
|
|
90
|
+
* | FunctionCall
|
|
91
|
+
* | ArrayLiteral
|
|
92
|
+
* | '(' Expression ')'
|
|
93
|
+
*
|
|
94
|
+
* CellReference ::= (SheetName '!')? AbsoluteIndicator? Column AbsoluteIndicator? Row
|
|
95
|
+
* RangeReference ::= CellReference ':' CellReference
|
|
96
|
+
*
|
|
97
|
+
* SheetName ::= Identifier | '\'' AnyCharsExceptQuote '\''
|
|
98
|
+
* AbsoluteIndicator ::= '$'
|
|
99
|
+
*
|
|
100
|
+
* NamedExpression ::= Identifier // Not followed by '(' or ':'
|
|
101
|
+
*
|
|
102
|
+
* FunctionCall ::= FunctionName '(' ArgumentList? ')'
|
|
103
|
+
* ArgumentList ::= Expression (',' Expression)*
|
|
104
|
+
*
|
|
105
|
+
* ArrayLiteral ::= '{' ArrayRows '}'
|
|
106
|
+
* ArrayRows ::= ArrayRow (';' ArrayRow)*
|
|
107
|
+
* ArrayRow ::= Expression (',' Expression)*
|
|
108
|
+
*
|
|
109
|
+
* Number ::= [+-]? [0-9]+ ('.' [0-9]+)? ([eE] [+-]? [0-9]+)?
|
|
110
|
+
* String ::= '"' (AnyCharExceptQuote | '""')* '"'
|
|
111
|
+
* Boolean ::= 'TRUE' | 'FALSE'
|
|
112
|
+
* Error ::= '#DIV/0!' | '#N/A' | '#NAME?' | '#NUM!' | '#REF!' | '#VALUE!' | '#CYCLE!' | '#ERROR!'
|
|
113
|
+
* Identifier ::= [A-Za-z_][A-Za-z0-9_]*
|
|
114
|
+
* FunctionName ::= Identifier
|
|
115
|
+
*/
|
|
116
|
+
/**
|
|
117
|
+
* Cell reference patterns
|
|
118
|
+
*/
|
|
119
|
+
export declare const CELL_REFERENCE_PATTERNS: {
|
|
120
|
+
COLUMN: RegExp;
|
|
121
|
+
COLUMN_WITH_ABSOLUTE: RegExp;
|
|
122
|
+
ROW: RegExp;
|
|
123
|
+
ROW_WITH_ABSOLUTE: RegExp;
|
|
124
|
+
CELL: RegExp;
|
|
125
|
+
SHEET_QUALIFIED: RegExp;
|
|
126
|
+
SHEET_RANGE_QUALIFIED: RegExp;
|
|
127
|
+
INFINITE_COLUMN: RegExp;
|
|
128
|
+
INFINITE_ROW: RegExp;
|
|
129
|
+
OPEN_ENDED_INFINITY: RegExp;
|
|
130
|
+
OPEN_ENDED_COLUMN: RegExp;
|
|
131
|
+
OPEN_ENDED_ROW: RegExp;
|
|
132
|
+
TABLE_REFERENCE: RegExp;
|
|
133
|
+
CURRENT_ROW_REFERENCE: RegExp;
|
|
134
|
+
TABLE_SELECTOR: RegExp;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Validate a column reference
|
|
138
|
+
*/
|
|
139
|
+
export declare function isValidColumn(col: string): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Validate a row reference
|
|
142
|
+
*/
|
|
143
|
+
export declare function isValidRow(row: string): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Parse a cell reference into components
|
|
146
|
+
*/
|
|
147
|
+
interface ParsedCellReference {
|
|
148
|
+
sheet?: string;
|
|
149
|
+
colAbsolute: boolean;
|
|
150
|
+
col: string;
|
|
151
|
+
rowAbsolute: boolean;
|
|
152
|
+
row: string;
|
|
153
|
+
}
|
|
154
|
+
interface ParsedInfiniteRange {
|
|
155
|
+
sheet?: string;
|
|
156
|
+
type: "column" | "row";
|
|
157
|
+
startAbsolute: boolean;
|
|
158
|
+
start: string;
|
|
159
|
+
endAbsolute: boolean;
|
|
160
|
+
end: string;
|
|
161
|
+
}
|
|
162
|
+
export declare function parseCellReference(ref: string): ParsedCellReference | null;
|
|
163
|
+
export declare function parseInfiniteRange(ref: string): ParsedInfiniteRange | null;
|
|
164
|
+
/**
|
|
165
|
+
* Parse open-ended range patterns (A5:INFINITY, A5:D, A5:15)
|
|
166
|
+
*/
|
|
167
|
+
interface ParsedOpenEndedRange {
|
|
168
|
+
sheet?: string;
|
|
169
|
+
type: "infinity" | "column-bounded" | "row-bounded";
|
|
170
|
+
startCol: string;
|
|
171
|
+
startRow: string;
|
|
172
|
+
startColAbsolute: boolean;
|
|
173
|
+
startRowAbsolute: boolean;
|
|
174
|
+
endCol?: string;
|
|
175
|
+
endRow?: string;
|
|
176
|
+
endColAbsolute?: boolean;
|
|
177
|
+
endRowAbsolute?: boolean;
|
|
178
|
+
}
|
|
179
|
+
export declare function parseOpenEndedRange(ref: string): ParsedOpenEndedRange | null;
|
|
180
|
+
/**
|
|
181
|
+
* Parse a 3D range reference (e.g., Sheet1:Sheet3!A1)
|
|
182
|
+
*/
|
|
183
|
+
interface Parsed3DReference {
|
|
184
|
+
startSheet: string;
|
|
185
|
+
endSheet: string;
|
|
186
|
+
reference: string;
|
|
187
|
+
}
|
|
188
|
+
export declare function parse3DReference(ref: string): Parsed3DReference | null;
|
|
189
|
+
/**
|
|
190
|
+
* Parse a structured reference (e.g., Table1[Column1])
|
|
191
|
+
*/
|
|
192
|
+
interface ParsedStructuredReference {
|
|
193
|
+
tableName: string;
|
|
194
|
+
columnSpec: string;
|
|
195
|
+
isCurrentRow?: boolean;
|
|
196
|
+
selector?: string;
|
|
197
|
+
cols?: {
|
|
198
|
+
startCol: string;
|
|
199
|
+
endCol: string;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
export declare function parseStructuredReference(ref: string): ParsedStructuredReference | null;
|
|
203
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lexer for tokenizing formula strings
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Token types for formula lexing
|
|
6
|
+
*/
|
|
7
|
+
export type TokenType = 'NUMBER' | 'STRING' | 'BOOLEAN' | 'IDENTIFIER' | 'FUNCTION' | 'OPERATOR' | 'LPAREN' | 'RPAREN' | 'LBRACE' | 'RBRACE' | 'LBRACKET' | 'RBRACKET' | 'COMMA' | 'SEMICOLON' | 'COLON' | 'DOLLAR' | 'EXCLAMATION' | 'AT' | 'HASH' | 'INFINITY' | 'ERROR' | 'EOF' | 'WHITESPACE';
|
|
8
|
+
/**
|
|
9
|
+
* Token interface
|
|
10
|
+
*/
|
|
11
|
+
export interface Token {
|
|
12
|
+
type: TokenType;
|
|
13
|
+
value: string;
|
|
14
|
+
position: {
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Lexer class for tokenizing formula strings
|
|
21
|
+
*/
|
|
22
|
+
export declare class Lexer {
|
|
23
|
+
private input;
|
|
24
|
+
private position;
|
|
25
|
+
private tokens;
|
|
26
|
+
constructor(input: string);
|
|
27
|
+
/**
|
|
28
|
+
* Tokenize the entire input string
|
|
29
|
+
*/
|
|
30
|
+
tokenize(): Token[];
|
|
31
|
+
/**
|
|
32
|
+
* Get the next token from the input
|
|
33
|
+
*/
|
|
34
|
+
private nextToken;
|
|
35
|
+
/**
|
|
36
|
+
* Read a whitespace token
|
|
37
|
+
*/
|
|
38
|
+
private readWhitespace;
|
|
39
|
+
/**
|
|
40
|
+
* Read a number token
|
|
41
|
+
*/
|
|
42
|
+
private readNumber;
|
|
43
|
+
/**
|
|
44
|
+
* Read a string token (enclosed in double quotes)
|
|
45
|
+
*/
|
|
46
|
+
private readString;
|
|
47
|
+
/**
|
|
48
|
+
* Read a sheet name (enclosed in single quotes)
|
|
49
|
+
*/
|
|
50
|
+
private readSheetName;
|
|
51
|
+
/**
|
|
52
|
+
* Read an error token (e.g., #DIV/0!)
|
|
53
|
+
*/
|
|
54
|
+
private readError;
|
|
55
|
+
/**
|
|
56
|
+
* Read an identifier (cell reference, function name, boolean)
|
|
57
|
+
*/
|
|
58
|
+
private readIdentifier;
|
|
59
|
+
/**
|
|
60
|
+
* Check if current position is whitespace
|
|
61
|
+
*/
|
|
62
|
+
private isWhitespace;
|
|
63
|
+
/**
|
|
64
|
+
* Check if a character is whitespace
|
|
65
|
+
*/
|
|
66
|
+
private isWhitespaceChar;
|
|
67
|
+
/**
|
|
68
|
+
* Check if a character is a digit
|
|
69
|
+
*/
|
|
70
|
+
private isDigit;
|
|
71
|
+
/**
|
|
72
|
+
* Check if a character is alphabetic
|
|
73
|
+
*/
|
|
74
|
+
private isAlpha;
|
|
75
|
+
/**
|
|
76
|
+
* Check if a character is alphanumeric
|
|
77
|
+
*/
|
|
78
|
+
private isAlnum;
|
|
79
|
+
/**
|
|
80
|
+
* Check if a character can be part of an identifier
|
|
81
|
+
* This includes letters, certain symbols that are commonly used in column names
|
|
82
|
+
*/
|
|
83
|
+
private isIdentifierChar;
|
|
84
|
+
/**
|
|
85
|
+
* Peek ahead to check if we have a table selector
|
|
86
|
+
*/
|
|
87
|
+
private peekSelector;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Quick tokenization function
|
|
91
|
+
*/
|
|
92
|
+
export declare function tokenize(input: string): Token[];
|
|
93
|
+
/**
|
|
94
|
+
* Token stream for parser consumption
|
|
95
|
+
*/
|
|
96
|
+
export declare class TokenStream {
|
|
97
|
+
private tokens;
|
|
98
|
+
private position;
|
|
99
|
+
constructor(tokens: Token[]);
|
|
100
|
+
/**
|
|
101
|
+
* Peek at current token without consuming
|
|
102
|
+
*/
|
|
103
|
+
peek(): Token;
|
|
104
|
+
/**
|
|
105
|
+
* Peek ahead by n tokens
|
|
106
|
+
*/
|
|
107
|
+
peekAhead(n: number): Token | null;
|
|
108
|
+
/**
|
|
109
|
+
* Peek at the next token without consuming
|
|
110
|
+
*/
|
|
111
|
+
peekNext(): Token | null;
|
|
112
|
+
/**
|
|
113
|
+
* Consume current token and advance
|
|
114
|
+
*/
|
|
115
|
+
consume(): Token;
|
|
116
|
+
/**
|
|
117
|
+
* Check if current token matches type
|
|
118
|
+
*/
|
|
119
|
+
match(type: TokenType): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Check if current token matches value
|
|
122
|
+
*/
|
|
123
|
+
matchValue(value: string): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Consume token if it matches type
|
|
126
|
+
*/
|
|
127
|
+
consumeIf(type: TokenType): Token | null;
|
|
128
|
+
/**
|
|
129
|
+
* Check if at end of stream
|
|
130
|
+
*/
|
|
131
|
+
isAtEnd(): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Get current position in stream
|
|
134
|
+
*/
|
|
135
|
+
getPosition(): number;
|
|
136
|
+
/**
|
|
137
|
+
* Set position in stream
|
|
138
|
+
*/
|
|
139
|
+
setPosition(position: number): void;
|
|
140
|
+
/**
|
|
141
|
+
* Get all tokens
|
|
142
|
+
*/
|
|
143
|
+
getTokens(): Token[];
|
|
144
|
+
}
|