dirac-lang 0.1.18 → 0.1.19
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-VZEKPMWN.js → chunk-GR6KWGCI.js} +13 -12
- package/dist/{chunk-E2MR7FMI.js → chunk-QMFCOZ5D.js} +1 -1
- package/dist/cli.js +3 -3
- package/dist/index.js +2 -2
- package/dist/{interpreter-MCDR5L7R.js → interpreter-JTOTDC46.js} +1 -1
- package/dist/test-runner.js +1 -1
- package/examples/scope-test.di +3 -3
- package/package.json +1 -1
- package/src/tags/defvar.ts +2 -1
- package/tests/subroutine-nested-calls.test.di +3 -3
- package/tests/subroutine-sequential-calls.test.di +3 -3
- package/tests/tag-check.test.di +1 -1
- package/test-eval.di +0 -4
|
@@ -85,7 +85,8 @@ async function executeDefvar(session, element) {
|
|
|
85
85
|
const valueAttr = element.attributes.value;
|
|
86
86
|
const visibleAttr = element.attributes.visible || "false";
|
|
87
87
|
const literal = "literal" in element.attributes;
|
|
88
|
-
const
|
|
88
|
+
const trimAttr = element.attributes.trim;
|
|
89
|
+
const trim = trimAttr !== "false";
|
|
89
90
|
if (!name) {
|
|
90
91
|
throw new Error("<defvar> requires name attribute");
|
|
91
92
|
}
|
|
@@ -396,12 +397,12 @@ async function executeIf(session, element) {
|
|
|
396
397
|
const condition = await evaluatePredicate(session, conditionElement);
|
|
397
398
|
if (condition) {
|
|
398
399
|
if (thenElement) {
|
|
399
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
400
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-JTOTDC46.js");
|
|
400
401
|
await integrateChildren2(session, thenElement);
|
|
401
402
|
}
|
|
402
403
|
} else {
|
|
403
404
|
if (elseElement) {
|
|
404
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
405
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-JTOTDC46.js");
|
|
405
406
|
await integrateChildren2(session, elseElement);
|
|
406
407
|
}
|
|
407
408
|
}
|
|
@@ -414,7 +415,7 @@ async function evaluatePredicate(session, predicateElement) {
|
|
|
414
415
|
return await evaluateCondition(session, predicateElement);
|
|
415
416
|
}
|
|
416
417
|
const outputLengthBefore = session.output.length;
|
|
417
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
418
|
+
const { integrate: integrate2 } = await import("./interpreter-JTOTDC46.js");
|
|
418
419
|
await integrate2(session, predicateElement);
|
|
419
420
|
const newOutputChunks = session.output.slice(outputLengthBefore);
|
|
420
421
|
const result = newOutputChunks.join("").trim();
|
|
@@ -437,11 +438,11 @@ async function evaluateCondition(session, condElement) {
|
|
|
437
438
|
}
|
|
438
439
|
const outputLengthBefore = session.output.length;
|
|
439
440
|
const args = [];
|
|
440
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
441
|
+
const { integrate: integrate2 } = await import("./interpreter-JTOTDC46.js");
|
|
441
442
|
for (const child of condElement.children) {
|
|
442
443
|
if (child.tag.toLowerCase() === "arg") {
|
|
443
444
|
const argOutputStart = session.output.length;
|
|
444
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
445
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-JTOTDC46.js");
|
|
445
446
|
await integrateChildren2(session, child);
|
|
446
447
|
const newChunks = session.output.slice(argOutputStart);
|
|
447
448
|
const argValue = newChunks.join("");
|
|
@@ -1244,7 +1245,7 @@ async function executeTagCheck(session, element) {
|
|
|
1244
1245
|
const executeTag = correctedTag || tagName;
|
|
1245
1246
|
console.error(`[tag-check] Executing <${executeTag}/> as all checks passed and execute=true.`);
|
|
1246
1247
|
const elementToExecute = correctedTag ? { ...child, tag: correctedTag } : child;
|
|
1247
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
1248
|
+
const { integrate: integrate2 } = await import("./interpreter-JTOTDC46.js");
|
|
1248
1249
|
await integrate2(session, elementToExecute);
|
|
1249
1250
|
}
|
|
1250
1251
|
}
|
|
@@ -1253,7 +1254,7 @@ async function executeTagCheck(session, element) {
|
|
|
1253
1254
|
// src/tags/throw.ts
|
|
1254
1255
|
async function executeThrow(session, element) {
|
|
1255
1256
|
const exceptionName = element.attributes?.name || "exception";
|
|
1256
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1257
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-JTOTDC46.js");
|
|
1257
1258
|
const exceptionDom = {
|
|
1258
1259
|
tag: "exception-content",
|
|
1259
1260
|
attributes: { name: exceptionName },
|
|
@@ -1266,7 +1267,7 @@ async function executeThrow(session, element) {
|
|
|
1266
1267
|
// src/tags/try.ts
|
|
1267
1268
|
async function executeTry(session, element) {
|
|
1268
1269
|
setExceptionBoundary(session);
|
|
1269
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1270
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-JTOTDC46.js");
|
|
1270
1271
|
await integrateChildren2(session, element);
|
|
1271
1272
|
unsetExceptionBoundary(session);
|
|
1272
1273
|
}
|
|
@@ -1276,7 +1277,7 @@ async function executeCatch(session, element) {
|
|
|
1276
1277
|
const exceptionName = element.attributes?.name || "exception";
|
|
1277
1278
|
const caughtCount = lookupException(session, exceptionName);
|
|
1278
1279
|
if (caughtCount > 0) {
|
|
1279
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1280
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-JTOTDC46.js");
|
|
1280
1281
|
await integrateChildren2(session, element);
|
|
1281
1282
|
}
|
|
1282
1283
|
flushCurrentException(session);
|
|
@@ -1285,7 +1286,7 @@ async function executeCatch(session, element) {
|
|
|
1285
1286
|
// src/tags/exception.ts
|
|
1286
1287
|
async function executeException(session, element) {
|
|
1287
1288
|
const exceptions = getCurrentExceptions(session);
|
|
1288
|
-
const { integrateChildren: integrateChildren2 } = await import("./interpreter-
|
|
1289
|
+
const { integrateChildren: integrateChildren2 } = await import("./interpreter-JTOTDC46.js");
|
|
1289
1290
|
for (const exceptionDom of exceptions) {
|
|
1290
1291
|
await integrateChildren2(session, exceptionDom);
|
|
1291
1292
|
}
|
|
@@ -1425,7 +1426,7 @@ async function executeForeach(session, element) {
|
|
|
1425
1426
|
const parser2 = new DiracParser2();
|
|
1426
1427
|
try {
|
|
1427
1428
|
const fromElement = parser2.parse(fromAttr);
|
|
1428
|
-
const { integrate: integrate2 } = await import("./interpreter-
|
|
1429
|
+
const { integrate: integrate2 } = await import("./interpreter-JTOTDC46.js");
|
|
1429
1430
|
await integrate2(session, fromElement);
|
|
1430
1431
|
} catch (e) {
|
|
1431
1432
|
session.output = savedOutput;
|
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-QMFCOZ5D.js";
|
|
5
|
+
import "./chunk-GR6KWGCI.js";
|
|
6
6
|
import "./chunk-HRHAMPOB.js";
|
|
7
7
|
import "./chunk-E7PWEMZA.js";
|
|
8
8
|
import "./chunk-52ED23DR.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.19",
|
|
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-QMFCOZ5D.js";
|
|
6
6
|
import {
|
|
7
7
|
integrate
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GR6KWGCI.js";
|
|
9
9
|
import {
|
|
10
10
|
DiracParser
|
|
11
11
|
} from "./chunk-HRHAMPOB.js";
|
package/dist/test-runner.js
CHANGED
package/examples/scope-test.di
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
<output></output>
|
|
19
19
|
|
|
20
20
|
<!-- Define variables in main scope -->
|
|
21
|
-
<defvar name="x"
|
|
22
|
-
<defvar name="y"
|
|
23
|
-
<defvar name="z"
|
|
21
|
+
<defvar name="x">value-x</defvar>
|
|
22
|
+
<defvar name="y">value-y</defvar>
|
|
23
|
+
<defvar name="z">value-z</defvar>
|
|
24
24
|
|
|
25
25
|
<output>Variables defined in main scope:</output>
|
|
26
26
|
<output> x = <variable name="x" /></output>
|
package/package.json
CHANGED
package/src/tags/defvar.ts
CHANGED
|
@@ -14,7 +14,8 @@ export async function executeDefvar(session: DiracSession, element: DiracElement
|
|
|
14
14
|
const valueAttr = element.attributes.value;
|
|
15
15
|
const visibleAttr = element.attributes.visible || 'false';
|
|
16
16
|
const literal = 'literal' in element.attributes;
|
|
17
|
-
const
|
|
17
|
+
const trimAttr = element.attributes.trim;
|
|
18
|
+
const trim = trimAttr !== 'false'; // Trim by default unless explicitly set to false
|
|
18
19
|
|
|
19
20
|
if (!name) {
|
|
20
21
|
throw new Error('<defvar> requires name attribute');
|
|
@@ -18,9 +18,9 @@ main after outer: a=x b=y c=z -->
|
|
|
18
18
|
</subroutine>
|
|
19
19
|
|
|
20
20
|
<!-- Define main scope variables -->
|
|
21
|
-
<defvar name="a"
|
|
22
|
-
<defvar name="b"
|
|
23
|
-
<defvar name="c"
|
|
21
|
+
<defvar name="a">x</defvar>
|
|
22
|
+
<defvar name="b">y</defvar>
|
|
23
|
+
<defvar name="c">z</defvar>
|
|
24
24
|
|
|
25
25
|
<output>main: a=<variable name="a" /> b=<variable name="b" /> c=<variable name="c" /></output>
|
|
26
26
|
|
|
@@ -15,9 +15,9 @@ x=a y=b z=c -->
|
|
|
15
15
|
</subroutine>
|
|
16
16
|
|
|
17
17
|
<!-- Define main scope variables -->
|
|
18
|
-
<defvar name="x"
|
|
19
|
-
<defvar name="y"
|
|
20
|
-
<defvar name="z"
|
|
18
|
+
<defvar name="x">a</defvar>
|
|
19
|
+
<defvar name="y">b</defvar>
|
|
20
|
+
<defvar name="z">c</defvar>
|
|
21
21
|
|
|
22
22
|
<!-- Verify initial state -->
|
|
23
23
|
<output>x=<variable name="x" /> y=<variable name="y" /> z=<variable name="z" /></output>
|
package/tests/tag-check.test.di
CHANGED
|
@@ -18,7 +18,7 @@ Color changed to: red -->
|
|
|
18
18
|
</subroutine>
|
|
19
19
|
|
|
20
20
|
<!-- Test: tag-check should auto-correct similar tag names and execute -->
|
|
21
|
-
<defvar name="result"
|
|
21
|
+
<defvar name="result">
|
|
22
22
|
<tag-check execute="true" autocorrect="true">
|
|
23
23
|
<background-set color="red" />
|
|
24
24
|
</tag-check>
|
package/test-eval.di
DELETED