diff --git a/packages/engine-formula/src/engine/analysis/__tests__/lexer-tree-builder.spec.ts b/packages/engine-formula/src/engine/analysis/__tests__/lexer-tree-builder.spec.ts index ab094e35d54..0d36b910405 100644 --- a/packages/engine-formula/src/engine/analysis/__tests__/lexer-tree-builder.spec.ts +++ b/packages/engine-formula/src/engine/analysis/__tests__/lexer-tree-builder.spec.ts @@ -196,6 +196,16 @@ describe('lexer nodeMaker test', () => { const node = lexerTreeBuilder.treeBuilder('=(TODAY())') as LexerNode; expect(JSON.stringify(node.serialize())).toStrictEqual('{"token":"R_1","st":-1,"ed":-1,"children":[{"token":"TODAY","st":1,"ed":5,"children":[]}]}'); }); + + it('array parameter number', () => { + const node = lexerTreeBuilder.treeBuilder('={-700000,120000,150000,180000,210000,260000}') as LexerNode; + expect(JSON.stringify(node.serialize())).toStrictEqual('{"token":"R_1","st":-1,"ed":-1,"children":["{-700000,120000,150000,180000,210000,260000}"]}'); + }); + + it('array parameter string', () => { + const node = lexerTreeBuilder.treeBuilder('={"2007/1/1", "2008/1/1"}') as LexerNode; + expect(JSON.stringify(node.serialize())).toStrictEqual('{"token":"R_1","st":-1,"ed":-1,"children":["{\\"2007/1/1\\", \\"2008/1/1\\"}"]}'); + }); }); describe('check error', () => { diff --git a/packages/engine-formula/src/engine/analysis/lexer-tree-builder.ts b/packages/engine-formula/src/engine/analysis/lexer-tree-builder.ts index 7d334ab68db..ffa4da47b29 100644 --- a/packages/engine-formula/src/engine/analysis/lexer-tree-builder.ts +++ b/packages/engine-formula/src/engine/analysis/lexer-tree-builder.ts @@ -1192,7 +1192,6 @@ export class LexerTreeBuilder extends Disposable { } else if ( currentString === matchToken.DOUBLE_QUOTATION && this.isSingleQuotationClose() && - this.isBracesClose() && this.isSquareBracketClose() ) { if (this.isDoubleQuotationClose()) { @@ -1373,7 +1372,8 @@ export class LexerTreeBuilder extends Disposable { this._checkSimilarErrorToken(currentString, cur, formulaStringArray) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && - this.isSquareBracketClose() + this.isSquareBracketClose() && + this.isBracesClose() ) { this._pushNodeToChildren(this._segment); @@ -1398,7 +1398,8 @@ export class LexerTreeBuilder extends Disposable { OPERATOR_TOKEN_SET.has(currentString) && this.isSingleQuotationClose() && this.isDoubleQuotationClose() && - this.isSquareBracketClose() + this.isSquareBracketClose() && + this.isBracesClose() ) { let trimSegment = this._segment.trim();