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