@rowsncolumns/fast-formula-parser 6.2.38 → 6.2.39

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/index.js CHANGED
@@ -44298,9 +44298,16 @@ const FormulaErrorT$1 = createToken({
44298
44298
  /#NULL!|#DIV\/0!|#VALUE!|#NAME\?|#NUM!|#N\/A|#GETTING_DATA|#SPILL!|#CONNECT!|#BLOCKED!|#UNKNOWN!|#FIELD!|#CALC!|#EXTERNAL!/,
44299
44299
  });
44300
44300
 
44301
+ // `Table1[#REF!]` / `Table1[@#REF!]` — the text Excel writes once the referenced table column is
44302
+ // deleted — carries `#REF!` as a COLUMN specifier: `longer_alt` lets `TableColumnName` (defined
44303
+ // below) claim `#REF!]` when the error token is directly closed by `]`. A bare `#REF!` elsewhere
44304
+ // (`=SUM(#REF!)`) stays the error literal.
44305
+ // `#REF!#` is what a structural delete leaves of a spilled-range reference whose anchor row/column
44306
+ // went away (`=C1#` → `=#REF!#`); the postfix stays on the error token so the text still parses
44307
+ // (to the `#REF!` error) instead of an `#ERROR!` syntax failure.
44301
44308
  const RefError$1 = createToken({
44302
44309
  name: "RefError",
44303
- pattern: /#REF!/,
44310
+ pattern: /#REF!#?/,
44304
44311
  });
44305
44312
 
44306
44313
  const Name$1 = createToken({
@@ -44327,12 +44334,17 @@ const Sheet$1 = createToken({
44327
44334
  // `Sales[Q1 '[est']]` for the column named `Q1 [est]`. Defined ahead of `Cell`
44328
44335
  // so it can be its `longer_alt`: a column named like a cell address (`Q1`,
44329
44336
  // `FY24`) must lex as the column specifier, not as a cell reference.
44337
+ // `#REF!` (Excel's specifier for a deleted column) is the one `#`-form admitted as a column name;
44338
+ // every other `#…` inside brackets is a `SpecialItem`.
44330
44339
  const TableColumnName$1 = createToken({
44331
44340
  name: "TableColumnName",
44332
44341
  pattern:
44333
- /(?!,)[\[]?[@]?[\[+]?(?:[@?%A-Za-z_.\d\s(),!@$%^&*+=\-\/$\u007F-\uFFFF]|'[\[\]#'])+\]+(?:(?:\.[a-zA-Z_][a-zA-Z0-9_~?]*(?:\[[0-9]+\])*)+(?:\.(?![^,\s)]))?|\.(?![^,\s)]))?/,
44342
+ /(?!,)[\[]?[@]?[\[+]?(?:#REF!|(?:[@?%A-Za-z_.\d\s(),!@$%^&*+=\-\/$\u007F-\uFFFF]|'[\[\]#'])+)\]+(?:(?:\.[a-zA-Z_][a-zA-Z0-9_~?]*(?:\[[0-9]+\])*)+(?:\.(?![^,\s)]))?|\.(?![^,\s)]))?/,
44334
44343
  });
44335
44344
 
44345
+ // Declared after `TableColumnName` exists (see the `RefError` note above).
44346
+ RefError$1.LONGER_ALT = TableColumnName$1;
44347
+
44336
44348
  const Cell$1 = createToken({
44337
44349
  name: "Cell",
44338
44350
  // Trailing `#` is Excel's "spilled-range operator": e.g. `A1#` resolves
@@ -44998,7 +45010,8 @@ class Parser extends EmbeddedActionsParser {
44998
45010
  },
44999
45011
  {
45000
45012
  ALT: () => {
45001
- const err = $.CONSUME(RefError).image;
45013
+ // `#REF!#` (a broken spilled-range reference) is the `#REF!` error.
45014
+ const err = $.CONSUME(RefError).image.replace(/#$/, "");
45002
45015
  return $.ACTION(() => this.utils.toError(err));
45003
45016
  },
45004
45017
  },
@@ -45185,7 +45198,8 @@ class Parser extends EmbeddedActionsParser {
45185
45198
  // parse the number to row number when needed.
45186
45199
  {
45187
45200
  ALT: () => {
45188
- const err = $.CONSUME(RefError).image;
45201
+ // `#REF!#` (a broken spilled-range reference) is the `#REF!` error.
45202
+ const err = $.CONSUME(RefError).image.replace(/#$/, "");
45189
45203
  return $.ACTION(() => this.utils.toError(err));
45190
45204
  },
45191
45205
  },