Isolate code generation to output different languages

This commit is contained in:
Jordi Baylina
2020-02-04 19:21:37 +01:00
parent 111c91c70d
commit 6c1a3e7687
11 changed files with 1862 additions and 2066 deletions

View File

@@ -15,11 +15,18 @@ module.exports.isDefined = isDefined;
module.exports.accSizes2Str = accSizes2Str;
function ident(text) {
let lines = text.split("\n");
for (let i=0; i<lines.length; i++) {
if (lines[i]) lines[i] = " "+lines[i];
if (typeof text === "string") {
let lines = text.split("\n");
for (let i=0; i<lines.length; i++) {
if (lines[i]) lines[i] = " "+lines[i];
}
return lines.join("\n");
} else if (Array.isArray(text)) {
for (let i=0; i<text.length; i++ ) {
text[i] = ident(text[i]);
}
return text;
}
return lines.join("\n");
}
function extractSizes (o) {