修改构建方式,升级peg为0.10.0
This commit is contained in:
parent
05d679d368
commit
4d3c998120
16062
core/astParser.js
16062
core/astParser.js
File diff suppressed because it is too large
Load Diff
2069
core/comment.js
2069
core/comment.js
File diff suppressed because it is too large
Load Diff
6
package-lock.json
generated
6
package-lock.json
generated
@ -11,9 +11,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"pegjs": {
|
"pegjs": {
|
||||||
"version": "0.7.0",
|
"version": "0.10.0",
|
||||||
"resolved": "http://registry.npm.taobao.org/pegjs/download/pegjs-0.7.0.tgz",
|
"resolved": "http://registry.npm.taobao.org/pegjs/download/pegjs-0.10.0.tgz",
|
||||||
"integrity": "sha1-qqH4JPnnGX7ETiKlevUi9wDdaJ4=",
|
"integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
"description": "sql parser",
|
"description": "sql parser",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:parse": "pegjs peg/nquery.pegjs core/astParser.js",
|
"build:parse": "pegjs -o core/astParser.js peg/nquery.pegjs ",
|
||||||
"build:filter":"pegjs peg/comment.pegjs core/comment.js"
|
"build:filter": "pegjs -o core/comment.js peg/comment.pegjs "
|
||||||
},
|
},
|
||||||
"author": "xiaokang",
|
"author": "xiaokang",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"node-query": "^0.3.3",
|
"node-query": "^0.3.3",
|
||||||
"pegjs": "^0.7.0"
|
"pegjs": "^0.10.0"
|
||||||
},
|
},
|
||||||
"dependencies": {}
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
20
peg/build.js
20
peg/build.js
@ -2,6 +2,8 @@ const pegjs=require("pegjs");
|
|||||||
const path=require("path");
|
const path=require("path");
|
||||||
const fs=require("fs");
|
const fs=require("fs");
|
||||||
|
|
||||||
|
const ENCODING="utf8"
|
||||||
|
|
||||||
const files=[{
|
const files=[{
|
||||||
source:path.resolve(process.cwd(),"./peg/comment.pegjs") ,
|
source:path.resolve(process.cwd(),"./peg/comment.pegjs") ,
|
||||||
target:path.resolve(process.cwd(),"./core/comment.js") ,
|
target:path.resolve(process.cwd(),"./core/comment.js") ,
|
||||||
@ -10,5 +12,19 @@ const files=[{
|
|||||||
target:path.resolve(process.cwd(),"./core/astParser.js") ,
|
target:path.resolve(process.cwd(),"./core/astParser.js") ,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
const file=fs.readFileSync(files[0].source,{encoding:"utf8"})
|
|
||||||
pegjs.buildParser(file);
|
function writeIn(file,data){
|
||||||
|
fs.writeFileSync(file,data,{encoding:ENCODING})
|
||||||
|
}
|
||||||
|
function build(content){
|
||||||
|
return pegjs.generate(content,{
|
||||||
|
output:"source",
|
||||||
|
format:"umd"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
files.forEach(
|
||||||
|
(file)=>{
|
||||||
|
let fileContent=fs.readFileSync(file.source,{encoding:ENCODING})
|
||||||
|
writeIn(file.target,build(fileContent))
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@ -278,7 +278,7 @@ table_name
|
|||||||
db : '',
|
db : '',
|
||||||
table : dt
|
table : dt
|
||||||
}
|
}
|
||||||
if (tail != '') {
|
if (tail) {
|
||||||
obj.db = dt;
|
obj.db = dt;
|
||||||
obj.table = tail[3];
|
obj.table = tail[3];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user