Skip to content

Commit

Permalink
support SequenceExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
taisukef committed Jan 4, 2025
1 parent 7d33831 commit e602fce
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion DNCL3.js
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,9 @@ export class DNCL3 {
return prop;
}
runBlock(ast) {
const body = ast.type == "BlockStatement" || ast.type == "Program" ? ast.body : [ast];
const body = ast.type == "BlockStatement" ||
ast.type == "Program" ? ast.body :
ast.type == "SequenceExpression" ? ast.expressions : [ast];
for (const cmd of body) {
//console.log(cmd)
if (cmd.type == "ExpressionStatement") {
Expand Down
3 changes: 2 additions & 1 deletion dncl2js.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ <h1>DNCL3 → AST → like JavaScript → output</h1>
//const fn = "funcja";
//const fn = "dowhile";
//const fn = "comment";
const fn = "input";
//const fn = "input";
const fn = "test";

const fn0 = location.hash.substring(1) || fn;
const firstprog = await (await fetch("examples/" + fn0 + ".dncl")).text();
Expand Down
1 change: 1 addition & 0 deletions examples/test.dncl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a = 3, b = 5
1 change: 1 addition & 0 deletions makeIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const fns = await dir2array("examples");
const list = [];
for (const fn of fns) {
if (!fn.endsWith(".dncl")) continue;
if (fn == "test.dncl") continue;
const s = await Deno.readTextFile("examples/" + fn);
const ss = s.split("\n");
const title = ss[0].substring(1).trim();
Expand Down

0 comments on commit e602fce

Please sign in to comment.