sf-agentpmd 0.1.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/LICENSE +21 -0
- package/NOTICE +26 -0
- package/README.md +204 -0
- package/bin/dev.js +5 -0
- package/bin/run.js +3 -0
- package/dist/analyzer/action-references.d.ts +21 -0
- package/dist/analyzer/action-references.js +130 -0
- package/dist/analyzer/action-references.js.map +1 -0
- package/dist/analyzer/analyze.d.ts +43 -0
- package/dist/analyzer/analyze.js +222 -0
- package/dist/analyzer/analyze.js.map +1 -0
- package/dist/analyzer/apex-analyze.d.ts +14 -0
- package/dist/analyzer/apex-analyze.js +60 -0
- package/dist/analyzer/apex-analyze.js.map +1 -0
- package/dist/analyzer/apex-complexity.d.ts +27 -0
- package/dist/analyzer/apex-complexity.js +133 -0
- package/dist/analyzer/apex-complexity.js.map +1 -0
- package/dist/analyzer/apex-parse.d.ts +39 -0
- package/dist/analyzer/apex-parse.js +32 -0
- package/dist/analyzer/apex-parse.js.map +1 -0
- package/dist/analyzer/apex-resolve.d.ts +32 -0
- package/dist/analyzer/apex-resolve.js +59 -0
- package/dist/analyzer/apex-resolve.js.map +1 -0
- package/dist/analyzer/complexity.d.ts +30 -0
- package/dist/analyzer/complexity.js +126 -0
- package/dist/analyzer/complexity.js.map +1 -0
- package/dist/analyzer/parse.d.ts +51 -0
- package/dist/analyzer/parse.js +143 -0
- package/dist/analyzer/parse.js.map +1 -0
- package/dist/analyzer/project.d.ts +12 -0
- package/dist/analyzer/project.js +51 -0
- package/dist/analyzer/project.js.map +1 -0
- package/dist/analyzer/types.d.ts +76 -0
- package/dist/analyzer/types.js +2 -0
- package/dist/analyzer/types.js.map +1 -0
- package/dist/commands/agentpmd/analyze.d.ts +20 -0
- package/dist/commands/agentpmd/analyze.js +122 -0
- package/dist/commands/agentpmd/analyze.js.map +1 -0
- package/dist/commands/agentpmd/install-skill.d.ts +11 -0
- package/dist/commands/agentpmd/install-skill.js +33 -0
- package/dist/commands/agentpmd/install-skill.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/renderers/csv.d.ts +6 -0
- package/dist/renderers/csv.js +78 -0
- package/dist/renderers/csv.js.map +1 -0
- package/dist/renderers/index.d.ts +8 -0
- package/dist/renderers/index.js +25 -0
- package/dist/renderers/index.js.map +1 -0
- package/dist/renderers/markdown.d.ts +12 -0
- package/dist/renderers/markdown.js +233 -0
- package/dist/renderers/markdown.js.map +1 -0
- package/dist/renderers/options.d.ts +20 -0
- package/dist/renderers/options.js +2 -0
- package/dist/renderers/options.js.map +1 -0
- package/dist/renderers/sarif.d.ts +3 -0
- package/dist/renderers/sarif.js +131 -0
- package/dist/renderers/sarif.js.map +1 -0
- package/dist/renderers/text.d.ts +3 -0
- package/dist/renderers/text.js +243 -0
- package/dist/renderers/text.js.map +1 -0
- package/oclif.manifest.json +168 -0
- package/package.json +97 -0
- package/skill/SKILL.md +103 -0
- package/skill/references/command-structure.md +89 -0
- package/skill/references/install.md +112 -0
- package/skill/references/output-formats.md +205 -0
- package/skill/references/upgrade.md +112 -0
- package/vendor/agentscript-parser-javascript/dist/cst-node.d.ts +83 -0
- package/vendor/agentscript-parser-javascript/dist/cst-node.js +238 -0
- package/vendor/agentscript-parser-javascript/dist/errors.d.ts +34 -0
- package/vendor/agentscript-parser-javascript/dist/errors.js +74 -0
- package/vendor/agentscript-parser-javascript/dist/expressions.d.ts +36 -0
- package/vendor/agentscript-parser-javascript/dist/expressions.js +682 -0
- package/vendor/agentscript-parser-javascript/dist/highlighter.d.ts +24 -0
- package/vendor/agentscript-parser-javascript/dist/highlighter.js +260 -0
- package/vendor/agentscript-parser-javascript/dist/index.d.ts +29 -0
- package/vendor/agentscript-parser-javascript/dist/index.js +35 -0
- package/vendor/agentscript-parser-javascript/dist/lexer.d.ts +60 -0
- package/vendor/agentscript-parser-javascript/dist/lexer.js +630 -0
- package/vendor/agentscript-parser-javascript/dist/parse-mapping.d.ts +46 -0
- package/vendor/agentscript-parser-javascript/dist/parse-mapping.js +549 -0
- package/vendor/agentscript-parser-javascript/dist/parse-sequence.d.ts +10 -0
- package/vendor/agentscript-parser-javascript/dist/parse-sequence.js +118 -0
- package/vendor/agentscript-parser-javascript/dist/parse-statements.d.ts +15 -0
- package/vendor/agentscript-parser-javascript/dist/parse-statements.js +519 -0
- package/vendor/agentscript-parser-javascript/dist/parse-templates.d.ts +15 -0
- package/vendor/agentscript-parser-javascript/dist/parse-templates.js +323 -0
- package/vendor/agentscript-parser-javascript/dist/parser.d.ts +65 -0
- package/vendor/agentscript-parser-javascript/dist/parser.js +163 -0
- package/vendor/agentscript-parser-javascript/dist/recovery.d.ts +51 -0
- package/vendor/agentscript-parser-javascript/dist/recovery.js +199 -0
- package/vendor/agentscript-parser-javascript/dist/token.d.ts +58 -0
- package/vendor/agentscript-parser-javascript/dist/token.js +62 -0
- package/vendor/agentscript-parser-javascript/package.json +19 -0
- package/vendor/agentscript-types/dist/comment.d.ts +11 -0
- package/vendor/agentscript-types/dist/comment.js +10 -0
- package/vendor/agentscript-types/dist/cst.d.ts +7 -0
- package/vendor/agentscript-types/dist/cst.js +8 -0
- package/vendor/agentscript-types/dist/diagnostic.d.ts +34 -0
- package/vendor/agentscript-types/dist/diagnostic.js +23 -0
- package/vendor/agentscript-types/dist/index.d.ts +9 -0
- package/vendor/agentscript-types/dist/index.js +10 -0
- package/vendor/agentscript-types/dist/position.d.ts +11 -0
- package/vendor/agentscript-types/dist/position.js +16 -0
- package/vendor/agentscript-types/dist/syntax-node.d.ts +39 -0
- package/vendor/agentscript-types/dist/syntax-node.js +8 -0
- package/vendor/agentscript-types/package.json +15 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
* For full license text, see the LICENSE file in the repo root or https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Mapping, block-value, and colinear parsing functions extracted from Parser class.
|
|
9
|
+
*
|
|
10
|
+
* Each function takes a ParserContext as its first parameter, following
|
|
11
|
+
* the same free-function pattern as parse-statements.ts and expressions.ts.
|
|
12
|
+
*
|
|
13
|
+
* To avoid circular dependencies with parse-sequence.ts, parseBlockValue
|
|
14
|
+
* receives parseSequence as a callback parameter.
|
|
15
|
+
*/
|
|
16
|
+
import { isTokenKind, TokenKind } from './token.js';
|
|
17
|
+
import { CSTNode } from './cst-node.js';
|
|
18
|
+
import { makeErrorNode, tokenToAutoLeaf } from './errors.js';
|
|
19
|
+
import { makeEmptyError, makeMissing, synchronize, synchronizeRow, recoverToBlockEnd, parseOrphanBlock, skipNewlines, consumeCommentsAndSkipNewlines, isAtEnd, isTrailingCommentOnly, } from './recovery.js';
|
|
20
|
+
import { parseExpression, wrapExpression, isKeyStart, isKeyTokenStart, isKeyTokenContinuation, parseKey, ATOM_TYPES, } from './expressions.js';
|
|
21
|
+
import { isStatementStart, parseProcedure, parseSetStatement, parseTransitionStatement, parseWithStatement, parseAvailableWhenStatement, tryParseWithToStatementList, parseIfStatement, parseRunStatement, } from './parse-statements.js';
|
|
22
|
+
import { parseTemplate, parseTemplateAsColinear } from './parse-templates.js';
|
|
23
|
+
import invariant from 'tiny-invariant';
|
|
24
|
+
/**
|
|
25
|
+
* Maximum tokens to scan ahead when distinguishing a mapping key from an
|
|
26
|
+
* expression. Keys are typically 1-3 words; 10 handles any realistic case
|
|
27
|
+
* with margin. The loop terminates early on COLON, NEWLINE, or non-key tokens,
|
|
28
|
+
* so this limit is a safety cap, not a performance concern.
|
|
29
|
+
*/
|
|
30
|
+
const MAX_KEY_LOOKAHEAD = 10;
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Exported mapping parsers
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
/**
|
|
35
|
+
* Parse a mapping-or-expression at the top level.
|
|
36
|
+
* If the current position starts a mapping, delegates to parseMapping;
|
|
37
|
+
* otherwise parses an expression (possibly an assignment).
|
|
38
|
+
*/
|
|
39
|
+
export function parseMappingOrExpression(ctx, parseSequence) {
|
|
40
|
+
// Look ahead: if we see ID/STRING followed by COLON, it's a mapping
|
|
41
|
+
if (isMappingStart(ctx)) {
|
|
42
|
+
return parseMapping(ctx, parseSequence);
|
|
43
|
+
}
|
|
44
|
+
// Otherwise, try expression (or assignment_expression)
|
|
45
|
+
const expr = parseExpression(ctx, 0);
|
|
46
|
+
if (!expr)
|
|
47
|
+
return null;
|
|
48
|
+
// Check for assignment: expr = expr
|
|
49
|
+
if (isTokenKind(ctx.peek(), TokenKind.EQ)) {
|
|
50
|
+
const node = ctx.startNodeAt('assignment_expression', expr);
|
|
51
|
+
node.appendChild(wrapExpression(ctx, expr), 'left');
|
|
52
|
+
ctx.addAnonymousChild(node, ctx.consumeKind(TokenKind.EQ));
|
|
53
|
+
const right = parseExpression(ctx, 0);
|
|
54
|
+
if (right)
|
|
55
|
+
node.appendChild(wrapExpression(ctx, right), 'right');
|
|
56
|
+
return node;
|
|
57
|
+
}
|
|
58
|
+
return wrapExpression(ctx, expr);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Lookahead to determine if the current position starts a mapping (key-value
|
|
62
|
+
* pairs) rather than an expression.
|
|
63
|
+
*
|
|
64
|
+
* Keys are at most a few tokens (1-3 words, possibly with hyphens/dots), so
|
|
65
|
+
* we only need a small lookahead window. The limit exists as a safety cap —
|
|
66
|
+
* it should never be reached on valid input.
|
|
67
|
+
*/
|
|
68
|
+
export function isMappingStart(ctx) {
|
|
69
|
+
const tok = ctx.peek();
|
|
70
|
+
// Comment at start can begin a mapping (comments are valid mapping items)
|
|
71
|
+
if (tok.kind === TokenKind.COMMENT)
|
|
72
|
+
return true;
|
|
73
|
+
// Template pipe at start can begin a mapping item (template as statement)
|
|
74
|
+
if (tok.kind === TokenKind.PIPE)
|
|
75
|
+
return true;
|
|
76
|
+
// Statement keywords (not followed by colon) start mappings
|
|
77
|
+
if (tok.kind === TokenKind.ID && isStatementStart(ctx))
|
|
78
|
+
return true;
|
|
79
|
+
// First token must be able to start a key; bail early otherwise.
|
|
80
|
+
if (!isKeyTokenStart(tok.kind))
|
|
81
|
+
return false;
|
|
82
|
+
// Scan forward on the same line past key-like tokens (ID, STRING, NUMBER,
|
|
83
|
+
// MINUS, DOT) looking for COLON (normal case), INDENT/ARROW (missing-colon
|
|
84
|
+
// recovery), AT (missing-colon with @-expression value), or STRING/NUMBER
|
|
85
|
+
// after a single ID key (missing-colon with literal value).
|
|
86
|
+
const startRow = tok.start.row;
|
|
87
|
+
for (let i = 1; i < MAX_KEY_LOOKAHEAD; i++) {
|
|
88
|
+
const t = ctx.peekAt(i);
|
|
89
|
+
if (t.kind === TokenKind.COLON ||
|
|
90
|
+
t.kind === TokenKind.INDENT ||
|
|
91
|
+
t.kind === TokenKind.ARROW ||
|
|
92
|
+
t.kind === TokenKind.AT)
|
|
93
|
+
return true;
|
|
94
|
+
// A STRING or NUMBER immediately after a single ID key suggests
|
|
95
|
+
// a missing colon (e.g., `agent_name "WeatherBot"`).
|
|
96
|
+
// Only trigger this on the first lookahead position (i === 1) to
|
|
97
|
+
// avoid false positives with multi-word keys.
|
|
98
|
+
if (i === 1 && (t.kind === TokenKind.STRING || t.kind === TokenKind.NUMBER))
|
|
99
|
+
return true;
|
|
100
|
+
if (t.kind === TokenKind.EOF || t.start.row !== startRow)
|
|
101
|
+
return false;
|
|
102
|
+
if (!isKeyTokenContinuation(t.kind))
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Parse a mapping (sequence of key-value pairs).
|
|
109
|
+
*/
|
|
110
|
+
export function parseMapping(ctx, parseSequence) {
|
|
111
|
+
const node = ctx.startNode('mapping');
|
|
112
|
+
while (!isAtEnd(ctx)) {
|
|
113
|
+
skipNewlines(ctx);
|
|
114
|
+
const tok = ctx.peek();
|
|
115
|
+
if (tok.kind === TokenKind.DEDENT || tok.kind === TokenKind.EOF)
|
|
116
|
+
break;
|
|
117
|
+
// Don't consume trailing comments that belong to the parent scope.
|
|
118
|
+
if (tok.kind === TokenKind.COMMENT && isTrailingCommentOnly(ctx)) {
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
const item = parseMappingItem(ctx, parseSequence);
|
|
122
|
+
if (item) {
|
|
123
|
+
node.appendChild(item);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// Can't parse — synchronize (skip to next line)
|
|
127
|
+
const err = synchronize(ctx);
|
|
128
|
+
if (err) {
|
|
129
|
+
node.appendChild(err);
|
|
130
|
+
}
|
|
131
|
+
else if (!isAtEnd(ctx) && ctx.peekKind() !== TokenKind.DEDENT) {
|
|
132
|
+
// Consume at least one token to avoid infinite loop
|
|
133
|
+
ctx.consume();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return node;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Parse a single mapping item (statement, template, comment, or key:value element).
|
|
141
|
+
*/
|
|
142
|
+
export function parseMappingItem(ctx, parseSequence) {
|
|
143
|
+
const tok = ctx.peek();
|
|
144
|
+
// Statement keywords always take the statement path (tree-sitter parity).
|
|
145
|
+
// Keywords cannot be used as mapping keys.
|
|
146
|
+
if (tok.kind === TokenKind.ID) {
|
|
147
|
+
switch (tok.text) {
|
|
148
|
+
case 'if':
|
|
149
|
+
return parseIfStatement(ctx, c => parseTemplate(c));
|
|
150
|
+
case 'run':
|
|
151
|
+
return parseRunStatement(ctx, c => parseTemplate(c));
|
|
152
|
+
case 'set':
|
|
153
|
+
return parseSetStatement(ctx);
|
|
154
|
+
case 'transition':
|
|
155
|
+
return parseTransitionStatement(ctx);
|
|
156
|
+
case 'with': {
|
|
157
|
+
if (ctx.peekAt(1).kind !== TokenKind.COLON) {
|
|
158
|
+
return parseWithStatement(ctx);
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
case 'available': {
|
|
163
|
+
if (ctx.peekAt(1).kind === TokenKind.ID &&
|
|
164
|
+
ctx.peekAt(1).text === 'when') {
|
|
165
|
+
return parseAvailableWhenStatement(ctx);
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Template
|
|
172
|
+
if (tok.kind === TokenKind.PIPE) {
|
|
173
|
+
return parseTemplate(ctx);
|
|
174
|
+
}
|
|
175
|
+
// Comment
|
|
176
|
+
if (tok.kind === TokenKind.COMMENT) {
|
|
177
|
+
return ctx.consumeNamed('comment');
|
|
178
|
+
}
|
|
179
|
+
// Standalone else/elif/for — wrap in ERROR with parsed body
|
|
180
|
+
if (tok.kind === TokenKind.ID &&
|
|
181
|
+
(tok.text === 'else' || tok.text === 'elif' || tok.text === 'for')) {
|
|
182
|
+
return parseOrphanBlock(ctx, c => parseProcedure(c, c2 => parseTemplate(c2)));
|
|
183
|
+
}
|
|
184
|
+
// Mapping element (key: value)
|
|
185
|
+
if (isKeyStart(ctx)) {
|
|
186
|
+
return parseMappingElement(ctx, parseSequence);
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
// ---------------------------------------------------------------------------
|
|
191
|
+
// Exported helpers needed by parse-sequence.ts (T04)
|
|
192
|
+
// ---------------------------------------------------------------------------
|
|
193
|
+
/**
|
|
194
|
+
* Check if the current position starts a colinear mapping element (key: value
|
|
195
|
+
* on same line after "- ").
|
|
196
|
+
*/
|
|
197
|
+
export function isColinearMappingElement(ctx) {
|
|
198
|
+
// key: value on same line after "- "
|
|
199
|
+
if (!isKeyStart(ctx))
|
|
200
|
+
return false;
|
|
201
|
+
const tok = ctx.peek();
|
|
202
|
+
// Look ahead: ID/STRING then COLON on same line
|
|
203
|
+
const lookahead = 1;
|
|
204
|
+
// Two-word key?
|
|
205
|
+
if (ctx.peekAt(lookahead).kind === TokenKind.ID &&
|
|
206
|
+
ctx.peekAt(lookahead).start.row === tok.start.row) {
|
|
207
|
+
const afterSecond = ctx.peekAt(lookahead + 1);
|
|
208
|
+
if (afterSecond.kind === TokenKind.COLON &&
|
|
209
|
+
afterSecond.start.row === tok.start.row) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
// Don't eagerly consume two-word key if first word is followed by colon
|
|
213
|
+
}
|
|
214
|
+
const next = ctx.peekAt(lookahead);
|
|
215
|
+
return next.kind === TokenKind.COLON && next.start.row === tok.start.row;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Parse a colinear mapping element (key: value on the same line as "- ").
|
|
219
|
+
*/
|
|
220
|
+
export function parseColinearMappingElement(ctx) {
|
|
221
|
+
const startTok = ctx.peek();
|
|
222
|
+
const node = ctx.startNode('mapping_element');
|
|
223
|
+
const key = parseKey(ctx);
|
|
224
|
+
if (key)
|
|
225
|
+
node.appendChild(key, 'key');
|
|
226
|
+
if (ctx.peekKind() === TokenKind.COLON) {
|
|
227
|
+
ctx.addAnonymousChild(node, ctx.consume());
|
|
228
|
+
}
|
|
229
|
+
const colinear = tryParseColinearValue(ctx);
|
|
230
|
+
if (colinear) {
|
|
231
|
+
if (colinear.errorPrefix)
|
|
232
|
+
node.appendChild(colinear.errorPrefix);
|
|
233
|
+
node.appendChild(colinear.value, 'colinear_value');
|
|
234
|
+
}
|
|
235
|
+
ctx.finishNode(node, startTok);
|
|
236
|
+
return node;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Try to parse a colinear value (template, variable declaration, or expression).
|
|
240
|
+
* Returns the parsed value node and optional error prefix, or null if nothing
|
|
241
|
+
* can be parsed.
|
|
242
|
+
*/
|
|
243
|
+
export function tryParseColinearValue(ctx) {
|
|
244
|
+
const tok = ctx.peek();
|
|
245
|
+
// Template
|
|
246
|
+
if (tok.kind === TokenKind.PIPE) {
|
|
247
|
+
return { value: parseTemplateAsColinear(ctx) };
|
|
248
|
+
}
|
|
249
|
+
// Variable declaration: mutable/linked
|
|
250
|
+
if (tok.kind === TokenKind.ID &&
|
|
251
|
+
(tok.text === 'mutable' || tok.text === 'linked')) {
|
|
252
|
+
return { value: parseVariableDeclaration(ctx) };
|
|
253
|
+
}
|
|
254
|
+
// Fuzzy modifier: close misspelling of mutable/linked → parse as variable_declaration
|
|
255
|
+
// with the misspelled token wrapped in ERROR
|
|
256
|
+
if (tok.kind === TokenKind.ID && isFuzzyModifier(tok.text)) {
|
|
257
|
+
return { value: parseFuzzyVariableDeclaration(ctx) };
|
|
258
|
+
}
|
|
259
|
+
// expression_with_to: expression followed by optional with/to clauses
|
|
260
|
+
const expr = parseExpression(ctx, 0);
|
|
261
|
+
if (!expr)
|
|
262
|
+
return null;
|
|
263
|
+
// Check for error prefix: if the expression is a number or digit-starting ID
|
|
264
|
+
// (like "123" or "123bad") AND the next token is an ID on the same line,
|
|
265
|
+
// the first is an error prefix and the second is the real value.
|
|
266
|
+
// Wrap the first in ERROR and re-parse the rest.
|
|
267
|
+
if ((expr.type === 'number' ||
|
|
268
|
+
(expr.type === 'id' && /^[0-9]/.test(expr.text))) &&
|
|
269
|
+
ctx.peekKind() === TokenKind.ID &&
|
|
270
|
+
ctx.peek().start.row === expr.startRow) {
|
|
271
|
+
// Wrap number/digit-starting ID in ERROR
|
|
272
|
+
const errNode = makeErrorNode(ctx.source, [wrapExpression(ctx, expr)], expr.startOffset, expr.endOffset, expr.startPosition, expr.endPosition);
|
|
273
|
+
// Now re-parse the real colinear value (could be variable_declaration or expression)
|
|
274
|
+
const realValue = tryParseColinearValue(ctx);
|
|
275
|
+
// If we got a real value, return it with the error prefix for the caller to handle.
|
|
276
|
+
if (realValue) {
|
|
277
|
+
return { value: realValue.value, errorPrefix: errNode };
|
|
278
|
+
}
|
|
279
|
+
// No real value — just return the expression as-is
|
|
280
|
+
}
|
|
281
|
+
// Check for with/to statement list
|
|
282
|
+
const withToList = tryParseWithToStatementList(ctx);
|
|
283
|
+
if (withToList) {
|
|
284
|
+
const ewt = ctx.startNodeAt('expression_with_to', expr);
|
|
285
|
+
ewt.appendChild(wrapExpression(ctx, expr), 'expression');
|
|
286
|
+
ewt.appendChild(withToList, 'with_to_statement_list');
|
|
287
|
+
ewt.finalize();
|
|
288
|
+
return { value: ewt };
|
|
289
|
+
}
|
|
290
|
+
// Check for assignment: expr = expr
|
|
291
|
+
if (ctx.peekKind() === TokenKind.EQ) {
|
|
292
|
+
const assign = ctx.startNodeAt('assignment_expression', expr);
|
|
293
|
+
assign.appendChild(wrapExpression(ctx, expr), 'left');
|
|
294
|
+
ctx.addAnonymousChild(assign, ctx.consume()); // =
|
|
295
|
+
const right = parseExpression(ctx, 0);
|
|
296
|
+
if (right)
|
|
297
|
+
assign.appendChild(wrapExpression(ctx, right), 'right');
|
|
298
|
+
assign.finalize();
|
|
299
|
+
return { value: assign };
|
|
300
|
+
}
|
|
301
|
+
// Plain expression_with_to (just expression, no with/to)
|
|
302
|
+
const ewt = ctx.startNodeAt('expression_with_to', expr);
|
|
303
|
+
ewt.appendChild(wrapExpression(ctx, expr), 'expression');
|
|
304
|
+
return { value: ewt };
|
|
305
|
+
}
|
|
306
|
+
// ---------------------------------------------------------------------------
|
|
307
|
+
// Internal helpers
|
|
308
|
+
// ---------------------------------------------------------------------------
|
|
309
|
+
/**
|
|
310
|
+
* Compute Levenshtein distance between two strings.
|
|
311
|
+
*/
|
|
312
|
+
function levenshteinDistance(a, b) {
|
|
313
|
+
const m = a.length;
|
|
314
|
+
const n = b.length;
|
|
315
|
+
const dp = Array.from({ length: m + 1 }, () => Array.from({ length: n + 1 }).fill(0));
|
|
316
|
+
for (let i = 0; i <= m; i++)
|
|
317
|
+
dp[i][0] = i;
|
|
318
|
+
for (let j = 0; j <= n; j++)
|
|
319
|
+
dp[0][j] = j;
|
|
320
|
+
for (let i = 1; i <= m; i++) {
|
|
321
|
+
for (let j = 1; j <= n; j++) {
|
|
322
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
323
|
+
dp[i][j] = Math.min(dp[i - 1][j] + 1, dp[i][j - 1] + 1, dp[i - 1][j - 1] + cost);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return dp[m][n];
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Check if a string is a likely misspelling of 'mutable' or 'linked' (Levenshtein ≤ 2).
|
|
330
|
+
*/
|
|
331
|
+
function isFuzzyModifier(text) {
|
|
332
|
+
return (levenshteinDistance(text, 'mutable') <= 2 ||
|
|
333
|
+
levenshteinDistance(text, 'linked') <= 2);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Parse a variable declaration with a misspelled modifier.
|
|
337
|
+
* The misspelled modifier token is wrapped in ERROR, while the rest
|
|
338
|
+
* (type expression + optional default) is parsed normally.
|
|
339
|
+
*/
|
|
340
|
+
function parseFuzzyVariableDeclaration(ctx) {
|
|
341
|
+
const startTok = ctx.peek();
|
|
342
|
+
const node = ctx.startNode('variable_declaration');
|
|
343
|
+
// Consume misspelled modifier and wrap in ERROR
|
|
344
|
+
const misspelled = ctx.consume();
|
|
345
|
+
const misspelledEnd = misspelled.startOffset + misspelled.text.length;
|
|
346
|
+
const leaf = tokenToAutoLeaf(misspelled, ctx.source, misspelled.startOffset);
|
|
347
|
+
const errNode = makeErrorNode(ctx.source, [leaf], misspelled.startOffset, misspelledEnd, misspelled.start, misspelled.end);
|
|
348
|
+
node.appendChild(errNode);
|
|
349
|
+
// type expression
|
|
350
|
+
const typeExpr = parseExpression(ctx, 0);
|
|
351
|
+
if (typeExpr)
|
|
352
|
+
node.appendChild(wrapExpression(ctx, typeExpr), 'type');
|
|
353
|
+
// Optional default: = expr
|
|
354
|
+
if (ctx.peekKind() === TokenKind.EQ) {
|
|
355
|
+
ctx.addAnonymousChild(node, ctx.consume()); // =
|
|
356
|
+
const defaultExpr = parseExpression(ctx, 0);
|
|
357
|
+
if (defaultExpr)
|
|
358
|
+
node.appendChild(wrapExpression(ctx, defaultExpr), 'default');
|
|
359
|
+
}
|
|
360
|
+
ctx.finishNode(node, startTok);
|
|
361
|
+
return node;
|
|
362
|
+
}
|
|
363
|
+
function parseMappingElement(ctx, parseSequence) {
|
|
364
|
+
const startTok = ctx.peek();
|
|
365
|
+
const node = ctx.startNode('mapping_element');
|
|
366
|
+
const key = parseKey(ctx);
|
|
367
|
+
invariant(key != null, 'We must be at a key start');
|
|
368
|
+
node.appendChild(key, 'key');
|
|
369
|
+
// Colon handling
|
|
370
|
+
if (ctx.peekKind() === TokenKind.COLON) {
|
|
371
|
+
// Consume real colon
|
|
372
|
+
ctx.addAnonymousChild(node, ctx.consumeKind(TokenKind.COLON));
|
|
373
|
+
}
|
|
374
|
+
else if (ctx.peekKind() === TokenKind.INDENT ||
|
|
375
|
+
ctx.peekKind() === TokenKind.ARROW ||
|
|
376
|
+
ctx.peekKind() === TokenKind.ID ||
|
|
377
|
+
ctx.peekKind() === TokenKind.AT ||
|
|
378
|
+
ctx.peekKind() === TokenKind.STRING ||
|
|
379
|
+
ctx.peekKind() === TokenKind.NUMBER) {
|
|
380
|
+
// Insert MISSING colon for recovery
|
|
381
|
+
node.appendChild(makeMissing(ctx, ':'));
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
// No colon, no recovery, no value
|
|
385
|
+
return node;
|
|
386
|
+
}
|
|
387
|
+
if (ctx.peekKind() === TokenKind.ARROW) {
|
|
388
|
+
parseArrowBody(ctx, node);
|
|
389
|
+
}
|
|
390
|
+
else if (ctx.peekKind() === TokenKind.INDENT) {
|
|
391
|
+
parseIndentedBlockValue(ctx, node, parseSequence);
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
parseColinearAndBlock(ctx, node, startTok.start.row, parseSequence);
|
|
395
|
+
}
|
|
396
|
+
return node;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Parse optional colinear value, inline comment, error synchronization,
|
|
400
|
+
* and trailing indented block or continuation `to` clause.
|
|
401
|
+
*/
|
|
402
|
+
function parseColinearAndBlock(ctx, node, startRow, parseSequence) {
|
|
403
|
+
const colinear = tryParseColinearValue(ctx);
|
|
404
|
+
if (colinear) {
|
|
405
|
+
if (colinear.errorPrefix)
|
|
406
|
+
node.appendChild(colinear.errorPrefix);
|
|
407
|
+
node.appendChild(colinear.value, 'colinear_value');
|
|
408
|
+
}
|
|
409
|
+
if (ctx.peekKind() === TokenKind.COMMENT) {
|
|
410
|
+
node.appendChild(ctx.consumeNamed('comment'));
|
|
411
|
+
}
|
|
412
|
+
// Absorb trailing junk on same row after colinear value (e.g., a broken
|
|
413
|
+
// `tz` that was meant to be `to`).
|
|
414
|
+
if (colinear) {
|
|
415
|
+
const err = synchronizeRow(ctx, startRow);
|
|
416
|
+
if (err)
|
|
417
|
+
node.appendChild(err);
|
|
418
|
+
}
|
|
419
|
+
else if (!ctx.isAtSyncPoint() && ctx.peekKind() !== TokenKind.INDENT) {
|
|
420
|
+
const err = synchronize(ctx);
|
|
421
|
+
if (err)
|
|
422
|
+
node.appendChild(err);
|
|
423
|
+
}
|
|
424
|
+
// Continuation: indented `to` clause on expression_with_to
|
|
425
|
+
// (e.g., `go: @utils.transition\n to @topic.next`).
|
|
426
|
+
// NOTE: we only absorb `to`, not `with` — an indented `with` is typically
|
|
427
|
+
// a with_statement in a block_value mapping, not a with clause on the expression.
|
|
428
|
+
if (colinear?.value.type === 'expression_with_to' &&
|
|
429
|
+
!colinear.value.childForFieldName('with_to_statement_list') &&
|
|
430
|
+
ctx.peekKind() === TokenKind.INDENT &&
|
|
431
|
+
ctx.peekAt(1).kind === TokenKind.ID &&
|
|
432
|
+
ctx.peekAt(1).text === 'to') {
|
|
433
|
+
ctx.consumeKind(TokenKind.INDENT);
|
|
434
|
+
const withToList = tryParseWithToStatementList(ctx);
|
|
435
|
+
if (withToList) {
|
|
436
|
+
colinear.value.appendChild(withToList, 'with_to_statement_list');
|
|
437
|
+
node.endOffset = colinear.value.endOffset;
|
|
438
|
+
node.endPosition = colinear.value.endPosition;
|
|
439
|
+
}
|
|
440
|
+
ctx.consumeKind(TokenKind.DEDENT);
|
|
441
|
+
}
|
|
442
|
+
else if (ctx.peekKind() === TokenKind.INDENT) {
|
|
443
|
+
parseIndentedBlockValue(ctx, node, parseSequence);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/** Consume `->` and its indented procedure body (shared by normal and missing-colon paths). */
|
|
447
|
+
function parseArrowBody(ctx, node) {
|
|
448
|
+
ctx.addAnonymousChild(node, ctx.consume()); // ->
|
|
449
|
+
// Inline comment after -> (e.g., `instructions: -> # comment`)
|
|
450
|
+
if (ctx.peekKind() === TokenKind.COMMENT) {
|
|
451
|
+
node.appendChild(ctx.consumeNamed('comment'));
|
|
452
|
+
}
|
|
453
|
+
if (ctx.peekKind() === TokenKind.INDENT) {
|
|
454
|
+
ctx.consume(); // INDENT
|
|
455
|
+
// Comments between -> and procedure body attach to mapping_element
|
|
456
|
+
consumeCommentsAndSkipNewlines(ctx, node);
|
|
457
|
+
const proc = parseProcedure(ctx, c => parseTemplate(c));
|
|
458
|
+
if (proc)
|
|
459
|
+
node.appendChild(proc, 'block_value');
|
|
460
|
+
// Trailing comments after procedure attach to mapping_element
|
|
461
|
+
consumeCommentsAndSkipNewlines(ctx, node);
|
|
462
|
+
if (ctx.peekKind() === TokenKind.DEDENT)
|
|
463
|
+
ctx.consume();
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
// Arrow with no indented body → empty procedure with ERROR
|
|
467
|
+
const emptyProc = ctx.startNode('procedure');
|
|
468
|
+
emptyProc.appendChild(makeEmptyError(ctx));
|
|
469
|
+
ctx.finishNode(emptyProc, ctx.peek());
|
|
470
|
+
node.appendChild(emptyProc, 'block_value');
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
function parseVariableDeclaration(ctx) {
|
|
474
|
+
const startTok = ctx.peek();
|
|
475
|
+
const node = ctx.startNode('variable_declaration');
|
|
476
|
+
// mutable or linked
|
|
477
|
+
ctx.addAnonymousChild(node, ctx.consume());
|
|
478
|
+
// Check for duplicate modifier (error case: "mutable linked")
|
|
479
|
+
if (ctx.peekKind() === TokenKind.ID &&
|
|
480
|
+
(ctx.peek().text === 'mutable' || ctx.peek().text === 'linked')) {
|
|
481
|
+
// Wrap the extra modifier in ERROR
|
|
482
|
+
const errExpr = parseExpression(ctx, 0);
|
|
483
|
+
if (errExpr) {
|
|
484
|
+
const wrapped = wrapExpression(ctx, errExpr);
|
|
485
|
+
const errNode = makeErrorNode(ctx.source, [wrapped], wrapped.startOffset, wrapped.endOffset, wrapped.startPosition, wrapped.endPosition);
|
|
486
|
+
node.appendChild(errNode);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
// type expression
|
|
490
|
+
const typeExpr = parseExpression(ctx, 0);
|
|
491
|
+
if (typeExpr)
|
|
492
|
+
node.appendChild(wrapExpression(ctx, typeExpr), 'type');
|
|
493
|
+
// Optional default: = expr
|
|
494
|
+
if (ctx.peekKind() === TokenKind.EQ) {
|
|
495
|
+
ctx.addAnonymousChild(node, ctx.consume()); // =
|
|
496
|
+
const defaultExpr = parseExpression(ctx, 0);
|
|
497
|
+
if (defaultExpr)
|
|
498
|
+
node.appendChild(wrapExpression(ctx, defaultExpr), 'default');
|
|
499
|
+
}
|
|
500
|
+
ctx.finishNode(node, startTok);
|
|
501
|
+
return node;
|
|
502
|
+
}
|
|
503
|
+
// --- Block value ---
|
|
504
|
+
/** Consume INDENT, parse block value with surrounding comments, recover leftovers, consume DEDENT. */
|
|
505
|
+
function parseIndentedBlockValue(ctx, parent, parseSequence) {
|
|
506
|
+
ctx.consume(); // INDENT
|
|
507
|
+
consumeCommentsAndSkipNewlines(ctx, parent);
|
|
508
|
+
const blockValue = parseBlockValue(ctx, parseSequence);
|
|
509
|
+
if (blockValue)
|
|
510
|
+
parent.appendChild(blockValue, 'block_value');
|
|
511
|
+
consumeCommentsAndSkipNewlines(ctx, parent);
|
|
512
|
+
recoverToBlockEnd(ctx, parent);
|
|
513
|
+
if (ctx.peekKind() === TokenKind.DEDENT)
|
|
514
|
+
ctx.consume();
|
|
515
|
+
}
|
|
516
|
+
function parseBlockValue(ctx, parseSequence) {
|
|
517
|
+
const tok = ctx.peek();
|
|
518
|
+
// Sequence
|
|
519
|
+
if (tok.kind === TokenKind.DASH_SPACE) {
|
|
520
|
+
return parseSequence(ctx);
|
|
521
|
+
}
|
|
522
|
+
// Empty keyword
|
|
523
|
+
if (tok.kind === TokenKind.ID && tok.text === 'empty') {
|
|
524
|
+
const emptyNode = ctx.startNode('empty_keyword');
|
|
525
|
+
ctx.addAnonymousChild(emptyNode, ctx.consume());
|
|
526
|
+
ctx.finishNode(emptyNode, tok);
|
|
527
|
+
return emptyNode;
|
|
528
|
+
}
|
|
529
|
+
// Mapping — either key:value or statement-starting content
|
|
530
|
+
// isMappingStart() already checks isStatementStart() internally
|
|
531
|
+
if (isMappingStart(ctx)) {
|
|
532
|
+
return parseMapping(ctx, parseSequence);
|
|
533
|
+
}
|
|
534
|
+
// Atom (standalone value in block position)
|
|
535
|
+
return parseAtomBlockValue(ctx);
|
|
536
|
+
}
|
|
537
|
+
function parseAtomBlockValue(ctx) {
|
|
538
|
+
const expr = parseExpression(ctx, 0);
|
|
539
|
+
if (!expr)
|
|
540
|
+
return null;
|
|
541
|
+
// tree-sitter's block_value rule wraps atom-type children in (atom ...)
|
|
542
|
+
if (ATOM_TYPES.has(expr.type)) {
|
|
543
|
+
const atom = new CSTNode('atom', ctx.source, expr.startOffset, expr.endOffset, expr.startPosition, expr.endPosition);
|
|
544
|
+
atom.appendChild(expr);
|
|
545
|
+
return atom;
|
|
546
|
+
}
|
|
547
|
+
return expr;
|
|
548
|
+
}
|
|
549
|
+
//# sourceMappingURL=parse-mapping.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSTNode } from './cst-node.js';
|
|
2
|
+
import type { ParserContext } from './parser.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parse a YAML-style sequence (list of `- item` entries).
|
|
5
|
+
*
|
|
6
|
+
* Exported for use by parser.ts dispatch and by parse-mapping.ts
|
|
7
|
+
* via ParseSequenceFn callback.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseSequence(ctx: ParserContext): CSTNode;
|
|
10
|
+
//# sourceMappingURL=parse-sequence.d.ts.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
* For full license text, see the LICENSE file in the repo root or https://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Sequence parsing functions extracted from Parser class.
|
|
9
|
+
*
|
|
10
|
+
* Each function takes a ParserContext as its first parameter, following
|
|
11
|
+
* the same free-function pattern as parse-mapping.ts and parse-templates.ts.
|
|
12
|
+
*/
|
|
13
|
+
import { TokenKind } from './token.js';
|
|
14
|
+
import { makeErrorNode } from './errors.js';
|
|
15
|
+
import { synchronize, skipNewlines, isAtEnd } from './recovery.js';
|
|
16
|
+
import { parseMapping, parseMappingItem, tryParseColinearValue, isColinearMappingElement, parseColinearMappingElement, } from './parse-mapping.js';
|
|
17
|
+
/**
|
|
18
|
+
* Parse a YAML-style sequence (list of `- item` entries).
|
|
19
|
+
*
|
|
20
|
+
* Exported for use by parser.ts dispatch and by parse-mapping.ts
|
|
21
|
+
* via ParseSequenceFn callback.
|
|
22
|
+
*/
|
|
23
|
+
export function parseSequence(ctx) {
|
|
24
|
+
const startTok = ctx.peek();
|
|
25
|
+
const node = ctx.startNode('sequence');
|
|
26
|
+
while (ctx.peekKind() === TokenKind.DASH_SPACE) {
|
|
27
|
+
const elem = parseSequenceElement(ctx);
|
|
28
|
+
if (elem)
|
|
29
|
+
node.appendChild(elem);
|
|
30
|
+
skipNewlines(ctx);
|
|
31
|
+
}
|
|
32
|
+
// Non-sequence items remaining at same indent → wrap in ERROR inside sequence
|
|
33
|
+
while (!isAtEnd(ctx) &&
|
|
34
|
+
ctx.peekKind() !== TokenKind.DEDENT &&
|
|
35
|
+
ctx.peekKind() !== TokenKind.DASH_SPACE) {
|
|
36
|
+
skipNewlines(ctx);
|
|
37
|
+
if (isAtEnd(ctx) || ctx.peekKind() === TokenKind.DEDENT)
|
|
38
|
+
break;
|
|
39
|
+
// Try to parse as mapping item and wrap in ERROR
|
|
40
|
+
const parseSeq = (_ctx) => parseSequence(_ctx);
|
|
41
|
+
const item = parseMappingItem(ctx, parseSeq);
|
|
42
|
+
if (item) {
|
|
43
|
+
const errNode = makeErrorNode(ctx.source, [item], item.startOffset, item.endOffset, item.startPosition, item.endPosition);
|
|
44
|
+
node.appendChild(errNode);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const err = synchronize(ctx);
|
|
48
|
+
if (err) {
|
|
49
|
+
node.appendChild(err);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
ctx.consume();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
ctx.finishNode(node, startTok);
|
|
57
|
+
return node;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Parse a single sequence element: `- <value>`.
|
|
61
|
+
*/
|
|
62
|
+
function parseSequenceElement(ctx) {
|
|
63
|
+
const startTok = ctx.peek();
|
|
64
|
+
const node = ctx.startNode('sequence_element');
|
|
65
|
+
// Consume "- " or "-"
|
|
66
|
+
ctx.addAnonymousChild(node, ctx.consume());
|
|
67
|
+
const parseSeq = (_ctx) => parseSequence(_ctx);
|
|
68
|
+
// Check for colinear mapping element (key: value on same line)
|
|
69
|
+
if (isColinearMappingElement(ctx)) {
|
|
70
|
+
const mappingElem = parseColinearMappingElement(ctx);
|
|
71
|
+
if (mappingElem)
|
|
72
|
+
node.appendChild(mappingElem, 'colinear_mapping_element');
|
|
73
|
+
// Optional block value (indented mapping below)
|
|
74
|
+
if (ctx.peekKind() === TokenKind.NEWLINE)
|
|
75
|
+
ctx.consume();
|
|
76
|
+
if (ctx.peekKind() === TokenKind.INDENT) {
|
|
77
|
+
ctx.consume();
|
|
78
|
+
const blockValue = parseMapping(ctx, parseSeq);
|
|
79
|
+
if (blockValue)
|
|
80
|
+
node.appendChild(blockValue, 'block_value');
|
|
81
|
+
if (ctx.peekKind() === TokenKind.DEDENT)
|
|
82
|
+
ctx.consume();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else if (ctx.peekKind() === TokenKind.NEWLINE ||
|
|
86
|
+
ctx.peekKind() === TokenKind.EOF ||
|
|
87
|
+
ctx.peekKind() === TokenKind.INDENT) {
|
|
88
|
+
// Bare dash with optional block value below (or immediately indented)
|
|
89
|
+
if (ctx.peekKind() === TokenKind.NEWLINE)
|
|
90
|
+
ctx.consume();
|
|
91
|
+
if (ctx.peekKind() === TokenKind.INDENT) {
|
|
92
|
+
ctx.consume();
|
|
93
|
+
const blockValue = parseMapping(ctx, parseSeq);
|
|
94
|
+
if (blockValue)
|
|
95
|
+
node.appendChild(blockValue, 'block_value');
|
|
96
|
+
if (ctx.peekKind() === TokenKind.DEDENT)
|
|
97
|
+
ctx.consume();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// Colinear value
|
|
102
|
+
const colinear = tryParseColinearValue(ctx);
|
|
103
|
+
if (colinear) {
|
|
104
|
+
if (colinear.errorPrefix)
|
|
105
|
+
node.appendChild(colinear.errorPrefix);
|
|
106
|
+
node.appendChild(colinear.value, 'colinear_value');
|
|
107
|
+
}
|
|
108
|
+
// Inline comment after value
|
|
109
|
+
if (ctx.peekKind() === TokenKind.COMMENT) {
|
|
110
|
+
node.appendChild(ctx.consumeNamed('comment'));
|
|
111
|
+
}
|
|
112
|
+
if (ctx.peekKind() === TokenKind.NEWLINE)
|
|
113
|
+
ctx.consume();
|
|
114
|
+
}
|
|
115
|
+
ctx.finishNode(node, startTok);
|
|
116
|
+
return node;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=parse-sequence.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CSTNode } from './cst-node.js';
|
|
2
|
+
import type { ParserContext } from './parser.js';
|
|
3
|
+
export declare function isStatementStart(ctx: ParserContext): boolean;
|
|
4
|
+
export declare function parseProcedure(ctx: ParserContext, parseTemplate?: (ctx: ParserContext) => CSTNode): CSTNode;
|
|
5
|
+
export declare function parseStatement(ctx: ParserContext, parseTemplate?: (ctx: ParserContext) => CSTNode): CSTNode | null;
|
|
6
|
+
export declare function parseIfStatement(ctx: ParserContext, parseTemplate?: (ctx: ParserContext) => CSTNode): CSTNode;
|
|
7
|
+
export declare function parseRunStatement(ctx: ParserContext, parseTemplate?: (ctx: ParserContext) => CSTNode): CSTNode;
|
|
8
|
+
export declare function parseSetStatement(ctx: ParserContext): CSTNode;
|
|
9
|
+
export declare function parseTransitionStatement(ctx: ParserContext): CSTNode;
|
|
10
|
+
export declare function parseWithStatement(ctx: ParserContext): CSTNode;
|
|
11
|
+
export declare function parseAvailableWhenStatement(ctx: ParserContext): CSTNode;
|
|
12
|
+
export declare function tryParseWithToStatementList(ctx: ParserContext): CSTNode | null;
|
|
13
|
+
export declare function parseInlineWithStatement(ctx: ParserContext): CSTNode;
|
|
14
|
+
export declare function parseToStatement(ctx: ParserContext): CSTNode;
|
|
15
|
+
//# sourceMappingURL=parse-statements.d.ts.map
|