UNPKG

@borgar/fx

Version:

Utilities for working with Excel formulas

56 lines (53 loc) 3.68 kB
import { T as Token, a as TokenEnhanced } from '../index-B2o6kb59.cjs'; export { A as ArrayExpression, b as AstExpression, B as BinaryExpression, c as BinaryOperator, C as CallExpression, E as ErrorLiteral, I as Identifier, L as LambdaExpression, d as LetDeclarator, e as LetExpression, f as Literal, M as MAX_COLS, g as MAX_ROWS, N as Node, O as OptsFixRanges, h as OptsParse, i as OptsParseA1Ref, j as OptsParseR1C1Ref, k as OptsStringifyStructRef, l as OptsTokenize, m as OptsTranslateFormulaToA1, n as OptsTranslateToR1C1, o as OptsTranslateTokensToA1, R as RangeA1, p as RangeR1C1, q as ReferenceA1, r as ReferenceA1Xlsx, s as ReferenceIdentifier, t as ReferenceName, u as ReferenceNameXlsx, v as ReferenceR1C1, w as ReferenceR1C1Xlsx, x as ReferenceStruct, y as ReferenceStructXlsx, S as SourceLocation, U as UnaryExpression, z as UnaryOperator, D as addA1RangeBounds, F as fixFormulaRanges, G as fixTokenRanges, H as fromCol, J as isArrayNode, K as isBinaryNode, P as isCallNode, Q as isError, V as isErrorNode, W as isExpressionNode, X as isFunction, Y as isFxPrefix, Z as isIdentifierNode, _ as isLambdaNode, $ as isLetDeclaratorNode, a0 as isLetNode, a1 as isLiteral, a2 as isLiteralNode, a3 as isOperator, a4 as isRange, a5 as isReference, a6 as isReferenceNode, a7 as isUnaryNode, a8 as isWhitespace, a9 as mergeRefTokens, aa as nodeTypes, ab as parse, ac as parseA1Range, ad as parseA1Ref, ae as parseR1C1Range, af as parseR1C1Ref, ag as parseStructRef, ah as stringifyA1Ref, ai as stringifyR1C1Ref, aj as stringifyStructRef, ak as stringifyTokens, al as toCol, am as tokenTypes, an as tokenize, ao as translateFormulaToA1, ap as translateFormulaToR1C1, aq as translateTokensToA1, ar as translateTokensToR1C1 } from '../index-B2o6kb59.cjs'; /** * Runs through a list of tokens and adds extra attributes such as matching * parens and ranges. * * The `context` parameter defines default reference attributes: * `{ workbookName: 'report.xlsx', sheetName: 'Sheet1' }`. * If supplied, these are used to match `A1` to `Sheet1!A1`. * * All tokens will be tagged with a `.depth` number value to indicating the * level of nesting in parentheses as well as an `.index` number indicating * their zero based position in the list. * * The returned output will be the same array of tokens but the following * properties will added to tokens (as applicable): * * #### Parentheses ( ) * * Matching parens will be tagged with `.groupId` string identifier as well as * a `.depth` number value (indicating the level of nesting). * * Closing parens without a counterpart will be tagged with `.error` * (boolean true). * * #### Curly brackets { } * * Matching curly brackets will be tagged with `.groupId` string identifier. * These may not be nested in Excel. * * Closing curly brackets without a counterpart will be tagged with `.error` * (boolean `true`). * * #### Ranges (`REF_RANGE` or `REF_BEAM` type tokens) * * All ranges will be tagged with `.groupId` string identifier regardless of * the number of times they occur. * * #### Tokens of type `UNKNOWN` * * All will be tagged with `.error` (boolean `true`). * * @param tokenlist An array of tokens (from `tokenize()`) * @param [context={}] A contest used to match `A1` to `Sheet1!A1`. * @param [context.sheetName=''] An implied sheet name ('Sheet1') * @param [context.workbookName=''] An implied workbook name ('report.xlsx') * @returns The input array with the enchanced tokens */ declare function addTokenMeta(tokenlist: Token[], { sheetName, workbookName }?: { sheetName?: string; workbookName?: string; }): TokenEnhanced[]; export { Token, TokenEnhanced, addTokenMeta };