@ldclabs/kip-lang 0.4.0 → 2.0.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/CHANGELOG.md +53 -0
- package/LICENSE +21 -0
- package/README.md +89 -64
- package/dist/ast.d.ts +511 -145
- package/dist/ast.d.ts.map +1 -1
- package/dist/diagnostics.d.ts +8 -2
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +32 -3
- package/dist/diagnostics.js.map +1 -1
- package/dist/exec-ast.d.ts +514 -149
- package/dist/exec-ast.d.ts.map +1 -1
- package/dist/exec-ast.js +8 -7
- package/dist/exec-ast.js.map +1 -1
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +870 -479
- package/dist/formatter.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lexer.d.ts.map +1 -1
- package/dist/lexer.js +12 -30
- package/dist/lexer.js.map +1 -1
- package/dist/lower.d.ts +1 -2
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +1287 -598
- package/dist/lower.js.map +1 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +2410 -1300
- package/dist/parser.js.map +1 -1
- package/dist/semantics.d.ts +11 -7
- package/dist/semantics.d.ts.map +1 -1
- package/dist/semantics.js +295 -180
- package/dist/semantics.js.map +1 -1
- package/dist/token.d.ts +130 -40
- package/dist/token.d.ts.map +1 -1
- package/dist/token.js +264 -83
- package/dist/token.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +2 -2
- package/package.json +35 -5
- package/src/ast.ts +914 -0
- package/src/budget.ts +108 -0
- package/src/diagnostics.ts +182 -0
- package/src/errors.ts +42 -0
- package/src/exec-ast.ts +614 -0
- package/src/formatter.ts +1339 -0
- package/src/index.ts +226 -0
- package/src/lexer.ts +459 -0
- package/src/lower.ts +2011 -0
- package/src/parser.ts +3506 -0
- package/src/semantics.ts +392 -0
- package/src/token.ts +408 -0
- package/src/version.ts +13 -0
package/dist/semantics.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Best-effort static checks layered on top of the syntax parser.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
*
|
|
8
|
-
*
|
|
2
|
+
* Best-effort static checks layered on top of the syntax parser.
|
|
3
|
+
*
|
|
4
|
+
* These encode the KIP 2.0 rules that are decidable without a live Schema:
|
|
5
|
+
* - Core registry values written as literals (stance, mode, search mode);
|
|
6
|
+
* - the `[0,1]` ranges Core and the Cognitive Memory Profile fix;
|
|
7
|
+
* - unbounded recall lacking a LIMIT;
|
|
8
|
+
* - local handles referenced inside a mutation plan that nothing binds.
|
|
9
|
+
*
|
|
10
|
+
* Everything requiring the graph's Schema — whether a symbol resolves, whether
|
|
11
|
+
* a field exists, whether a Projection is sufficiently bounded — is left to
|
|
12
|
+
* the engine, which is the only party that knows the active Schema Environment.
|
|
9
13
|
*/
|
|
10
14
|
export function analyzeSemantics(program) {
|
|
11
15
|
const diags = [];
|
|
@@ -14,215 +18,326 @@ export function analyzeSemantics(program) {
|
|
|
14
18
|
}
|
|
15
19
|
return diags;
|
|
16
20
|
}
|
|
21
|
+
/** Core registries (Spec §20.13). A Schema Package may not shadow these. */
|
|
22
|
+
const STANCES = new Set(['support', 'reject', 'uncertain']);
|
|
23
|
+
const MODES = new Set([
|
|
24
|
+
'observed',
|
|
25
|
+
'stated',
|
|
26
|
+
'inferred',
|
|
27
|
+
'predicted',
|
|
28
|
+
'hypothetical',
|
|
29
|
+
'imported'
|
|
30
|
+
]);
|
|
31
|
+
const SEARCH_MODES = new Set(['keyword', 'semantic', 'hybrid']);
|
|
32
|
+
const ASSERTION_STATES = new Set([
|
|
33
|
+
'active',
|
|
34
|
+
'retracted',
|
|
35
|
+
'superseded',
|
|
36
|
+
'expired'
|
|
37
|
+
]);
|
|
38
|
+
const ACTIVITY_TERMINAL = new Set(['completed', 'failed', 'cancelled']);
|
|
39
|
+
/** Signals the Profile fixes to `[0,1]`; none of them is truth. */
|
|
40
|
+
const UNIT_INTERVAL_FIELDS = new Set([
|
|
41
|
+
'confidence',
|
|
42
|
+
'memory_strength',
|
|
43
|
+
'salience',
|
|
44
|
+
'utility',
|
|
45
|
+
'threshold'
|
|
46
|
+
]);
|
|
17
47
|
function analyzeStatement(stmt, diags) {
|
|
18
48
|
switch (stmt.kind) {
|
|
19
49
|
case 'FindStatement':
|
|
20
|
-
|
|
21
|
-
checkWhere(stmt.where, !!stmt.limit, diags);
|
|
50
|
+
checkWhere(stmt.where, !!stmt.limit, diags);
|
|
22
51
|
break;
|
|
23
|
-
case '
|
|
24
|
-
|
|
25
|
-
for (const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
checkPropositionNaming(block, diags);
|
|
37
|
-
checkEndpointNaming(block.subject, diags);
|
|
38
|
-
checkEndpointNaming(block.object, diags);
|
|
39
|
-
checkMetadata(block.metadata, diags);
|
|
40
|
-
}
|
|
52
|
+
case 'MutateStatement':
|
|
53
|
+
checkMutate(stmt, diags);
|
|
54
|
+
for (const clause of stmt.clauses)
|
|
55
|
+
analyzeMutationClause(clause, diags);
|
|
56
|
+
break;
|
|
57
|
+
case 'SearchStatement':
|
|
58
|
+
if (stmt.mode) {
|
|
59
|
+
checkEnum(stmt.mode, SEARCH_MODES, 'SEARCH MODE', diags);
|
|
60
|
+
}
|
|
61
|
+
if (stmt.threshold && stmt.threshold.kind === 'NumberLiteral') {
|
|
62
|
+
checkUnitInterval('THRESHOLD', stmt.threshold.value, stmt.threshold.range, diags);
|
|
41
63
|
}
|
|
42
64
|
break;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
65
|
+
default:
|
|
66
|
+
analyzeMutationClause(stmt, diags);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function analyzeMutationClause(stmt, diags) {
|
|
70
|
+
switch (stmt.kind) {
|
|
71
|
+
case 'AssertStatement':
|
|
72
|
+
checkAssert(stmt, diags);
|
|
73
|
+
break;
|
|
74
|
+
case 'CreateConceptStatement':
|
|
75
|
+
for (const facet of stmt.setFacets)
|
|
76
|
+
checkFacet(facet, diags);
|
|
77
|
+
break;
|
|
78
|
+
case 'UpsertConceptStatement':
|
|
79
|
+
for (const facet of stmt.setFacets)
|
|
80
|
+
checkFacet(facet, diags);
|
|
81
|
+
break;
|
|
82
|
+
case 'CreateAssertionStatement':
|
|
83
|
+
if (stmt.setFields) {
|
|
84
|
+
checkAssignmentValues(stmt.setFields.assignments, diags);
|
|
85
|
+
}
|
|
86
|
+
for (const facet of stmt.setFacets)
|
|
87
|
+
checkFacet(facet, diags);
|
|
46
88
|
break;
|
|
47
|
-
case '
|
|
48
|
-
|
|
89
|
+
case 'CreateEvidenceStatement':
|
|
90
|
+
case 'CreateActivityStatement':
|
|
91
|
+
for (const facet of stmt.setFacets)
|
|
92
|
+
checkFacet(facet, diags);
|
|
49
93
|
break;
|
|
50
|
-
case '
|
|
94
|
+
case 'UpdateStatement':
|
|
95
|
+
for (const action of stmt.actions) {
|
|
96
|
+
if (action.kind === 'SetFacetClause')
|
|
97
|
+
checkFacet(action, diags);
|
|
98
|
+
}
|
|
51
99
|
if (stmt.where)
|
|
52
|
-
checkWhere(stmt.where,
|
|
100
|
+
checkWhere(stmt.where, !!stmt.limit, diags);
|
|
53
101
|
break;
|
|
54
|
-
case '
|
|
55
|
-
|
|
102
|
+
case 'RetractAssertionStatement':
|
|
103
|
+
case 'ArchiveStatement':
|
|
104
|
+
case 'TombstoneStatement':
|
|
105
|
+
if (stmt.expectState) {
|
|
106
|
+
checkEnum(stmt.expectState.value, ASSERTION_STATES, 'EXPECT STATE', diags);
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
case 'TransitionActivityStatement':
|
|
110
|
+
checkEnum(stmt.to, ACTIVITY_TERMINAL, 'TRANSITION ACTIVITY TO', diags);
|
|
56
111
|
break;
|
|
57
112
|
}
|
|
58
113
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
message: `Metadata key '${entry.key}' is in the engine-reserved '_' namespace and is read-only to KML (KIP_2002).`,
|
|
69
|
-
code: 'KIP_2002'
|
|
70
|
-
});
|
|
114
|
+
/**
|
|
115
|
+
* `by` and `mode` carry the whole epistemic commitment, so a literal that is
|
|
116
|
+
* not in the Core registry is a mistake the toolkit can name now rather than
|
|
117
|
+
* letting the engine reject the whole transaction later.
|
|
118
|
+
*/
|
|
119
|
+
function checkAssert(stmt, diags) {
|
|
120
|
+
for (const entry of stmt.assignments.entries) {
|
|
121
|
+
if (entry.key === 'mode') {
|
|
122
|
+
checkEnum(entry.value, MODES, 'ASSERT mode', diags);
|
|
71
123
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (entry.key !== 'type')
|
|
78
|
-
continue;
|
|
79
|
-
const name = literalString(entry);
|
|
80
|
-
// Skip parameters, meta-types ($-prefixed), and error placeholders.
|
|
81
|
-
if (name == null || name === '' || name.startsWith('$'))
|
|
82
|
-
continue;
|
|
83
|
-
if (!/^[A-Z][A-Za-z0-9]*$/.test(name)) {
|
|
84
|
-
diags.push({
|
|
85
|
-
range: entry.range,
|
|
86
|
-
severity: 'warning',
|
|
87
|
-
message: `Concept type '${name}' should be UpperCamelCase (§2.8); mismatched casing resolves to a different, likely undefined type (KIP_2001).`,
|
|
88
|
-
code: 'KIP_2001'
|
|
89
|
-
});
|
|
124
|
+
else if (entry.key === 'stance') {
|
|
125
|
+
checkEnum(entry.value, STANCES, 'ASSERT stance', diags);
|
|
126
|
+
}
|
|
127
|
+
else if (entry.key === 'confidence' && entry.value.kind === 'NumberLiteral') {
|
|
128
|
+
checkUnitInterval('confidence', entry.value.value, entry.value.range, diags);
|
|
90
129
|
}
|
|
91
130
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
else if (endpoint.kind === 'PropositionPattern') {
|
|
101
|
-
checkPropositionNaming(endpoint, diags);
|
|
102
|
-
checkEndpointNaming(endpoint.subject, diags);
|
|
103
|
-
checkEndpointNaming(endpoint.object, diags);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function checkPredicateName(predicate, range, diags) {
|
|
107
|
-
if (predicate === '')
|
|
108
|
-
return;
|
|
109
|
-
if (!/^[a-z_][a-z0-9_]*$/.test(predicate)) {
|
|
131
|
+
// An observation with no cited artifact is still a valid Assertion, but it
|
|
132
|
+
// is the shape that most often should have carried Evidence.
|
|
133
|
+
const mode = stmt.assignments.entries.find((e) => e.key === 'mode');
|
|
134
|
+
const hasEvidence = stmt.assignments.entries.some((e) => e.key === 'evidence');
|
|
135
|
+
if (mode &&
|
|
136
|
+
mode.value.kind === 'StringLiteral' &&
|
|
137
|
+
mode.value.parsed === 'observed' &&
|
|
138
|
+
!hasEvidence) {
|
|
110
139
|
diags.push({
|
|
111
|
-
range,
|
|
112
|
-
severity: '
|
|
113
|
-
message:
|
|
114
|
-
code: '
|
|
140
|
+
range: stmt.assignments.range,
|
|
141
|
+
severity: 'info',
|
|
142
|
+
message: 'mode: "observed" without evidence: an observation normally cites the artifact it was observed from',
|
|
143
|
+
code: 'KIP_2101'
|
|
115
144
|
});
|
|
116
145
|
}
|
|
117
146
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const constrained = new Set();
|
|
121
|
-
collectConstrainedVars(where.patterns, constrained);
|
|
122
|
-
checkPatternNaming(where.patterns, diags);
|
|
123
|
-
walkPropositions(where.patterns, (p) => {
|
|
124
|
-
if (hasLimit)
|
|
125
|
-
return;
|
|
126
|
-
if (p.predicate?.kind !== 'PredicateVariable')
|
|
127
|
-
return;
|
|
128
|
-
if (isUnconstrained(p.subject, constrained) &&
|
|
129
|
-
isUnconstrained(p.object, constrained)) {
|
|
130
|
-
diags.push({
|
|
131
|
-
range: p.range,
|
|
132
|
-
severity: 'warning',
|
|
133
|
-
message: `Unbounded exploration '(?s, ?p, ?o)' with no constrained endpoint should be paired with a LIMIT (KIP_4002).`,
|
|
134
|
-
code: 'KIP_4002'
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
});
|
|
147
|
+
function checkFacet(clause, diags) {
|
|
148
|
+
checkAssignmentValues(clause.assignments, diags);
|
|
138
149
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
checkMatcherNaming(p.matcher, diags);
|
|
145
|
-
break;
|
|
146
|
-
case 'PropositionPattern':
|
|
147
|
-
checkPropositionNaming(p, diags);
|
|
148
|
-
checkEndpointNaming(p.subject, diags);
|
|
149
|
-
checkEndpointNaming(p.object, diags);
|
|
150
|
-
break;
|
|
151
|
-
case 'NotClause':
|
|
152
|
-
case 'OptionalClause':
|
|
153
|
-
case 'UnionClause':
|
|
154
|
-
checkPatternNaming(p.patterns, diags);
|
|
155
|
-
break;
|
|
150
|
+
function checkAssignmentValues(object, diags) {
|
|
151
|
+
for (const entry of object.entries) {
|
|
152
|
+
if (UNIT_INTERVAL_FIELDS.has(entry.key) &&
|
|
153
|
+
entry.value.kind === 'NumberLiteral') {
|
|
154
|
+
checkUnitInterval(entry.key, entry.value.value, entry.value.range, diags);
|
|
156
155
|
}
|
|
156
|
+
if (entry.key === 'stance')
|
|
157
|
+
checkEnum(entry.value, STANCES, 'stance', diags);
|
|
158
|
+
if (entry.key === 'mode')
|
|
159
|
+
checkEnum(entry.value, MODES, 'mode', diags);
|
|
157
160
|
}
|
|
158
161
|
}
|
|
159
|
-
function
|
|
160
|
-
|
|
161
|
-
if (
|
|
162
|
+
function checkEnum(value, allowed, label, diags) {
|
|
163
|
+
// A parameter is bound at execution time; only a written literal is checkable.
|
|
164
|
+
if (value.kind !== 'StringLiteral')
|
|
165
|
+
return;
|
|
166
|
+
if (allowed.has(value.parsed))
|
|
167
|
+
return;
|
|
168
|
+
diags.push({
|
|
169
|
+
range: value.range,
|
|
170
|
+
severity: 'error',
|
|
171
|
+
message: `${label} must be one of ${[...allowed].join(', ')}, got "${value.parsed}"`,
|
|
172
|
+
code: 'KIP_2001'
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function checkUnitInterval(field, value, range, diags) {
|
|
176
|
+
if (value >= 0 && value <= 1)
|
|
162
177
|
return;
|
|
163
|
-
|
|
164
|
-
|
|
178
|
+
diags.push({
|
|
179
|
+
range,
|
|
180
|
+
severity: 'error',
|
|
181
|
+
message: `${field} must be within [0, 1], got ${value}`,
|
|
182
|
+
code: 'KIP_2001'
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
// ---------------------------------------------------------------------------
|
|
186
|
+
// Handles
|
|
187
|
+
// ---------------------------------------------------------------------------
|
|
188
|
+
/**
|
|
189
|
+
* Handles are block-local and forward references are allowed, so binding is
|
|
190
|
+
* checked against the whole plan rather than in source order. A reference
|
|
191
|
+
* nothing binds is a typo the engine would only find at validation time.
|
|
192
|
+
*/
|
|
193
|
+
function checkMutate(stmt, diags) {
|
|
194
|
+
const bound = new Set();
|
|
195
|
+
for (const clause of stmt.clauses) {
|
|
196
|
+
const handle = handleNameOf(clause);
|
|
197
|
+
if (handle)
|
|
198
|
+
bound.add(handle);
|
|
165
199
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
200
|
+
const referenced = [];
|
|
201
|
+
for (const clause of stmt.clauses)
|
|
202
|
+
collectHandleRefs(clause, referenced);
|
|
203
|
+
for (const ref of referenced) {
|
|
204
|
+
if (!bound.has(ref.name)) {
|
|
205
|
+
diags.push({
|
|
206
|
+
range: ref.range,
|
|
207
|
+
severity: 'error',
|
|
208
|
+
message: `?${ref.name} is not bound by any clause in this MUTATE block`,
|
|
209
|
+
code: 'KIP_2102'
|
|
210
|
+
});
|
|
169
211
|
}
|
|
170
212
|
}
|
|
171
213
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
214
|
+
function handleNameOf(clause) {
|
|
215
|
+
switch (clause.kind) {
|
|
216
|
+
case 'CreateConceptStatement':
|
|
217
|
+
case 'UpsertConceptStatement':
|
|
218
|
+
case 'CreateEvidenceStatement':
|
|
219
|
+
case 'CreateAssertionStatement':
|
|
220
|
+
case 'CreateActivityStatement':
|
|
221
|
+
return clause.handle.name.slice(1);
|
|
222
|
+
case 'EnsurePropositionStatement':
|
|
223
|
+
case 'AssertStatement':
|
|
224
|
+
return clause.handle ? clause.handle.name.slice(1) : null;
|
|
225
|
+
default:
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
179
228
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
192
|
-
break;
|
|
193
|
-
case 'NotClause':
|
|
194
|
-
case 'OptionalClause':
|
|
195
|
-
case 'UnionClause':
|
|
196
|
-
collectConstrainedVars(p.patterns, out);
|
|
197
|
-
break;
|
|
229
|
+
/** Collects `?handle` uses in value positions, where they must resolve. */
|
|
230
|
+
function collectHandleRefs(clause, out) {
|
|
231
|
+
const fromObject = (object) => {
|
|
232
|
+
if (!object)
|
|
233
|
+
return;
|
|
234
|
+
for (const entry of object.entries)
|
|
235
|
+
fromExpression(entry.value);
|
|
236
|
+
};
|
|
237
|
+
const fromExpression = (expr) => {
|
|
238
|
+
if (expr.kind === 'VariableRef') {
|
|
239
|
+
out.push({ name: expr.name.slice(1), range: expr.range });
|
|
198
240
|
}
|
|
241
|
+
else if (expr.kind === 'ArrayLiteral') {
|
|
242
|
+
for (const element of expr.elements)
|
|
243
|
+
fromExpression(element);
|
|
244
|
+
}
|
|
245
|
+
else if (expr.kind === 'ObjectLiteral') {
|
|
246
|
+
for (const entry of expr.entries)
|
|
247
|
+
fromExpression(entry.value);
|
|
248
|
+
}
|
|
249
|
+
else if (expr.kind === 'FunctionCallExpr') {
|
|
250
|
+
for (const arg of expr.args)
|
|
251
|
+
fromExpression(arg);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
switch (clause.kind) {
|
|
255
|
+
case 'CreateConceptStatement':
|
|
256
|
+
case 'UpsertConceptStatement':
|
|
257
|
+
fromObject(clause.setFields?.assignments);
|
|
258
|
+
fromObject(clause.setAttributes?.assignments);
|
|
259
|
+
for (const facet of clause.setFacets)
|
|
260
|
+
fromObject(facet.assignments);
|
|
261
|
+
for (const edge of clause.setStructural?.assignments ?? []) {
|
|
262
|
+
fromExpression(edge.value);
|
|
263
|
+
}
|
|
264
|
+
break;
|
|
265
|
+
case 'CreateEvidenceStatement':
|
|
266
|
+
case 'CreateAssertionStatement':
|
|
267
|
+
case 'CreateActivityStatement':
|
|
268
|
+
fromObject(clause.setFields?.assignments);
|
|
269
|
+
for (const facet of clause.setFacets)
|
|
270
|
+
fromObject(facet.assignments);
|
|
271
|
+
for (const edge of clause.setStructural?.assignments ?? []) {
|
|
272
|
+
fromExpression(edge.value);
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
case 'AssertStatement':
|
|
276
|
+
fromObject(clause.assignments);
|
|
277
|
+
if (clause.superseding?.kind === 'VariableRef') {
|
|
278
|
+
out.push({
|
|
279
|
+
name: clause.superseding.name.slice(1),
|
|
280
|
+
range: clause.superseding.range
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
break;
|
|
284
|
+
case 'SupersedeAssertionStatement':
|
|
285
|
+
case 'CorrectEvidenceStatement':
|
|
286
|
+
for (const ref of [clause.target, clause.by]) {
|
|
287
|
+
if (ref.kind === 'VariableRef') {
|
|
288
|
+
out.push({ name: ref.name.slice(1), range: ref.range });
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
199
292
|
}
|
|
200
293
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
294
|
+
// ---------------------------------------------------------------------------
|
|
295
|
+
// Unbounded recall
|
|
296
|
+
// ---------------------------------------------------------------------------
|
|
297
|
+
function checkWhere(where, hasLimit, diags) {
|
|
298
|
+
if (hasLimit)
|
|
299
|
+
return;
|
|
300
|
+
if (where.patterns.length === 0)
|
|
301
|
+
return;
|
|
302
|
+
// A pattern that constrains nothing enumerates the Space. That is a real
|
|
303
|
+
// query, but at scale it is almost always an omitted LIMIT.
|
|
304
|
+
if (where.patterns.every(isUnconstrained)) {
|
|
305
|
+
diags.push({
|
|
306
|
+
range: where.range,
|
|
307
|
+
severity: 'warning',
|
|
308
|
+
message: 'this pattern constrains nothing and will scan the whole MemorySpace; add a LIMIT or a more specific match',
|
|
309
|
+
code: 'KIP_4002'
|
|
310
|
+
});
|
|
206
311
|
}
|
|
207
312
|
}
|
|
208
|
-
function
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
313
|
+
function isUnconstrained(pattern) {
|
|
314
|
+
switch (pattern.kind) {
|
|
315
|
+
case 'ConceptPattern':
|
|
316
|
+
return isEmptyMatcher(pattern.matcher);
|
|
317
|
+
case 'AssertionPattern':
|
|
318
|
+
case 'EvidencePattern':
|
|
319
|
+
case 'ActivityPattern':
|
|
320
|
+
return isEmptyMatcher(pattern.matcher);
|
|
321
|
+
case 'PropositionPattern':
|
|
322
|
+
// `(id: ...)` names one Proposition, so it never scans.
|
|
323
|
+
if (pattern.tuple.id)
|
|
324
|
+
return false;
|
|
325
|
+
return (!!pattern.tuple.subject &&
|
|
326
|
+
!!pattern.tuple.object &&
|
|
327
|
+
isOpenTerm(pattern.tuple.subject) &&
|
|
328
|
+
isOpenTerm(pattern.tuple.object));
|
|
329
|
+
default:
|
|
330
|
+
return false;
|
|
220
331
|
}
|
|
221
332
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
333
|
+
function isEmptyMatcher(matcher) {
|
|
334
|
+
return matcher.members.length === 0;
|
|
335
|
+
}
|
|
336
|
+
function isOpenTerm(term) {
|
|
337
|
+
if (term.kind === 'VariableRef')
|
|
338
|
+
return true;
|
|
339
|
+
if (term.kind === 'ObjectPattern')
|
|
340
|
+
return term.members.length === 0;
|
|
341
|
+
return false;
|
|
227
342
|
}
|
|
228
343
|
//# sourceMappingURL=semantics.js.map
|
package/dist/semantics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semantics.js","sourceRoot":"","sources":["../src/semantics.ts"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,MAAM,KAAK,GAAiB,EAAE,CAAA;IAC9B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACtC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAC/B,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAe,EAAE,KAAmB;IAC5D,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,eAAe;YAClB,IAAI,IAAI,CAAC,KAAK;gBAAE,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;YAC3D,MAAK;QACP,KAAK,iBAAiB;YACpB,aAAa,CAAC,IAAI,CA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