修改构建方式,升级peg为0.10.0

This commit is contained in:
HSunboy
2018-07-06 16:58:25 +08:00
parent 05d679d368
commit 4d3c998120
6 changed files with 8884 additions and 9281 deletions

View File

@ -2,6 +2,8 @@ const pegjs=require("pegjs");
const path=require("path");
const fs=require("fs");
const ENCODING="utf8"
const files=[{
source:path.resolve(process.cwd(),"./peg/comment.pegjs") ,
target:path.resolve(process.cwd(),"./core/comment.js") ,
@ -10,5 +12,19 @@ const files=[{
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))
}
)

View File

@ -278,7 +278,7 @@ table_name
db : '',
table : dt
}
if (tail != '') {
if (tail) {
obj.db = dt;
obj.table = tail[3];
}