hot-formula-parser
Advanced tools
Comparing version 1.0.13 to 1.0.14
{ | ||
"name": "hot-formula-parser", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "Formula parser", | ||
@@ -5,0 +5,0 @@ "main": "dist/formula-parser.js", |
@@ -64,3 +64,3 @@ Formula Parser [![Build Status](https://travis-ci.org/handsontable/formula-parser.png?branch=master)](https://travis-ci.org/handsontable/formula-parser) [![Test Coverage](https://codeclimate.com/repos/57739f5a0fbc62007d005f05/badges/35e70c68c984c6d7580b/coverage.svg)](https://codeclimate.com/repos/57739f5a0fbc62007d005f05/coverage) [![hot-formula-parser](https://img.shields.io/npm/v/hot-formula-parser.svg)](https://www.npmjs.com/package/hot-formula-parser) | ||
* `#NUM!` Occurs when formula encounters an invalid number; | ||
* `#VALUE?` Occurs when one of formula arguments is of the wrong type. | ||
* `#VALUE!` Occurs when one of formula arguments is of the wrong type. | ||
@@ -67,0 +67,0 @@ ```js |
@@ -89,3 +89,3 @@ /* parser generated by jison 0.4.17 */ | ||
return $$[$0-1]; | ||
break; | ||
@@ -95,3 +95,3 @@ case 2: | ||
this.$ = yy.callVariable($$[$0][0]); | ||
break; | ||
@@ -101,3 +101,3 @@ case 3: | ||
this.$ = yy.toNumber($$[$0]); | ||
break; | ||
@@ -107,3 +107,3 @@ case 4: | ||
this.$ = yy.trimEdges($$[$0]); | ||
break; | ||
@@ -113,3 +113,3 @@ case 5: | ||
this.$ = yy.evaluateByOperator('&', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -119,3 +119,3 @@ case 6: | ||
this.$ = yy.evaluateByOperator('=', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -125,3 +125,3 @@ case 7: | ||
this.$ = yy.evaluateByOperator('+', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -131,3 +131,3 @@ case 8: | ||
this.$ = yy.toNumber($$[$0-1]); | ||
break; | ||
@@ -137,3 +137,3 @@ case 9: | ||
this.$ = yy.evaluateByOperator('<=', [$$[$0-3], $$[$0]]); | ||
break; | ||
@@ -143,3 +143,3 @@ case 10: | ||
this.$ = yy.evaluateByOperator('>=', [$$[$0-3], $$[$0]]); | ||
break; | ||
@@ -149,3 +149,3 @@ case 11: | ||
this.$ = yy.evaluateByOperator('<>', [$$[$0-3], $$[$0]]); | ||
break; | ||
@@ -155,3 +155,3 @@ case 12: | ||
this.$ = yy.evaluateByOperator('NOT', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -161,3 +161,3 @@ case 13: | ||
this.$ = yy.evaluateByOperator('>', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -167,3 +167,3 @@ case 14: | ||
this.$ = yy.evaluateByOperator('<', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -173,3 +173,3 @@ case 15: | ||
this.$ = yy.evaluateByOperator('-', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -179,3 +179,3 @@ case 16: | ||
this.$ = yy.evaluateByOperator('*', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -185,3 +185,3 @@ case 17: | ||
this.$ = yy.evaluateByOperator('/', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -191,3 +191,3 @@ case 18: | ||
this.$ = yy.evaluateByOperator('^', [$$[$0-2], $$[$0]]); | ||
break; | ||
@@ -203,3 +203,3 @@ case 19: | ||
} | ||
break; | ||
@@ -215,3 +215,3 @@ case 20: | ||
} | ||
break; | ||
@@ -221,3 +221,3 @@ case 21: | ||
this.$ = yy.callFunction($$[$0-2], ''); | ||
break; | ||
@@ -227,3 +227,3 @@ case 22: | ||
this.$ = yy.callFunction($$[$0-3], $$[$0-1]); | ||
break; | ||
@@ -233,3 +233,3 @@ case 26: case 28: case 30: | ||
this.$ = yy.cellValue($$[$0]); | ||
break; | ||
@@ -239,3 +239,3 @@ case 27: case 29: case 31: | ||
this.$ = yy.rangeValue($$[$0-2], $$[$0]); | ||
break; | ||
@@ -245,3 +245,3 @@ case 32: case 36: | ||
this.$ = [$$[$0]]; | ||
break; | ||
@@ -258,3 +258,3 @@ case 33: | ||
this.$ = result; | ||
break; | ||
@@ -265,3 +265,3 @@ case 34: case 35: | ||
this.$ = $$[$0-2]; | ||
break; | ||
@@ -272,3 +272,3 @@ case 37: | ||
this.$.push($$[$0]); | ||
break; | ||
@@ -278,3 +278,3 @@ case 38: | ||
this.$ = $$[$0]; | ||
break; | ||
@@ -284,3 +284,3 @@ case 39: | ||
this.$ = ($$[$0-2] + '.' + $$[$0]) * 1; | ||
break; | ||
@@ -290,8 +290,8 @@ case 40: | ||
this.$ = $$[$0-1] * 0.01; | ||
break; | ||
case 41: case 42: | ||
this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; | ||
this.$ = yy.throwError($$[$0-2] + $$[$0-1] + $$[$0]); | ||
break; | ||
@@ -976,2 +976,3 @@ } | ||
exports.parse = function () { return parser.parse.apply(parser, arguments); }; | ||
if (typeof module !== 'undefined' && require.main === module) { | ||
@@ -978,0 +979,0 @@ exports.main(process.argv.slice(1)); |
@@ -22,2 +22,3 @@ import Emitter from 'tiny-emitter'; | ||
invertNumber, | ||
throwError: (errorName) => this._throwError(errorName), | ||
callVariable: (variable) => this._callVariable(variable), | ||
@@ -175,4 +176,21 @@ evaluateByOperator, | ||
} | ||
/** | ||
* Try to throw error by its name. | ||
* | ||
* @param {String} errorName Error name. | ||
* @returns {String} | ||
* @private | ||
*/ | ||
_throwError(errorName) { | ||
const parsedError = errorParser(errorName); | ||
if (parsedError) { | ||
throw Error(parsedError); | ||
} | ||
return errorName; | ||
} | ||
} | ||
export {Parser}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2267367
19407