dirac-lang 0.1.28 → 0.1.30
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/{chunk-465O4WMH.js → chunk-QPYWRBBT.js} +1 -1
- package/dist/{chunk-EVNSAF33.js → chunk-Y57EPVOA.js} +22 -13
- package/dist/cli.js +3 -3
- package/dist/index.js +2 -2
- package/dist/{interpreter-Q6UF3RRU.js → interpreter-NNPKC43F.js} +1 -1
- package/dist/test-runner.js +1 -1
- package/package.json +1 -1
|
@@ -379,9 +379,10 @@ async function executeLoop(session, element) {
|
|
|
379
379
|
if (!countAttr) {
|
|
380
380
|
throw new Error("<loop> requires count attribute");
|
|
381
381
|
}
|
|
382
|
-
const
|
|
382
|
+
const substitutedCount = substituteAttribute(session, countAttr);
|
|
383
|
+
const count = parseInt(substitutedCount, 10);
|
|
383
384
|
if (isNaN(count) || count < 0) {
|
|
384
|
-
throw new Error(`Invalid loop count: ${countAttr}`);
|
|
385
|
+
throw new Error(`Invalid loop count: ${countAttr} (evaluated to: ${substitutedCount})`);
|
|
385
386
|
}
|
|
386
387
|
const wasBreak = session.isBreak;
|
|
387
388
|
session.isBreak = false;
|
|
@@ -419,12 +420,12 @@ async function executeIf(session, element) {
|
|
|
419
420
|
const condition = await evaluatePredicate(session, conditionElement);
|
|
420
421
|
if (condition) {
|
|
421
422
|
if (thenElement) {
|
|
422
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
423
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-NNPKC43F.js");
|
|
423
424
|
await integrateChildren2(session, thenElement);
|
|
424
425
|
}
|
|
425
426
|
} else {
|
|
426
427
|
if (elseElement) {
|
|
427
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
428
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-NNPKC43F.js");
|
|
428
429
|
await integrateChildren2(session, elseElement);
|
|
429
430
|
}
|
|
430
431
|
}
|
|
@@ -437,7 +438,7 @@ async function evaluatePredicate(session, predicateElement) {
|
|
|
437
438
|
return await evaluateCondition(session, predicateElement);
|
|
438
439
|
}
|
|
439
440
|
const outputLengthBefore = session.output.length;
|
|
440
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
441
|
+
const { integrate: integrate2 } = await import("./interpreter-NNPKC43F.js");
|
|
441
442
|
await integrate2(session, predicateElement);
|
|
442
443
|
const newOutputChunks = session.output.slice(outputLengthBefore);
|
|
443
444
|
const result = newOutputChunks.join("").trim();
|
|
@@ -460,11 +461,11 @@ async function evaluateCondition(session, condElement) {
|
|
|
460
461
|
}
|
|
461
462
|
const outputLengthBefore = session.output.length;
|
|
462
463
|
const args = [];
|
|
463
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
464
|
+
const { integrate: integrate2 } = await import("./interpreter-NNPKC43F.js");
|
|
464
465
|
for (const child of condElement.children) {
|
|
465
466
|
if (child.tag.toLowerCase() === "arg") {
|
|
466
467
|
const argOutputStart = session.output.length;
|
|
467
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
468
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-NNPKC43F.js");
|
|
468
469
|
await integrateChildren2(session, child);
|
|
469
470
|
const newChunks = session.output.slice(argOutputStart);
|
|
470
471
|
const argValue = newChunks.join("");
|
|
@@ -1323,7 +1324,7 @@ async function executeTagCheck(session, element) {
|
|
|
1323
1324
|
const executeTag = correctedTag || tagName;
|
|
1324
1325
|
console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
|
|
1325
1326
|
const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
|
|
1326
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
1327
|
+
const { integrate: integrate2 } = await import("./interpreter-NNPKC43F.js");
|
|
1327
1328
|
await integrate2(session, elementToExecute);
|
|
1328
1329
|
}
|
|
1329
1330
|
}
|
|
@@ -1332,7 +1333,7 @@ async function executeTagCheck(session, element) {
|
|
|
1332
1333
|
// src/tags/throw.ts
|
|
1333
1334
|
async function executeThrow(session, element) {
|
|
1334
1335
|
const exceptionName = element.attributes?.name || "exception";
|
|
1335
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1336
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-NNPKC43F.js");
|
|
1336
1337
|
const exceptionDom = {
|
|
1337
1338
|
tag: "exception-content",
|
|
1338
1339
|
attributes: { name: exceptionName },
|
|
@@ -1345,7 +1346,7 @@ async function executeThrow(session, element) {
|
|
|
1345
1346
|
// src/tags/try.ts
|
|
1346
1347
|
async function executeTry(session, element) {
|
|
1347
1348
|
setExceptionBoundary(session);
|
|
1348
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1349
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-NNPKC43F.js");
|
|
1349
1350
|
await integrateChildren2(session, element);
|
|
1350
1351
|
unsetExceptionBoundary(session);
|
|
1351
1352
|
}
|
|
@@ -1355,7 +1356,7 @@ async function executeCatch(session, element) {
|
|
|
1355
1356
|
const exceptionName = element.attributes?.name || "exception";
|
|
1356
1357
|
const caughtCount = lookupException(session, exceptionName);
|
|
1357
1358
|
if (caughtCount > 0) {
|
|
1358
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1359
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-NNPKC43F.js");
|
|
1359
1360
|
await integrateChildren2(session, element);
|
|
1360
1361
|
}
|
|
1361
1362
|
flushCurrentException(session);
|
|
@@ -1364,7 +1365,7 @@ async function executeCatch(session, element) {
|
|
|
1364
1365
|
// src/tags/exception.ts
|
|
1365
1366
|
async function executeException(session, element) {
|
|
1366
1367
|
const exceptions = getCurrentExceptions(session);
|
|
1367
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1368
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-NNPKC43F.js");
|
|
1368
1369
|
for (const exceptionDom of exceptions) {
|
|
1369
1370
|
await integrateChildren2(session, exceptionDom);
|
|
1370
1371
|
}
|
|
@@ -1504,7 +1505,7 @@ async function executeForeach(session, element) {
|
|
|
1504
1505
|
const parser2 = new DiracParser2();
|
|
1505
1506
|
try {
|
|
1506
1507
|
const fromElement = parser2.parse(fromAttr);
|
|
1507
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
1508
|
+
const { integrate: integrate2 } = await import("./interpreter-NNPKC43F.js");
|
|
1508
1509
|
await integrate2(session, fromElement);
|
|
1509
1510
|
} catch (e) {
|
|
1510
1511
|
session.output = savedOutput;
|
|
@@ -1597,6 +1598,11 @@ function matchesXPath(item, xpath) {
|
|
|
1597
1598
|
return true;
|
|
1598
1599
|
}
|
|
1599
1600
|
|
|
1601
|
+
// src/tags/break.ts
|
|
1602
|
+
async function executeBreak(session, element) {
|
|
1603
|
+
session.isBreak = true;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1600
1606
|
// src/tags/attr.ts
|
|
1601
1607
|
async function executeAttr(session, element) {
|
|
1602
1608
|
const nameAttr = element.attributes.name;
|
|
@@ -1791,6 +1797,9 @@ async function integrate(session, element) {
|
|
|
1791
1797
|
case "loop":
|
|
1792
1798
|
await executeLoop(session, element);
|
|
1793
1799
|
break;
|
|
1800
|
+
case "break":
|
|
1801
|
+
await executeBreak(session, element);
|
|
1802
|
+
break;
|
|
1794
1803
|
case "if":
|
|
1795
1804
|
await executeIf(session, element);
|
|
1796
1805
|
break;
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
execute
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-QPYWRBBT.js";
|
|
5
|
+
import "./chunk-Y57EPVOA.js";
|
|
6
6
|
import "./chunk-HRHAMPOB.js";
|
|
7
7
|
import "./chunk-LXF5PGUX.js";
|
|
8
8
|
import "./chunk-BSQV77YM.js";
|
|
@@ -13,7 +13,7 @@ import "dotenv/config";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "dirac-lang",
|
|
16
|
-
version: "0.1.
|
|
16
|
+
version: "0.1.29",
|
|
17
17
|
description: "LLM-Augmented Declarative Execution",
|
|
18
18
|
type: "module",
|
|
19
19
|
main: "dist/index.js",
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
createLLMAdapter,
|
|
3
3
|
execute,
|
|
4
4
|
executeUserCommand
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QPYWRBBT.js";
|
|
6
6
|
import {
|
|
7
7
|
integrate
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-Y57EPVOA.js";
|
|
9
9
|
import {
|
|
10
10
|
DiracParser
|
|
11
11
|
} from "./chunk-HRHAMPOB.js";
|
package/dist/test-runner.js
CHANGED