Skip to content

Commit c40aa59

Browse files
committed
remove console.log
1 parent 45f4591 commit c40aa59

File tree

4 files changed

+24
-72
lines changed

4 files changed

+24
-72
lines changed

site/ide.html

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34057,7 +34057,7 @@
3405734057
var klass = compilers[lang];
3405834058
var compiler = new klass(asc);
3405934059
var result = compiler.compile({ imports });
34060-
console.log(result)
34060+
console.log(result);
3406134061
var { imports, result } = result;
3406234062
var targ = result;
3406334063
if (lang == "rb") mwrapper = x => x;
@@ -34893,7 +34893,7 @@
3489334893
py += ");";
3489434894
strayvar = [];
3489534895
} else if (a.op == "fun") {
34896-
console.log(a)
34896+
console.log(a);
3489734897
py += "\t".repeat(curlvl);
3489834898
py += `def ` + prevfun + `(`;
3489934899
py += a.args.map(a => a.name).join(",");
@@ -35062,42 +35062,19 @@
3506235062
}
3506335063
imports.push(f);
3506435064
} else if (a.op == "try") {
35065-
py += `try{`;
35065+
// TODO!
3506635066
curlvl++;
3506735067
} else if (a.op == "catch") {
35068-
var r = this.randVar();
35069-
errcurlvls.push([curlvl, r]);
35070-
py += `}catch(${r}){`;
35068+
// TODO!
3507135069
strayvar = [];
3507235070
} else if (a.op == "catcherr") {
35073-
var ec = errcurlvls[errcurlvls.length - 1];
35074-
if (a.error == undefined) {
35075-
var vname = this.nextTmpVar();
35076-
strayvar.push(vname);
35077-
if (curlvl != ec[0]) {
35078-
py += `}else{`;
35079-
}
35080-
py += `${vname}=${ec[1]}.name;`;
35081-
} else {
35082-
if (curlvl != ec[0]) {
35083-
py += `}else `;
35084-
curlvl--;
35085-
}
35086-
py += `if (${ec[1]}.name==${a.error[1]}){`;
35087-
curlvl++;
35088-
}
35071+
// TODO!
3508935072
} else if (a.op == "tryend") {
35090-
var ec = errcurlvls.pop();
35091-
if (curlvl != ec[0]) {
35092-
py += `}`;
35093-
curlvl--;
35094-
}
35095-
py += `}`;
35073+
// TODO!
3509635074
curlvl--;
3509735075
strayvar = [];
3509835076
} else if (a.op == "throw") {
35099-
var r = this.randVar();
35100-
py += `${r} = new Error(); ${r}.name=${a.error[1]}; throw ${r};`;
35077+
// TODO!
3510135078
} else if (a.op == "length") {
3510235079
var vname = this.nextTmpVar();
3510335080
py += `${vname}=${a.container}.length;`;
@@ -35188,7 +35165,7 @@
3518835165
rename(name) {
3518935166
return name && `${name.toLowerCase()}`;
3519035167
}
35191-
prevTmpVar(){}
35168+
prevTmpVar() {}
3519235169
lowerAllPinYinAndMakeItGlobal(asc) {
3519335170
for (let i = 0; i < asc.length; i++) {
3519435171
var item = asc[i];

site/index.html

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -34202,7 +34202,7 @@
3420234202
var klass = compilers[lang];
3420334203
var compiler = new klass(asc);
3420434204
var result = compiler.compile({ imports });
34205-
console.log(result)
34205+
console.log(result);
3420634206
var { imports, result } = result;
3420734207
var targ = result;
3420834208
if (lang == "rb") mwrapper = x => x;
@@ -35038,7 +35038,7 @@
3503835038
py += ");";
3503935039
strayvar = [];
3504035040
} else if (a.op == "fun") {
35041-
console.log(a)
35041+
console.log(a);
3504235042
py += "\t".repeat(curlvl);
3504335043
py += `def ` + prevfun + `(`;
3504435044
py += a.args.map(a => a.name).join(",");
@@ -35207,42 +35207,19 @@
3520735207
}
3520835208
imports.push(f);
3520935209
} else if (a.op == "try") {
35210-
py += `try{`;
35210+
// TODO!
3521135211
curlvl++;
3521235212
} else if (a.op == "catch") {
35213-
var r = this.randVar();
35214-
errcurlvls.push([curlvl, r]);
35215-
py += `}catch(${r}){`;
35213+
// TODO!
3521635214
strayvar = [];
3521735215
} else if (a.op == "catcherr") {
35218-
var ec = errcurlvls[errcurlvls.length - 1];
35219-
if (a.error == undefined) {
35220-
var vname = this.nextTmpVar();
35221-
strayvar.push(vname);
35222-
if (curlvl != ec[0]) {
35223-
py += `}else{`;
35224-
}
35225-
py += `${vname}=${ec[1]}.name;`;
35226-
} else {
35227-
if (curlvl != ec[0]) {
35228-
py += `}else `;
35229-
curlvl--;
35230-
}
35231-
py += `if (${ec[1]}.name==${a.error[1]}){`;
35232-
curlvl++;
35233-
}
35216+
// TODO!
3523435217
} else if (a.op == "tryend") {
35235-
var ec = errcurlvls.pop();
35236-
if (curlvl != ec[0]) {
35237-
py += `}`;
35238-
curlvl--;
35239-
}
35240-
py += `}`;
35218+
// TODO!
3524135219
curlvl--;
3524235220
strayvar = [];
3524335221
} else if (a.op == "throw") {
35244-
var r = this.randVar();
35245-
py += `${r} = new Error(); ${r}.name=${a.error[1]}; throw ${r};`;
35222+
// TODO!
3524635223
} else if (a.op == "length") {
3524735224
var vname = this.nextTmpVar();
3524835225
py += `${vname}=${a.container}.length;`;
@@ -35333,7 +35310,7 @@
3533335310
rename(name) {
3533435311
return name && `${name.toLowerCase()}`;
3533535312
}
35336-
prevTmpVar(){}
35313+
prevTmpVar() {}
3533735314
lowerAllPinYinAndMakeItGlobal(asc) {
3533835315
for (let i = 0; i < asc.length; i++) {
3533935316
var item = asc[i];
@@ -35828,13 +35805,12 @@ <h1>Get</h1>
3582835805
});
3582935806
document.getElementById("py").innerText =
3583035807
"# Python\n" + py.split("#####\n")[1];
35831-
var rb = compile("rb", ed.innerText, {
35832-
romanizeIdentifiers: "none",
35833-
errorCallback: () => 0
35834-
});
35835-
document.getElementById("rb").innerText =
35836-
"# Ruby\n" + rb.split("#####\n")[1];
35837-
35808+
var rb = compile("rb", ed.innerText, {
35809+
romanizeIdentifiers: "none",
35810+
errorCallback: () => 0
35811+
});
35812+
document.getElementById("rb").innerText =
35813+
"# Ruby\n" + rb.split("#####\n")[1];
3583835814
}
3583935815
// hljs.highlightBlock(document.getElementById("js"));
3584035816
if (!hasError) {

src/compiler/py.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ class PYCompiler extends Base {
8484
py += ");";
8585
strayvar = [];
8686
} else if (a.op == "fun") {
87-
console.log(a);
8887
py += "\t".repeat(curlvl);
8988
py += `def ` + prevfun + `(`;
9089
py += a.args.map(a => a.name).join(",");

tools/test_parser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ function runAll(lang) {
4545
}
4646
}
4747

48-
// runExample("js", "turing");
49-
runAll("py");
48+
runExample("js", "try");
49+
// runAll("py");
5050

5151
// runExample("js", "../../../Downloads/local_test");
5252
// runExample("js", "import");

0 commit comments

Comments
 (0)