Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f703624
commit d896a74
Showing
6 changed files
with
3,856 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.coverage | ||
flow-typed | ||
lib/vendor | ||
lib/utils/parseCalcExpression/parser.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.coverage | ||
flow-typed | ||
lib/utils/parseCalcExpression/parser.js |
2 changes: 1 addition & 1 deletion
2
...ils/__tests__/parseCalcExpression.test.js → ...ion/__tests__/parseCalcExpression.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,11 @@ | ||
"use strict"; | ||
|
||
const fs = require("fs"); | ||
const jison = require("jison-gho"); | ||
// To generate parser.js run the following command in the current directory: | ||
// | ||
// npx jison-gho parser.jison -o parser.js | ||
|
||
let parser; | ||
const parse = require("./parser").parse; | ||
|
||
module.exports = function(exp) { | ||
if (!parser) { | ||
const parserConfig = fs.readFileSync( | ||
require.resolve("./parser.jison"), | ||
"utf8" | ||
); | ||
|
||
parser = new jison.Parser(parserConfig); | ||
} | ||
|
||
return parser.parse(exp); | ||
module.exports = function parseCalcExpression(exp) { | ||
return parse(exp); | ||
}; |
Oops, something went wrong.