lemmascript 0.3.3 → 0.5.0
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 +20 -13
- package/package.json +4 -1
- package/tools/dist/dafny-commands.js +31 -14
- package/tools/dist/dafny-emit.js +302 -17
- package/tools/dist/extract.js +1087 -181
- package/tools/dist/info-command.js +38 -0
- package/tools/dist/lean-emit.js +81 -5
- package/tools/dist/lsc.js +29 -9
- package/tools/dist/narrow.js +932 -0
- package/tools/dist/peephole.js +451 -0
- package/tools/dist/resolve.js +680 -258
- package/tools/dist/specparser.js +18 -2
- package/tools/dist/transform.js +597 -441
- package/tools/dist/types.js +128 -69
package/tools/dist/specparser.js
CHANGED
|
@@ -66,7 +66,7 @@ function tokenize(input) {
|
|
|
66
66
|
if (matched)
|
|
67
67
|
continue;
|
|
68
68
|
const ch = input[i];
|
|
69
|
-
if ("
|
|
69
|
+
if ("+-*/%><!?".includes(ch)) {
|
|
70
70
|
tokens.push({ type: "op", value: ch });
|
|
71
71
|
}
|
|
72
72
|
else if ("()[],:.{}".includes(ch)) {
|
|
@@ -109,11 +109,21 @@ class Parser {
|
|
|
109
109
|
return r;
|
|
110
110
|
}
|
|
111
111
|
parseImplies() {
|
|
112
|
-
const left = this.
|
|
112
|
+
const left = this.parseTernary();
|
|
113
113
|
if (this.match("op", "==>"))
|
|
114
114
|
return { kind: "binop", op: "==>", left, right: this.parseImplies() };
|
|
115
115
|
return left;
|
|
116
116
|
}
|
|
117
|
+
parseTernary() {
|
|
118
|
+
const cond = this.parseOr();
|
|
119
|
+
if (this.match("op", "?")) {
|
|
120
|
+
const then_ = this.parseImplies();
|
|
121
|
+
this.expect("punc", ":");
|
|
122
|
+
const else_ = this.parseImplies();
|
|
123
|
+
return { kind: "conditional", cond, then: then_, else: else_ };
|
|
124
|
+
}
|
|
125
|
+
return cond;
|
|
126
|
+
}
|
|
117
127
|
parseOr() {
|
|
118
128
|
let left = this.parseAnd();
|
|
119
129
|
while (this.match("op", "||"))
|
|
@@ -221,6 +231,12 @@ class Parser {
|
|
|
221
231
|
this.advance();
|
|
222
232
|
return { kind: "bool", value: false };
|
|
223
233
|
}
|
|
234
|
+
// Match the body extractor (extract.ts NullLiteral): `null` and
|
|
235
|
+
// `undefined` are interchangeable in LS, both map to None.
|
|
236
|
+
if (t.value === "null") {
|
|
237
|
+
this.advance();
|
|
238
|
+
return { kind: "var", name: "undefined" };
|
|
239
|
+
}
|
|
224
240
|
// new Set<T>() / new Map<K,V>()
|
|
225
241
|
if (t.value === "new") {
|
|
226
242
|
this.advance();
|