psalaets/excel-formula-ast

strange (incorrect?) whitespace handling

Closed this issue · 1 comments

> tokenize('=1+3*2')
[
  { value: '1+3', type: 'operand', subtype: 'number' },
  { value: '*', type: 'operator-infix', subtype: 'math' },
  { value: '2', type: 'operand', subtype: 'number' }
]
> tokenize('= 1+3*2')
[
  { value: '1', type: 'operand', subtype: 'number' },
  { value: '+', type: 'operator-infix', subtype: 'math' },
  { value: '3', type: 'operand', subtype: 'number' },
  { value: '*', type: 'operator-infix', subtype: 'math' },
  { value: '2', type: 'operand', subtype: 'number' }
]
> buildTree(tokenize('=1+3*2'))
{
  type: 'binary-expression',
  operator: '*',
  left: { type: 'number', value: NaN },
  right: { type: 'number', value: 2 }
}

There was an issue with scientific notation detection in the tokenizer.

This should be fixed by version 2.3.1 of the excel-formula-tokenizer project.

Thanks