LesterLyu / fast-formula-parser

Parse and evaluate MS Excel formula in javascript.
https://www.npmjs.com/package/fast-formula-parser
MIT License
454 stars 63 forks source link

Wrong error codes #15

Closed rmdort closed 4 years ago

rmdort commented 4 years ago

Some error codes are wrongs

  1. Empty arguments - Expected FormulaError { _error: '#NA!' }
console.log(parser.parse('SUM()', {sheet: 'Sheet 1', row: 1, col: 1}));

Received - Error: Argument type 0 is missing.

  1. Unknown function - Expected FormulaError { _error: '#NAME?' }
console.log(parser.parse('SUMABC()', {sheet: 'Sheet 1', row: 1, col: 1}));

Received Error: Function SUMS is not implemented.

LesterLyu commented 4 years ago

I'll look into it.

rmdort commented 4 years ago

Opened a PR to fix this https://github.com/LesterLyu/fast-formula-parser/pull/16

rmdort commented 4 years ago

Noticed that SUM(*() does not throw standard formula error

LesterLyu commented 4 years ago

Should be fixed in the new release 👍

rmdort commented 4 years ago

In the new release i get TypeError for SUM(*()

LesterLyu commented 4 years ago

I cannot reproduce the error: https://github.com/LesterLyu/fast-formula-parser/blob/master/test/grammar/errors.js#L92

rmdort commented 4 years ago

Oh. It was the dependency parser throwing TypeError.

const depParser = new DepParser()
depParser.parse('SUM(*()', { sheet: 'Sheet1', row: 1, col: 1})
LesterLyu commented 4 years ago

OK, fixed. https://github.com/LesterLyu/fast-formula-parser/releases/tag/1.0.15

rmdort commented 4 years ago

Great. thanks