@devalade/algolang 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +7 -2
- package/dist/index.js +14 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4238,7 +4238,12 @@ class CodeGenerator {
|
|
|
4238
4238
|
lines.push(`// Programme: ${node.value}`);
|
|
4239
4239
|
if (block?.children) {
|
|
4240
4240
|
for (const child of block.children) {
|
|
4241
|
-
if (child.type === "
|
|
4241
|
+
if (child.type === "BLOCK") {
|
|
4242
|
+
for (const decl of child.children ?? []) {
|
|
4243
|
+
lines.push(this.generateNode(decl));
|
|
4244
|
+
}
|
|
4245
|
+
lines.push("");
|
|
4246
|
+
} else if (child.type === "FUNCTION_DECLARATION" || child.type === "PROCEDURE_DECLARATION") {
|
|
4242
4247
|
lines.push(this.generateNode(child));
|
|
4243
4248
|
lines.push("");
|
|
4244
4249
|
}
|
|
@@ -4248,7 +4253,7 @@ class CodeGenerator {
|
|
|
4248
4253
|
this.indentLevel++;
|
|
4249
4254
|
if (block?.children) {
|
|
4250
4255
|
for (const child of block.children) {
|
|
4251
|
-
if (child.type !== "FUNCTION_DECLARATION" && child.type !== "PROCEDURE_DECLARATION") {
|
|
4256
|
+
if (child.type !== "BLOCK" && child.type !== "FUNCTION_DECLARATION" && child.type !== "PROCEDURE_DECLARATION") {
|
|
4252
4257
|
const childCode = this.generateNode(child);
|
|
4253
4258
|
if (childCode) {
|
|
4254
4259
|
lines.push(this.indent(childCode));
|
package/dist/index.js
CHANGED
|
@@ -1605,7 +1605,12 @@ class CodeGenerator {
|
|
|
1605
1605
|
lines.push(`// Programme: ${node.value}`);
|
|
1606
1606
|
if (block?.children) {
|
|
1607
1607
|
for (const child of block.children) {
|
|
1608
|
-
if (child.type === "
|
|
1608
|
+
if (child.type === "BLOCK") {
|
|
1609
|
+
for (const decl of child.children ?? []) {
|
|
1610
|
+
lines.push(this.generateNode(decl));
|
|
1611
|
+
}
|
|
1612
|
+
lines.push("");
|
|
1613
|
+
} else if (child.type === "FUNCTION_DECLARATION" || child.type === "PROCEDURE_DECLARATION") {
|
|
1609
1614
|
lines.push(this.generateNode(child));
|
|
1610
1615
|
lines.push("");
|
|
1611
1616
|
}
|
|
@@ -1615,7 +1620,7 @@ class CodeGenerator {
|
|
|
1615
1620
|
this.indentLevel++;
|
|
1616
1621
|
if (block?.children) {
|
|
1617
1622
|
for (const child of block.children) {
|
|
1618
|
-
if (child.type !== "FUNCTION_DECLARATION" && child.type !== "PROCEDURE_DECLARATION") {
|
|
1623
|
+
if (child.type !== "BLOCK" && child.type !== "FUNCTION_DECLARATION" && child.type !== "PROCEDURE_DECLARATION") {
|
|
1619
1624
|
const childCode = this.generateNode(child);
|
|
1620
1625
|
if (childCode) {
|
|
1621
1626
|
lines.push(this.indent(childCode));
|
|
@@ -3245,7 +3250,12 @@ class CodeGenerator2 {
|
|
|
3245
3250
|
lines.push(`// Programme: ${node.value}`);
|
|
3246
3251
|
if (block?.children) {
|
|
3247
3252
|
for (const child of block.children) {
|
|
3248
|
-
if (child.type === "
|
|
3253
|
+
if (child.type === "BLOCK") {
|
|
3254
|
+
for (const decl of child.children ?? []) {
|
|
3255
|
+
lines.push(this.generateNode(decl));
|
|
3256
|
+
}
|
|
3257
|
+
lines.push("");
|
|
3258
|
+
} else if (child.type === "FUNCTION_DECLARATION" || child.type === "PROCEDURE_DECLARATION") {
|
|
3249
3259
|
lines.push(this.generateNode(child));
|
|
3250
3260
|
lines.push("");
|
|
3251
3261
|
}
|
|
@@ -3255,7 +3265,7 @@ class CodeGenerator2 {
|
|
|
3255
3265
|
this.indentLevel++;
|
|
3256
3266
|
if (block?.children) {
|
|
3257
3267
|
for (const child of block.children) {
|
|
3258
|
-
if (child.type !== "FUNCTION_DECLARATION" && child.type !== "PROCEDURE_DECLARATION") {
|
|
3268
|
+
if (child.type !== "BLOCK" && child.type !== "FUNCTION_DECLARATION" && child.type !== "PROCEDURE_DECLARATION") {
|
|
3259
3269
|
const childCode = this.generateNode(child);
|
|
3260
3270
|
if (childCode) {
|
|
3261
3271
|
lines.push(this.indent(childCode));
|