-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
28 lines (24 loc) · 805 Bytes
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
let fs = require("fs");
import {File} from "./[class]File";
// import {Wire} from "./[class]wire";
import {Entity} from "./[class]Entity";
import {VHDLConverter} from "./[class]VHDLConverter";
function processFile(fileName : string){
let text : string = "";
let file : File = new File(fileName);
while(file.tokens.length > 0){
text += VHDLConverter.entityToVHDL(new Entity(file, {mode:"definition"}));
text += "\n\n";
}
if(fileName.endsWith(".shdl"))
fileName = fileName.substring(0, fileName.length - 5);
fileName += ".vhd";
fs.writeFileSync(fileName, text);
}
let inputFiles = [];
for(let aux = 2; aux < process.argv.length; aux ++){
inputFiles.push(process.argv[aux]);
}
for(let aux = 0; aux < inputFiles.length; aux ++){
processFile(inputFiles[aux]);
}