Skip to content

Commit

Permalink
Remove jison-gho dependency (#3915)
Browse files Browse the repository at this point in the history
  • Loading branch information
hudochenkov authored and jeddy3 committed Jan 19, 2019
1 parent f703624 commit d896a74
Show file tree
Hide file tree
Showing 6 changed files with 3,856 additions and 17 deletions.
1 change: 1 addition & 0 deletions .eslintignore
@@ -1,3 +1,4 @@
.coverage
flow-typed
lib/vendor
lib/utils/parseCalcExpression/parser.js
1 change: 1 addition & 0 deletions .prettierignore
@@ -1,2 +1,3 @@
.coverage
flow-typed
lib/utils/parseCalcExpression/parser.js
@@ -1,6 +1,6 @@
"use strict";

const parse = require("../parseCalcExpression");
const parse = require("..");

it("parseCalcExpression parse to ast", () => {
expect(parse("calc(100% - 80px)")).toEqual({
Expand Down
20 changes: 6 additions & 14 deletions lib/utils/parseCalcExpression/index.js
@@ -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);
};

0 comments on commit d896a74

Please sign in to comment.