Skip to content

Commit

Permalink
Make jison a dev dependency and ship less files.
Browse files Browse the repository at this point in the history
  • Loading branch information
realityking committed Feb 26, 2019
1 parent 71e7751 commit 2dc36f3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
3 changes: 1 addition & 2 deletions bin/generate_parser.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
var JisonParser = require('jison').Parser;
var grammar = require('../lib/grammar');
var grammar = require('../include/grammar');

var parser = new JisonParser(grammar);
source = parser.generate()

console.log(source)

6 changes: 3 additions & 3 deletions generated/parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions lib/grammar.js → include/grammar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var dict = require('./dict');
var dict = require('../lib/dict');
var fs = require('fs');
var grammar = {

Expand Down Expand Up @@ -98,9 +98,8 @@ var grammar = {
[ 'Q_STRING', "$$ = $1" ] ]
}
};
if (fs.readFileSync) {
grammar.moduleInclude = fs.readFileSync(require.resolve("../include/module.js"));
grammar.actionInclude = fs.readFileSync(require.resolve("../include/action.js"));
}

grammar.moduleInclude = fs.readFileSync(require.resolve("./module.js"));
grammar.actionInclude = fs.readFileSync(require.resolve("./action.js"));

module.exports = grammar;
2 changes: 0 additions & 2 deletions lib/parser.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var grammar = require('./grammar');
var gparser = require('../generated/parser');

var Parser = function() {
Expand All @@ -17,5 +16,4 @@ var Parser = function() {

};

Parser.grammar = grammar;
module.exports = Parser;
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
"test": "mocha -u tdd test && jscs lib && jshint lib",
"generate": "node bin/generate_parser.js > generated/parser.js"
},
"files": [
"lib",
"index.js",
"jsonpath.js",
"jsonpath.min.js"
],
"dependencies": {
"esprima": "1.2.2",
"jison": "0.4.13",
"static-eval": "2.0.2",
"underscore": "1.7.0"
},
Expand All @@ -22,6 +27,7 @@
"grunt-browserify": "3.8.0",
"grunt-cli": "0.1.13",
"grunt-contrib-uglify": "0.9.1",
"jison": "0.4.13",
"jscs": "1.10.0",
"jshint": "2.6.0",
"mocha": "2.1.0"
Expand Down

0 comments on commit 2dc36f3

Please sign in to comment.