tla-ts 0.0.10-dev.28c823e4b → 0.0.10-dev.b4a856304
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/index.cjs +1 -1
- package/dist/index.d.cts +0 -34
- package/dist/index.d.ts +0 -34
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +1 -1
- package/dist/parallel-worker.js +1 -1
- package/dist/prove.cjs +43 -43
- package/dist/prove.js +47 -47
- package/dist/run.cjs +30 -30
- package/dist/run.js +33 -33
- package/dist/transfer.cjs +38 -38
- package/dist/transfer.js +39 -39
- package/package.json +1 -1
- package/src/ast.ts +5 -0
- package/src/bags.ts +5 -2
- package/src/builtins.ts +8 -1
- package/src/check.ts +193 -128
- package/src/cli/run.ts +2 -0
- package/src/cli/runtime-invariants.ts +7 -8
- package/src/cli/shared.ts +4 -0
- package/src/cli/tlc-arguments.ts +30 -24
- package/src/cli/tlc-usage.ts +3 -2
- package/src/evaluate.ts +102 -26
- package/src/java-overrides.ts +9 -4
- package/src/json-reader.ts +2 -1
- package/src/json.ts +11 -4
- package/src/levels.ts +15 -7
- package/src/lexer.ts +83 -72
- package/src/liveness-checker.ts +106 -77
- package/src/liveness.ts +34 -10
- package/src/parallel.ts +33 -26
- package/src/parser.ts +226 -163
- package/src/pcal/ast.ts +65 -53
- package/src/pcal/parse.ts +191 -144
- package/src/pcal/tokenize.ts +115 -91
- package/src/pcal/translate.ts +98 -83
- package/src/pcal/validate.ts +50 -48
- package/src/pretty-print.ts +6 -6
- package/src/randomization.ts +4 -1
- package/src/resolve.ts +70 -12
- package/src/runtime.ts +18 -11
- package/src/sany/builtins.ts +3 -1
- package/src/sany/generator.ts +127 -74
- package/src/sany/levels.ts +9 -5
- package/src/sany/lexer.ts +44 -40
- package/src/sany/linter.ts +1 -0
- package/src/search.ts +1 -1
- package/src/simulate.ts +59 -50
- package/src/spec-description.ts +34 -23
- package/src/standard-definitions.ts +3 -0
- package/src/standard-modules.ts +12 -1
- package/src/state-graph.ts +8 -1
- package/src/subexpressions.ts +47 -38
- package/src/successors.ts +35 -14
- package/src/symmetry.ts +19 -4
- package/src/tlc/fingerprint.ts +21 -15
- package/src/tlc/jar-data.ts +1 -0
- package/src/tlc/messages.ts +21 -2
- package/src/tlc/order.ts +38 -20
- package/src/tlc/random.ts +30 -18
- package/src/tlc/replay.ts +33 -13
- package/src/tlc/summary.ts +45 -36
- package/src/tlc/tlc-operators.ts +14 -4
- package/src/tlc/tlcext-operators.ts +15 -11
- package/src/tlc/trace-spec.ts +4 -0
- package/src/tlc/value-stream.ts +13 -9
- package/src/tlc/version.ts +1 -0
- package/src/values.ts +181 -74
package/src/pcal/ast.ts
CHANGED
|
@@ -9,6 +9,8 @@ export interface PcalToken {
|
|
|
9
9
|
type: number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
// For each line, the token of an earlier line it is aligned under, with that token's column when
|
|
13
|
+
// the expression was normalized.
|
|
12
14
|
export interface PcalExpr {
|
|
13
15
|
tokens: PcalToken[][];
|
|
14
16
|
anchorTokens: (PcalToken | undefined)[] | undefined;
|
|
@@ -20,6 +22,8 @@ interface PcalCoord {
|
|
|
20
22
|
item: number;
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
// The Java keeps these in static fields that SANY never resets, so options one module sets carry
|
|
26
|
+
// over to the modules SANY validates after it.
|
|
23
27
|
export interface PcalParams {
|
|
24
28
|
labelFlag: boolean;
|
|
25
29
|
labelRoot: string;
|
|
@@ -42,21 +46,20 @@ export const createPcalParams = (): PcalParams => ({
|
|
|
42
46
|
inputVersionNumber: PCAL_VERSION_WEIGHT,
|
|
43
47
|
});
|
|
44
48
|
|
|
49
|
+
// "1.5" is 1500, and -1 means a malformed version.
|
|
45
50
|
export const getPcalVersionNumber = (text: string) => {
|
|
46
|
-
|
|
47
|
-
let digitsAfterDecimal = 0;
|
|
48
|
-
let isAfterDecimal = false;
|
|
51
|
+
const state = { result: 0, digitsAfterDecimal: 0, isAfterDecimal: false };
|
|
49
52
|
for (const char of text) {
|
|
50
53
|
if (char === ".") {
|
|
51
|
-
isAfterDecimal = true;
|
|
54
|
+
state.isAfterDecimal = true;
|
|
52
55
|
continue;
|
|
53
56
|
}
|
|
54
57
|
if (char < "0" || char > "9") return -1;
|
|
55
|
-
result = 10 * result + Number(char);
|
|
56
|
-
if (isAfterDecimal) digitsAfterDecimal += 1;
|
|
57
|
-
if (digitsAfterDecimal > 3) return -1;
|
|
58
|
+
state.result = 10 * state.result + Number(char);
|
|
59
|
+
if (state.isAfterDecimal) state.digitsAfterDecimal += 1;
|
|
60
|
+
if (state.digitsAfterDecimal > 3) return -1;
|
|
58
61
|
}
|
|
59
|
-
return result * 10 ** Math.max(0, 3 - digitsAfterDecimal);
|
|
62
|
+
return state.result * 10 ** Math.max(0, 3 - state.digitsAfterDecimal);
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
interface PcalBase {
|
|
@@ -222,6 +225,7 @@ export interface PcalCall extends PcalBase {
|
|
|
222
225
|
args: PcalExpr[];
|
|
223
226
|
}
|
|
224
227
|
|
|
228
|
+
// A Return or CallReturn outside a procedure has a null from, which Java prints as "null".
|
|
225
229
|
export interface PcalReturn extends PcalBase {
|
|
226
230
|
kind: "Return";
|
|
227
231
|
from: string | undefined;
|
|
@@ -311,7 +315,8 @@ export const toLabeledStmt = (node: PcalStmt) => {
|
|
|
311
315
|
return node;
|
|
312
316
|
};
|
|
313
317
|
|
|
314
|
-
|
|
318
|
+
// Vector.elementAt, which throws for an index out of bounds.
|
|
319
|
+
export const getElement = <T>(vector: T[], index: number) => {
|
|
315
320
|
if (index < 0 || index >= vector.length) {
|
|
316
321
|
throw new PcalRuntimeError(`ArrayIndexOutOfBoundsException: ${index}`);
|
|
317
322
|
}
|
|
@@ -324,6 +329,7 @@ export const createPcalToken = (string: string, column: number, type: number): P
|
|
|
324
329
|
type,
|
|
325
330
|
});
|
|
326
331
|
|
|
332
|
+
// A string token's width counts its quotes.
|
|
327
333
|
export const getPcalTokenWidth = (token: PcalToken) =>
|
|
328
334
|
token.type === PCAL_TOKEN.string ? token.string.length + 2 : token.string.length;
|
|
329
335
|
|
|
@@ -444,10 +450,12 @@ export const stepPcalCoord = (expr: PcalExpr, coord: PcalCoord, steps: number) =
|
|
|
444
450
|
return result;
|
|
445
451
|
};
|
|
446
452
|
|
|
453
|
+
// Skips a record field name, such as the a in r.a, [a |-> 1] or [a : S].
|
|
447
454
|
const findNextInstance = (expr: PcalExpr, id: string, start: PcalCoord) => {
|
|
448
455
|
for (let coord = expr.tokens.length === 0 ? undefined : { ...start }; coord !== undefined;) {
|
|
449
456
|
const token = getPcalTokenAt(expr, coord);
|
|
450
457
|
const isString = token.type === PCAL_TOKEN.string;
|
|
458
|
+
// The id is an identifier, so a token that is the id is none of the tokens skipped below.
|
|
451
459
|
if (!isString && token.string === id) return coord;
|
|
452
460
|
const afterNext =
|
|
453
461
|
!isString && (token.string === "[" || token.string === ",")
|
|
@@ -484,10 +492,12 @@ const substituteAt = (
|
|
|
484
492
|
? tokenLine[coord.item + 1].column - (token.column + getPcalTokenWidth(token))
|
|
485
493
|
: 0;
|
|
486
494
|
const restOfLine = tokenLine.splice(coord.item + 1);
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
495
|
+
const cursor = {
|
|
496
|
+
lineIndex: coord.line,
|
|
497
|
+
indent: (isParenthesized ? 1 : 0) + token.column,
|
|
498
|
+
isInserting: !isParenthesized,
|
|
499
|
+
};
|
|
500
|
+
const getLine = () => expr.tokens[cursor.lineIndex];
|
|
491
501
|
if (isOneTokenPcalExpr(replacement)) {
|
|
492
502
|
const replacementToken = replacement.tokens[0][0];
|
|
493
503
|
token.string = replacementToken.string;
|
|
@@ -500,30 +510,30 @@ const substituteAt = (
|
|
|
500
510
|
const newExpr = clonePcalExpr(replacement);
|
|
501
511
|
newExpr.tokens.forEach((replacementLine, index) => {
|
|
502
512
|
replacementLine.forEach((nextToken) => {
|
|
503
|
-
nextToken.column += indent;
|
|
504
|
-
if (!isInserting) {
|
|
513
|
+
nextToken.column += cursor.indent;
|
|
514
|
+
if (!cursor.isInserting) {
|
|
505
515
|
getLine().push(nextToken);
|
|
506
516
|
return;
|
|
507
517
|
}
|
|
508
518
|
token.string = nextToken.string;
|
|
509
519
|
token.type = nextToken.type;
|
|
510
|
-
isInserting = false;
|
|
520
|
+
cursor.isInserting = false;
|
|
511
521
|
});
|
|
512
522
|
if (index + 1 >= newExpr.tokens.length) return;
|
|
513
|
-
indent = 0;
|
|
514
|
-
lineIndex += 1;
|
|
515
|
-
const currentLine = lineIndex;
|
|
523
|
+
cursor.indent = 0;
|
|
524
|
+
cursor.lineIndex += 1;
|
|
525
|
+
const currentLine = cursor.lineIndex;
|
|
516
526
|
expr.tokens.splice(currentLine, 0, []);
|
|
517
527
|
const oldAnchors = expr.anchorTokens ?? [];
|
|
518
528
|
const oldColumns = expr.anchorTokCol ?? [];
|
|
519
|
-
expr.anchorTokens = expr.tokens.map((
|
|
529
|
+
expr.anchorTokens = expr.tokens.map((_, item) =>
|
|
520
530
|
item < currentLine
|
|
521
531
|
? oldAnchors[item]
|
|
522
532
|
: item === currentLine
|
|
523
533
|
? newExpr.anchorTokens?.[index + 1]
|
|
524
534
|
: oldAnchors[item - 1],
|
|
525
535
|
);
|
|
526
|
-
expr.anchorTokCol = expr.tokens.map((
|
|
536
|
+
expr.anchorTokCol = expr.tokens.map((_, item) =>
|
|
527
537
|
item < currentLine
|
|
528
538
|
? oldColumns[item]
|
|
529
539
|
: item === currentLine
|
|
@@ -539,7 +549,7 @@ const substituteAt = (
|
|
|
539
549
|
}
|
|
540
550
|
}
|
|
541
551
|
const line = getLine();
|
|
542
|
-
const result = { line: lineIndex, item: line.length - 1 };
|
|
552
|
+
const result = { line: cursor.lineIndex, item: line.length - 1 };
|
|
543
553
|
if (restOfLine.length > 0) {
|
|
544
554
|
const previous = line[line.length - 1];
|
|
545
555
|
const shift = previous.column + getPcalTokenWidth(previous) + spaces - restOfLine[0].column;
|
|
@@ -600,6 +610,7 @@ export const getSubstitutedPcalExpr = (expr: PcalExpr, args: PcalExpr[], params:
|
|
|
600
610
|
export const substitutePcalExprs = (exprs: PcalExpr[], args: PcalExpr[], params: string[]) =>
|
|
601
611
|
exprs.map((expr) => getSubstitutedPcalExpr(expr, args, params));
|
|
602
612
|
|
|
613
|
+
// TLAExpr.toString, which names the column of a junction except in TLC 1.7.4.
|
|
603
614
|
const formatPcalExpr = (expr: PcalExpr, version?: TlcVersion) => {
|
|
604
615
|
const getColumn = (token: PcalToken) => (version === "1.7.4" ? "" : `(col${token.column}) `);
|
|
605
616
|
const tokens = expr.tokens.map((line) =>
|
|
@@ -628,94 +639,95 @@ export const formatPcalNode = (
|
|
|
628
639
|
) => {
|
|
629
640
|
const formatExpr = (expr: PcalExpr) => formatPcalExpr(expr, version);
|
|
630
641
|
const columns = [0];
|
|
631
|
-
|
|
642
|
+
const depth = { value: 0 };
|
|
632
643
|
const indent = (text: string) => {
|
|
633
|
-
columns[depth + 1] = columns[depth] + text.length;
|
|
634
|
-
depth += 1;
|
|
644
|
+
columns[depth.value + 1] = columns[depth.value] + text.length;
|
|
645
|
+
depth.value += 1;
|
|
635
646
|
return text;
|
|
636
647
|
};
|
|
637
648
|
const endIndent = () => {
|
|
638
|
-
depth -= 1;
|
|
649
|
+
depth.value -= 1;
|
|
639
650
|
return "";
|
|
640
651
|
};
|
|
641
|
-
const
|
|
652
|
+
const newLine = () => `\n${" ".repeat(columns[depth.value])}`;
|
|
642
653
|
const isOldVersion = inputVersionNumber < 1500;
|
|
654
|
+
// The separators' new lines take the indentation the elements before them leave.
|
|
643
655
|
const formatSeq = (vector: (PcalNode | PcalExpr)[]) =>
|
|
644
656
|
`${indent("<<")}${vector
|
|
645
657
|
.map(
|
|
646
658
|
(element, index) =>
|
|
647
|
-
`${index > 0 ? `, ${
|
|
659
|
+
`${index > 0 ? `, ${newLine()}` : ""}${"kind" in element ? format(element) : formatExpr(element)}`,
|
|
648
660
|
)
|
|
649
661
|
.join("")}>>${endIndent()}`;
|
|
650
662
|
const formatQuotedSeq = (vector: string[]) =>
|
|
651
663
|
`${indent("<<")}${vector.map((element) => `"${element}"`).join(", ")}>>${endIndent()}`;
|
|
652
664
|
const formatSeqOfSeqs = (vectors: PcalStmt[][]) =>
|
|
653
665
|
`${indent("<< ")}${vectors
|
|
654
|
-
.map((vector, index) => `${index > 0 ? `, ${
|
|
666
|
+
.map((vector, index) => `${index > 0 ? `, ${newLine()}` : ""}${formatSeq(vector)}`)
|
|
655
667
|
.join("")} >>${endIndent()}`;
|
|
656
668
|
const formatEqOrIn = (isEq: boolean) => (isEq ? '"="' : '"\\\\in"');
|
|
657
669
|
const format = (node: PcalNode): string => {
|
|
658
670
|
switch (node.kind) {
|
|
659
671
|
case "Uniprocess":
|
|
660
|
-
return `${indent("")}[type |-> "uniprocess", ${
|
|
672
|
+
return `${indent("")}[type |-> "uniprocess", ${newLine()} name |-> "${node.name}", ${newLine()}${indent(" decls |-> ")}${formatSeq(node.decls)},${endIndent()}${newLine()}${indent(" defs |-> ")}${formatExpr(node.defs)},${endIndent()}${newLine()}${indent(" prcds |-> ")}${formatSeq(node.prcds)},${endIndent()}${newLine()}${indent(" body |-> ")}${formatSeq(node.body)}]${endIndent()}${endIndent()}`;
|
|
661
673
|
case "Multiprocess":
|
|
662
|
-
return `${indent("")}[type |-> "multiprocess", ${
|
|
674
|
+
return `${indent("")}[type |-> "multiprocess", ${newLine()} name |-> "${node.name}", ${newLine()}${indent(" decls |-> ")}${formatSeq(node.decls)},${endIndent()}${newLine()}${indent(" defs |-> ")}${formatExpr(node.defs)},${endIndent()}${newLine()}${indent(" prcds |-> ")}${formatSeq(node.prcds)},${endIndent()}${newLine()}${indent(" procs |-> ")}${formatSeq(node.procs)}]${endIndent()}${endIndent()}`;
|
|
663
675
|
case "Procedure":
|
|
664
676
|
return isOldVersion
|
|
665
|
-
? `${indent("")}[name |-> "${node.name}", ${
|
|
666
|
-
: `${indent("")}[name |-> "${node.name}", ${
|
|
677
|
+
? `${indent("")}[name |-> "${node.name}", ${newLine()}${indent(" params |-> ")}${formatSeq(node.params)},${endIndent()}${newLine()}${indent(" decls |-> ")}${formatSeq(node.decls)},${endIndent()}${newLine()}${indent(" body |-> ")}${formatSeq(node.body)}]${endIndent()}${endIndent()}`
|
|
678
|
+
: `${indent("")}[name |-> "${node.name}", ${newLine()}minusLabels |-> ${formatQuotedSeq(node.minusLabels)}, plusLabels |->${formatQuotedSeq(node.plusLabels)}, proceduresCalled |->${formatQuotedSeq(node.proceduresCalled)},${newLine()}${indent(" params |-> ")}${formatSeq(node.params)},${endIndent()}${newLine()}${indent(" decls |-> ")}${formatSeq(node.decls)},${endIndent()}${newLine()}${indent(" body |-> ")}${formatSeq(node.body)}]${endIndent()}${endIndent()}`;
|
|
667
679
|
case "Process":
|
|
668
680
|
return isOldVersion
|
|
669
|
-
? `${indent("")}[name |-> "${node.name}", ${
|
|
670
|
-
: `${indent("")}[name |-> "${node.name}",${
|
|
681
|
+
? `${indent("")}[name |-> "${node.name}", ${newLine()} eqOrIn |-> ${formatEqOrIn(node.isEq)},${newLine()} id |-> ${formatExpr(node.id)},${newLine()}${indent(" decls |-> ")}${formatSeq(node.decls)},${endIndent()}${newLine()}${indent(" body |-> ")}${formatSeq(node.body)}]${endIndent()}${endIndent()}`
|
|
682
|
+
: `${indent("")}[name |-> "${node.name}",${newLine()} fairness |-> "${PCAL_FAIRNESS[node.fairness]}", minusLabels |-> ${formatQuotedSeq(node.minusLabels)}, plusLabels |->${formatQuotedSeq(node.plusLabels)}, proceduresCalled |->${formatQuotedSeq(node.proceduresCalled)},${newLine()} eqOrIn |-> ${formatEqOrIn(node.isEq)},${newLine()} id |-> ${formatExpr(node.id)},${newLine()}${indent(" decls |-> ")}${formatSeq(node.decls)},${endIndent()}${newLine()}${indent(" body |-> ")}${formatSeq(node.body)}]${endIndent()}${endIndent()}`;
|
|
671
683
|
case "VarDecl":
|
|
672
684
|
return `${indent("")}[var |-> "${node.var}", eqOrIn |-> ${formatEqOrIn(node.isEq)}, val |-> ${formatExpr(node.val)}]${endIndent()}`;
|
|
673
685
|
case "PVarDecl":
|
|
674
686
|
return `${indent("")}[var |-> "${node.var}", eqOrIn |-> "=", val |-> ${formatExpr(node.val)}]${endIndent()}`;
|
|
675
687
|
case "LabeledStmt":
|
|
676
|
-
return `${indent("")}[label |-> "${node.label}",${
|
|
688
|
+
return `${indent("")}[label |-> "${node.label}",${newLine()}${indent(" stmts |-> ")}${formatSeq(node.stmts)}]${endIndent()}${endIndent()}`;
|
|
677
689
|
case "While":
|
|
678
|
-
return `${indent("")}[type |-> "while", ${
|
|
690
|
+
return `${indent("")}[type |-> "while", ${newLine()} test |-> ${formatExpr(node.test)},${newLine()}${indent(" labDo |-> ")}${formatSeq(node.labDo)},${endIndent()}${newLine()}${indent(" unlabDo |-> ")}${formatSeq(node.unlabDo)}]${endIndent()}${endIndent()}`;
|
|
679
691
|
case "Assign":
|
|
680
|
-
return `${indent("")}[type |-> "assignment",${
|
|
692
|
+
return `${indent("")}[type |-> "assignment",${newLine()}${indent(" ass |-> ")}${formatSeq(node.ass)}]${endIndent()}${endIndent()}`;
|
|
681
693
|
case "SingleAssign":
|
|
682
|
-
return `${indent("")}[lhs |-> ${format(node.lhs)},${
|
|
694
|
+
return `${indent("")}[lhs |-> ${format(node.lhs)},${newLine()} rhs |-> ${formatExpr(node.rhs)}]${endIndent()}`;
|
|
683
695
|
case "Lhs":
|
|
684
696
|
return `[var |-> "${node.var}", sub |-> ${formatExpr(node.sub)}]`;
|
|
685
697
|
case "If":
|
|
686
|
-
return `${indent("")}[type |-> "if", ${
|
|
698
|
+
return `${indent("")}[type |-> "if", ${newLine()} test |-> ${formatExpr(node.test)},${newLine()}${indent(" then |-> ")}${formatSeq(node.Then)},${endIndent()}${newLine()}${indent(" else |-> ")}${formatSeq(node.Else)}]${endIndent()}${endIndent()}`;
|
|
687
699
|
case "Either":
|
|
688
|
-
return `${indent("")}[type |-> "either", ${
|
|
700
|
+
return `${indent("")}[type |-> "either", ${newLine()}${indent(" ors |-> ")}${formatSeqOfSeqs(node.ors)}]${endIndent()}${endIndent()}`;
|
|
689
701
|
case "With":
|
|
690
|
-
return `${indent("")}[type |-> "with", ${
|
|
702
|
+
return `${indent("")}[type |-> "with", ${newLine()} var |-> "${node.var}",${newLine()} eqOrIn |-> ${formatEqOrIn(node.isEq)},${newLine()} exp |-> ${formatExpr(node.exp)},${newLine()}${indent(" do |-> ")}${formatSeq(node.Do)}]${endIndent()}${endIndent()}`;
|
|
691
703
|
case "When":
|
|
692
|
-
return `${indent("")}[type |-> "when", ${
|
|
704
|
+
return `${indent("")}[type |-> "when", ${newLine()} exp |-> ${formatExpr(node.exp)}]${endIndent()}`;
|
|
693
705
|
case "PrintS":
|
|
694
|
-
return `${indent("")}[type |-> "print", ${
|
|
706
|
+
return `${indent("")}[type |-> "print", ${newLine()} exp |-> ${formatExpr(node.exp)}]${endIndent()}`;
|
|
695
707
|
case "Assert":
|
|
696
|
-
return `${indent("")}[type |-> "assert", ${
|
|
708
|
+
return `${indent("")}[type |-> "assert", ${newLine()} exp |-> ${formatExpr(node.exp)}]${endIndent()}`;
|
|
697
709
|
case "Skip":
|
|
698
710
|
return '[type |-> "skip"]';
|
|
699
711
|
case "LabelIf":
|
|
700
|
-
return `${indent("")}[type |-> "labelIf",${
|
|
712
|
+
return `${indent("")}[type |-> "labelIf",${newLine()} test |-> ${formatExpr(node.test)},${newLine()}${indent(" unlabThen |-> ")}${formatSeq(node.unlabThen)},${endIndent()}${newLine()}${indent(" labThen |-> ")}${formatSeq(node.labThen)},${endIndent()}${newLine()}${indent(" unlabElse |-> ")}${formatSeq(node.unlabElse)},${endIndent()}${newLine()}${indent(" labElse |-> ")}${formatSeq(node.labElse)}]${endIndent()}${newLine()}${endIndent()}`;
|
|
701
713
|
case "LabelEither":
|
|
702
|
-
return `${indent("")}[type |-> "labelEither",${
|
|
714
|
+
return `${indent("")}[type |-> "labelEither",${newLine()}${indent(" clauses |-> ")}${formatSeq(node.clauses)}]${endIndent()}${newLine()}${endIndent()}`;
|
|
703
715
|
case "Clause":
|
|
704
|
-
return `${indent("")}${indent("[unlabOr |-> ")}${formatSeq(node.unlabOr)},${endIndent()}${
|
|
716
|
+
return `${indent("")}${indent("[unlabOr |-> ")}${formatSeq(node.unlabOr)},${endIndent()}${newLine()}${indent(" labOr |-> ")}${formatSeq(node.labOr)}]${endIndent()}${newLine()}${endIndent()}`;
|
|
705
717
|
case "Call":
|
|
706
|
-
return `${indent("")}[type |-> "call",${
|
|
718
|
+
return `${indent("")}[type |-> "call",${newLine()} returnTo |-> "${node.returnTo}",${newLine()} to |-> "${node.to}",${newLine()}${indent(" args |-> ")}${formatSeq(node.args)}]${endIndent()}${endIndent()}`;
|
|
707
719
|
case "Return":
|
|
708
720
|
return `[type |-> "return", from |-> "${node.from ?? "null"}"]`;
|
|
709
721
|
case "CallReturn":
|
|
710
|
-
return `${indent("")}[type |-> "callReturn",${
|
|
722
|
+
return `${indent("")}[type |-> "callReturn",${newLine()} from |-> "${node.from ?? "null"}",${newLine()} to |-> "${node.to}",${newLine()}${indent("args |-> ")}${formatSeq(node.args)}]${newLine()}${endIndent()}${endIndent()}`;
|
|
711
723
|
case "CallGoto":
|
|
712
|
-
return `${indent("")}[type |-> "callGoto",${
|
|
724
|
+
return `${indent("")}[type |-> "callGoto",${newLine()} after |-> "${node.after}",${newLine()} to |-> "${node.to}",${newLine()}${indent("args |-> ")}${formatSeq(node.args)}]${newLine()}${endIndent()}${endIndent()}`;
|
|
713
725
|
case "Goto":
|
|
714
726
|
return `[type |-> "goto", to |-> "${node.to}"]`;
|
|
715
727
|
case "Macro":
|
|
716
|
-
return `${indent("")}[name |-> "${node.name}", ${
|
|
728
|
+
return `${indent("")}[name |-> "${node.name}", ${newLine()}${indent(" params |-> ")}${indent("<<")}${node.params.join(`, ${newLine()}`)}>>${endIndent()},${endIndent()}${newLine()}${indent(" body |-> ")}${formatSeq(node.body)}]${endIndent()}${endIndent()}`;
|
|
717
729
|
case "MacroCall":
|
|
718
|
-
return `${indent("")}[type |-> "macrocall",${
|
|
730
|
+
return `${indent("")}[type |-> "macrocall",${newLine()} name |-> "${node.name}",${newLine()}${indent(" args |-> ")}${formatSeq(node.args)}]${endIndent()}${endIndent()}`;
|
|
719
731
|
}
|
|
720
732
|
};
|
|
721
733
|
return format(node);
|