tla-ts 0.0.1 → 0.0.3-dev.763cc71
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/README.md +81 -42
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +215 -30
- package/dist/index.d.ts +215 -30
- package/dist/index.js +1 -1
- package/dist/parallel-worker.cjs +2 -2
- package/dist/parallel-worker.js +2 -2
- package/dist/parallel.cjs +1 -1
- package/dist/parallel.js +2 -2
- package/dist/run-cli.cjs +20 -1
- package/dist/run-cli.js +20 -1
- package/dist/transfer.cjs +388 -39
- package/dist/transfer.js +388 -39
- package/package.json +6 -2
- package/src/ast.ts +122 -5
- package/src/bags.ts +161 -71
- package/src/builtins.ts +203 -23
- package/src/bundled-modules.ts +63 -32
- package/src/check.ts +945 -238
- package/src/cli-options.ts +58 -0
- package/src/codegen.ts +52 -18
- package/src/config.ts +39 -11
- package/src/environment.ts +485 -140
- package/src/errors.ts +59 -1
- package/src/evaluate.ts +489 -137
- package/src/exit-codes.ts +75 -0
- package/src/fingerprints.ts +2 -2
- package/src/index.ts +9 -4
- package/src/instances.ts +221 -66
- package/src/java-overrides.ts +241 -0
- package/src/json.ts +153 -72
- package/src/levels.ts +850 -0
- package/src/lexer.ts +103 -28
- package/src/liveness.ts +47 -91
- package/src/obligation-action.ts +384 -0
- package/src/obligation-anon.ts +575 -0
- package/src/obligation-deref.ts +637 -0
- package/src/obligation-expression.ts +1060 -0
- package/src/obligation-format.ts +406 -0
- package/src/obligation-generate.ts +1074 -0
- package/src/obligation-levels.ts +329 -0
- package/src/obligation-module.ts +1042 -0
- package/src/obligation-printer.ts +889 -0
- package/src/obligation-proof.ts +76 -0
- package/src/obligation-source.ts +1084 -0
- package/src/obligation-tuples.ts +184 -0
- package/src/obligations.ts +316 -0
- package/src/parallel-worker.ts +78 -30
- package/src/parallel.ts +116 -62
- package/src/parser.ts +958 -205
- package/src/pretty-print.ts +259 -0
- package/src/randomization.ts +24 -113
- package/src/resolve.ts +472 -41
- package/src/run-cli.ts +427 -61
- package/src/runtime.ts +63 -28
- package/src/spec-description.ts +509 -0
- package/src/standard-levels.ts +105 -0
- package/src/standard-modules.ts +223 -92
- package/src/subexpressions.ts +21 -35
- package/src/substitution-levels.ts +184 -0
- package/src/successors.ts +261 -46
- package/src/symmetry.ts +65 -21
- package/src/tableau.ts +43 -37
- package/src/tlc-ext.ts +120 -33
- package/src/tlc-module.ts +71 -47
- package/src/tlc-modules.ts +1022 -0
- package/src/tlc-order.ts +497 -0
- package/src/tlc-random.ts +411 -0
- package/src/tlc-summary.ts +109 -0
- package/src/transfer.ts +26 -5
- package/src/values.ts +1231 -176
package/src/errors.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EXIT_STATUS, getExitCode, setModuleExitCode } from "./exit-codes";
|
|
2
|
+
|
|
1
3
|
export class TlaError extends Error {
|
|
2
4
|
constructor(message: string, cause?: unknown) {
|
|
3
5
|
super(message, { cause });
|
|
@@ -5,10 +7,20 @@ export class TlaError extends Error {
|
|
|
5
7
|
}
|
|
6
8
|
}
|
|
7
9
|
|
|
10
|
+
export interface SyntaxFailure {
|
|
11
|
+
reason: string;
|
|
12
|
+
line: number;
|
|
13
|
+
column: number;
|
|
14
|
+
isEnd: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
export class TlaSyntaxError extends TlaError {
|
|
9
|
-
|
|
18
|
+
failure: SyntaxFailure | undefined;
|
|
19
|
+
|
|
20
|
+
constructor(message: string, cause?: unknown, failure?: SyntaxFailure) {
|
|
10
21
|
super(message, cause);
|
|
11
22
|
this.name = "TlaSyntaxError";
|
|
23
|
+
this.failure = failure;
|
|
12
24
|
}
|
|
13
25
|
}
|
|
14
26
|
|
|
@@ -26,9 +38,55 @@ export class TlaEvaluationError extends TlaError {
|
|
|
26
38
|
}
|
|
27
39
|
}
|
|
28
40
|
|
|
41
|
+
// An evaluation error that TLC raises as an EvalException from a standard module's Java code. It
|
|
42
|
+
// keeps the name TlaEvaluationError, and index.ts doesn't export it.
|
|
43
|
+
export class TlaModuleError extends TlaEvaluationError {
|
|
44
|
+
constructor(message: string, exitCode: number = EXIT_STATUS.error) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.name = "TlaEvaluationError";
|
|
47
|
+
setModuleExitCode(this, exitCode);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface TlapmReport {
|
|
52
|
+
failure?: string;
|
|
53
|
+
exception?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export class TlaProofError extends TlaError {
|
|
57
|
+
failure: string | undefined;
|
|
58
|
+
exception: string;
|
|
59
|
+
|
|
60
|
+
constructor(message: string, report: TlapmReport = {}) {
|
|
61
|
+
super(message);
|
|
62
|
+
this.name = "TlaProofError";
|
|
63
|
+
this.failure = report.exception === undefined ? (report.failure ?? message) : undefined;
|
|
64
|
+
this.exception = report.exception ?? `Failure(${JSON.stringify(this.failure)})`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// tlapm fails one of its own assertions, which it reports as a bug in itself. It keeps the name
|
|
69
|
+
// TlaProofError, and index.ts doesn't export it.
|
|
70
|
+
export class TlapmBugError extends TlaProofError {
|
|
71
|
+
constructor(exception = "Assert_failure") {
|
|
72
|
+
super("Oops, this seems to be a bug in TLAPM.", { exception });
|
|
73
|
+
this.name = "TlaProofError";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
29
77
|
export class TlaUnsupportedError extends TlaError {
|
|
30
78
|
constructor(message: string, cause?: unknown) {
|
|
31
79
|
super(message, cause);
|
|
32
80
|
this.name = "TlaUnsupportedError";
|
|
33
81
|
}
|
|
34
82
|
}
|
|
83
|
+
|
|
84
|
+
export const getErrorExitCode = (error: TlaError) =>
|
|
85
|
+
getExitCode(error) ??
|
|
86
|
+
(error instanceof TlaSyntaxError
|
|
87
|
+
? EXIT_STATUS.specParseError
|
|
88
|
+
: error instanceof TlaConfigError
|
|
89
|
+
? EXIT_STATUS.configParseError
|
|
90
|
+
: error instanceof TlaEvaluationError
|
|
91
|
+
? EXIT_STATUS.specEvaluationFailure
|
|
92
|
+
: EXIT_STATUS.error);
|