修改构建方式,升级peg为0.10.0
This commit is contained in:
		
							
								
								
									
										20
									
								
								peg/build.js
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								peg/build.js
									
									
									
									
									
								
							@ -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))
 | 
			
		||||
    }
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@ -278,7 +278,7 @@ table_name
 | 
			
		||||
        db : '',
 | 
			
		||||
        table : dt
 | 
			
		||||
      }
 | 
			
		||||
      if (tail != '') {
 | 
			
		||||
      if (tail) {
 | 
			
		||||
        obj.db = dt;
 | 
			
		||||
        obj.table = tail[3];
 | 
			
		||||
      } 
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user