webpipe-js 2.0.71 → 2.0.81
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 +53 -23
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.mjs +53 -23
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -299,6 +299,32 @@ var Parser = class {
|
|
|
299
299
|
skipWhitespaceOnly() {
|
|
300
300
|
this.consumeWhile((ch) => ch === " " || ch === " " || ch === "\r" || ch === "\n");
|
|
301
301
|
}
|
|
302
|
+
skipStandaloneCommentsBeforeKeywords(keywords) {
|
|
303
|
+
while (true) {
|
|
304
|
+
this.skipWhitespaceOnly();
|
|
305
|
+
const commentStart = this.pos;
|
|
306
|
+
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
307
|
+
if (!comment) {
|
|
308
|
+
this.pos = commentStart;
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const afterComment = this.pos;
|
|
312
|
+
if (this.cur() === "\n") this.pos++;
|
|
313
|
+
while (true) {
|
|
314
|
+
this.skipWhitespaceOnly();
|
|
315
|
+
const nestedComment = this.tryParse(() => this.parseStandaloneComment());
|
|
316
|
+
if (!nestedComment) break;
|
|
317
|
+
if (this.cur() === "\n") this.pos++;
|
|
318
|
+
}
|
|
319
|
+
const followedByKeyword = keywords.some((keyword) => this.text.startsWith(keyword, this.pos));
|
|
320
|
+
this.pos = afterComment;
|
|
321
|
+
if (!followedByKeyword) {
|
|
322
|
+
this.pos = commentStart;
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
if (this.cur() === "\n") this.pos++;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
302
328
|
skipInlineSpaces() {
|
|
303
329
|
this.consumeWhile((ch) => ch === " " || ch === " " || ch === "\r");
|
|
304
330
|
}
|
|
@@ -563,7 +589,9 @@ var Parser = class {
|
|
|
563
589
|
const nameStart = this.pos;
|
|
564
590
|
const name = this.parseIdentifier();
|
|
565
591
|
const nameEnd = this.pos;
|
|
566
|
-
const
|
|
592
|
+
const inlineArgs = this.parseInlineArgs();
|
|
593
|
+
const args = inlineArgs.args;
|
|
594
|
+
const argSpans = inlineArgs.argSpans;
|
|
567
595
|
this.skipInlineSpaces();
|
|
568
596
|
let config = "";
|
|
569
597
|
let configType = "quoted";
|
|
@@ -584,7 +612,7 @@ var Parser = class {
|
|
|
584
612
|
const parsedJoinTargets = name === "join" ? this.parseJoinTaskNames(config) : void 0;
|
|
585
613
|
this.skipWhitespaceOnly();
|
|
586
614
|
const end = this.pos;
|
|
587
|
-
return { kind: "Regular", name, nameStart, nameEnd, args, config, configType, hasConfig, configStart, configEnd, condition, parsedJoinTargets, start, end };
|
|
615
|
+
return { kind: "Regular", name, nameStart, nameEnd, args, argSpans, config, configType, hasConfig, configStart, configEnd, condition, parsedJoinTargets, start, end };
|
|
588
616
|
}
|
|
589
617
|
/**
|
|
590
618
|
* Parse optional step condition (tag expression after the config)
|
|
@@ -642,58 +670,58 @@ var Parser = class {
|
|
|
642
670
|
* Split argument content by commas while respecting nesting depth and strings
|
|
643
671
|
* Example: `"url", {a:1, b:2}` -> [`"url"`, `{a:1, b:2}`]
|
|
644
672
|
*/
|
|
645
|
-
splitBalancedArgs(content) {
|
|
673
|
+
splitBalancedArgs(content, baseOffset) {
|
|
646
674
|
const args = [];
|
|
647
|
-
|
|
675
|
+
const argSpans = [];
|
|
676
|
+
let segmentStart = 0;
|
|
648
677
|
let depth = 0;
|
|
649
678
|
let inString = false;
|
|
650
679
|
let stringChar = "";
|
|
651
680
|
let escapeNext = false;
|
|
681
|
+
const pushArg = (segmentEnd) => {
|
|
682
|
+
let start = segmentStart;
|
|
683
|
+
let end = segmentEnd;
|
|
684
|
+
while (start < end && /\s/.test(content[start])) start++;
|
|
685
|
+
while (end > start && /\s/.test(content[end - 1])) end--;
|
|
686
|
+
if (start < end) {
|
|
687
|
+
args.push(content.slice(start, end));
|
|
688
|
+
argSpans.push({ start: baseOffset + start, end: baseOffset + end });
|
|
689
|
+
}
|
|
690
|
+
};
|
|
652
691
|
for (let i = 0; i < content.length; i++) {
|
|
653
692
|
const ch = content[i];
|
|
654
693
|
if (escapeNext) {
|
|
655
|
-
current += ch;
|
|
656
694
|
escapeNext = false;
|
|
657
695
|
continue;
|
|
658
696
|
}
|
|
659
697
|
if (ch === "\\" && inString) {
|
|
660
|
-
current += ch;
|
|
661
698
|
escapeNext = true;
|
|
662
699
|
continue;
|
|
663
700
|
}
|
|
664
|
-
if ((ch === '"' || ch === "`") && !inString) {
|
|
701
|
+
if ((ch === '"' || ch === "'" || ch === "`") && !inString) {
|
|
665
702
|
inString = true;
|
|
666
703
|
stringChar = ch;
|
|
667
|
-
current += ch;
|
|
668
704
|
continue;
|
|
669
705
|
}
|
|
670
706
|
if (ch === stringChar && inString) {
|
|
671
707
|
inString = false;
|
|
672
708
|
stringChar = "";
|
|
673
|
-
current += ch;
|
|
674
709
|
continue;
|
|
675
710
|
}
|
|
676
711
|
if (inString) {
|
|
677
|
-
current += ch;
|
|
678
712
|
continue;
|
|
679
713
|
}
|
|
680
714
|
if (ch === "(" || ch === "[" || ch === "{") {
|
|
681
715
|
depth++;
|
|
682
|
-
current += ch;
|
|
683
716
|
} else if (ch === ")" || ch === "]" || ch === "}") {
|
|
684
717
|
depth--;
|
|
685
|
-
current += ch;
|
|
686
718
|
} else if (ch === "," && depth === 0) {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
} else {
|
|
690
|
-
current += ch;
|
|
719
|
+
pushArg(i);
|
|
720
|
+
segmentStart = i + 1;
|
|
691
721
|
}
|
|
692
722
|
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}
|
|
696
|
-
return args;
|
|
723
|
+
pushArg(content.length);
|
|
724
|
+
return { args, argSpans };
|
|
697
725
|
}
|
|
698
726
|
/**
|
|
699
727
|
* Parse inline arguments: middleware(arg1, arg2) or middleware[arg1, arg2]
|
|
@@ -705,7 +733,7 @@ var Parser = class {
|
|
|
705
733
|
const ch = this.cur();
|
|
706
734
|
if (ch !== "(" && ch !== "[") {
|
|
707
735
|
this.pos = trimmedStart;
|
|
708
|
-
return [];
|
|
736
|
+
return { args: [], argSpans: [] };
|
|
709
737
|
}
|
|
710
738
|
const openChar = ch;
|
|
711
739
|
const closeChar = openChar === "(" ? ")" : "]";
|
|
@@ -757,9 +785,9 @@ var Parser = class {
|
|
|
757
785
|
const argsContent = this.text.slice(contentStart, this.pos);
|
|
758
786
|
this.pos++;
|
|
759
787
|
if (argsContent.trim().length === 0) {
|
|
760
|
-
return [];
|
|
788
|
+
return { args: [], argSpans: [] };
|
|
761
789
|
}
|
|
762
|
-
return this.splitBalancedArgs(argsContent);
|
|
790
|
+
return this.splitBalancedArgs(argsContent, contentStart);
|
|
763
791
|
}
|
|
764
792
|
parseResultStep() {
|
|
765
793
|
this.skipWhitespaceOnly();
|
|
@@ -837,11 +865,13 @@ var Parser = class {
|
|
|
837
865
|
this.skipWhitespaceOnly();
|
|
838
866
|
const branches = [];
|
|
839
867
|
while (true) {
|
|
868
|
+
this.skipStandaloneCommentsBeforeKeywords(["case", "default:", "end"]);
|
|
840
869
|
const branch = this.tryParse(() => this.parseDispatchBranch());
|
|
841
870
|
if (!branch) break;
|
|
842
871
|
branches.push(branch);
|
|
843
872
|
this.skipWhitespaceOnly();
|
|
844
873
|
}
|
|
874
|
+
this.skipStandaloneCommentsBeforeKeywords(["default:", "end"]);
|
|
845
875
|
const defaultBranch = this.tryParse(() => {
|
|
846
876
|
this.expect("default:");
|
|
847
877
|
this.skipWhitespaceOnly();
|
package/dist/index.d.cts
CHANGED
|
@@ -129,6 +129,10 @@ interface Pipeline {
|
|
|
129
129
|
end: number;
|
|
130
130
|
}
|
|
131
131
|
type ConfigType = 'backtick' | 'quoted' | 'identifier';
|
|
132
|
+
interface SourceSpan {
|
|
133
|
+
start: number;
|
|
134
|
+
end: number;
|
|
135
|
+
}
|
|
132
136
|
type LetValueFormat = 'quoted' | 'backtick' | 'bare';
|
|
133
137
|
interface LetVariable {
|
|
134
138
|
name: string;
|
|
@@ -166,6 +170,7 @@ type PipelineStep = {
|
|
|
166
170
|
nameStart: number;
|
|
167
171
|
nameEnd: number;
|
|
168
172
|
args: string[];
|
|
173
|
+
argSpans: SourceSpan[];
|
|
169
174
|
config: string;
|
|
170
175
|
configType: ConfigType;
|
|
171
176
|
hasConfig: boolean;
|
|
@@ -357,4 +362,4 @@ declare function formatTagExpr(expr: TagExpr): string;
|
|
|
357
362
|
declare function formatPipelineRef(ref: PipelineRef): string[];
|
|
358
363
|
declare function formatWhen(when: When): string;
|
|
359
364
|
|
|
360
|
-
export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type DomAssertType, type GraphQLSchema, type Import, type It, type LetValueFormat, type LetVariable, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type Tag, type TagExpr, type TestLetVariable, type TypeResolver, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTagExpr, formatTags, formatWhen, getPipelineRanges, getTestLetVariableRanges, getTestLetVariables, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printFeatureFlags, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printTypeResolver, printVariable };
|
|
365
|
+
export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type DomAssertType, type GraphQLSchema, type Import, type It, type LetValueFormat, type LetVariable, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type SourceSpan, type Tag, type TagExpr, type TestLetVariable, type TypeResolver, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTagExpr, formatTags, formatWhen, getPipelineRanges, getTestLetVariableRanges, getTestLetVariables, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printFeatureFlags, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printTypeResolver, printVariable };
|
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,10 @@ interface Pipeline {
|
|
|
129
129
|
end: number;
|
|
130
130
|
}
|
|
131
131
|
type ConfigType = 'backtick' | 'quoted' | 'identifier';
|
|
132
|
+
interface SourceSpan {
|
|
133
|
+
start: number;
|
|
134
|
+
end: number;
|
|
135
|
+
}
|
|
132
136
|
type LetValueFormat = 'quoted' | 'backtick' | 'bare';
|
|
133
137
|
interface LetVariable {
|
|
134
138
|
name: string;
|
|
@@ -166,6 +170,7 @@ type PipelineStep = {
|
|
|
166
170
|
nameStart: number;
|
|
167
171
|
nameEnd: number;
|
|
168
172
|
args: string[];
|
|
173
|
+
argSpans: SourceSpan[];
|
|
169
174
|
config: string;
|
|
170
175
|
configType: ConfigType;
|
|
171
176
|
hasConfig: boolean;
|
|
@@ -357,4 +362,4 @@ declare function formatTagExpr(expr: TagExpr): string;
|
|
|
357
362
|
declare function formatPipelineRef(ref: PipelineRef): string[];
|
|
358
363
|
declare function formatWhen(when: When): string;
|
|
359
364
|
|
|
360
|
-
export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type DomAssertType, type GraphQLSchema, type Import, type It, type LetValueFormat, type LetVariable, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type Tag, type TagExpr, type TestLetVariable, type TypeResolver, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTagExpr, formatTags, formatWhen, getPipelineRanges, getTestLetVariableRanges, getTestLetVariables, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printFeatureFlags, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printTypeResolver, printVariable };
|
|
365
|
+
export { type Comment, type Condition, type Config, type ConfigProperty, type ConfigType, type ConfigValue, type Describe, type DiagnosticSeverity, type DispatchBranch, type DomAssertType, type GraphQLSchema, type Import, type It, type LetValueFormat, type LetVariable, type Mock, type MutationResolver, type NamedPipeline, type ParseDiagnostic, type Pipeline, type PipelineRef, type PipelineStep, type Program, type QueryResolver, type ResultBranch, type ResultBranchType, type Route, type SourceSpan, type Tag, type TagExpr, type TestLetVariable, type TypeResolver, type Variable, type When, formatConfigValue, formatPipelineRef, formatPipelineStep, formatStepConfig, formatTag, formatTagExpr, formatTags, formatWhen, getPipelineRanges, getTestLetVariableRanges, getTestLetVariables, getVariableRanges, parseProgram, parseProgramWithDiagnostics, prettyPrint, printComment, printCondition, printConfig, printDescribe, printFeatureFlags, printGraphQLSchema, printMock, printMutationResolver, printPipeline, printQueryResolver, printRoute, printTest, printTypeResolver, printVariable };
|
package/dist/index.mjs
CHANGED
|
@@ -245,6 +245,32 @@ var Parser = class {
|
|
|
245
245
|
skipWhitespaceOnly() {
|
|
246
246
|
this.consumeWhile((ch) => ch === " " || ch === " " || ch === "\r" || ch === "\n");
|
|
247
247
|
}
|
|
248
|
+
skipStandaloneCommentsBeforeKeywords(keywords) {
|
|
249
|
+
while (true) {
|
|
250
|
+
this.skipWhitespaceOnly();
|
|
251
|
+
const commentStart = this.pos;
|
|
252
|
+
const comment = this.tryParse(() => this.parseStandaloneComment());
|
|
253
|
+
if (!comment) {
|
|
254
|
+
this.pos = commentStart;
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const afterComment = this.pos;
|
|
258
|
+
if (this.cur() === "\n") this.pos++;
|
|
259
|
+
while (true) {
|
|
260
|
+
this.skipWhitespaceOnly();
|
|
261
|
+
const nestedComment = this.tryParse(() => this.parseStandaloneComment());
|
|
262
|
+
if (!nestedComment) break;
|
|
263
|
+
if (this.cur() === "\n") this.pos++;
|
|
264
|
+
}
|
|
265
|
+
const followedByKeyword = keywords.some((keyword) => this.text.startsWith(keyword, this.pos));
|
|
266
|
+
this.pos = afterComment;
|
|
267
|
+
if (!followedByKeyword) {
|
|
268
|
+
this.pos = commentStart;
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (this.cur() === "\n") this.pos++;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
248
274
|
skipInlineSpaces() {
|
|
249
275
|
this.consumeWhile((ch) => ch === " " || ch === " " || ch === "\r");
|
|
250
276
|
}
|
|
@@ -509,7 +535,9 @@ var Parser = class {
|
|
|
509
535
|
const nameStart = this.pos;
|
|
510
536
|
const name = this.parseIdentifier();
|
|
511
537
|
const nameEnd = this.pos;
|
|
512
|
-
const
|
|
538
|
+
const inlineArgs = this.parseInlineArgs();
|
|
539
|
+
const args = inlineArgs.args;
|
|
540
|
+
const argSpans = inlineArgs.argSpans;
|
|
513
541
|
this.skipInlineSpaces();
|
|
514
542
|
let config = "";
|
|
515
543
|
let configType = "quoted";
|
|
@@ -530,7 +558,7 @@ var Parser = class {
|
|
|
530
558
|
const parsedJoinTargets = name === "join" ? this.parseJoinTaskNames(config) : void 0;
|
|
531
559
|
this.skipWhitespaceOnly();
|
|
532
560
|
const end = this.pos;
|
|
533
|
-
return { kind: "Regular", name, nameStart, nameEnd, args, config, configType, hasConfig, configStart, configEnd, condition, parsedJoinTargets, start, end };
|
|
561
|
+
return { kind: "Regular", name, nameStart, nameEnd, args, argSpans, config, configType, hasConfig, configStart, configEnd, condition, parsedJoinTargets, start, end };
|
|
534
562
|
}
|
|
535
563
|
/**
|
|
536
564
|
* Parse optional step condition (tag expression after the config)
|
|
@@ -588,58 +616,58 @@ var Parser = class {
|
|
|
588
616
|
* Split argument content by commas while respecting nesting depth and strings
|
|
589
617
|
* Example: `"url", {a:1, b:2}` -> [`"url"`, `{a:1, b:2}`]
|
|
590
618
|
*/
|
|
591
|
-
splitBalancedArgs(content) {
|
|
619
|
+
splitBalancedArgs(content, baseOffset) {
|
|
592
620
|
const args = [];
|
|
593
|
-
|
|
621
|
+
const argSpans = [];
|
|
622
|
+
let segmentStart = 0;
|
|
594
623
|
let depth = 0;
|
|
595
624
|
let inString = false;
|
|
596
625
|
let stringChar = "";
|
|
597
626
|
let escapeNext = false;
|
|
627
|
+
const pushArg = (segmentEnd) => {
|
|
628
|
+
let start = segmentStart;
|
|
629
|
+
let end = segmentEnd;
|
|
630
|
+
while (start < end && /\s/.test(content[start])) start++;
|
|
631
|
+
while (end > start && /\s/.test(content[end - 1])) end--;
|
|
632
|
+
if (start < end) {
|
|
633
|
+
args.push(content.slice(start, end));
|
|
634
|
+
argSpans.push({ start: baseOffset + start, end: baseOffset + end });
|
|
635
|
+
}
|
|
636
|
+
};
|
|
598
637
|
for (let i = 0; i < content.length; i++) {
|
|
599
638
|
const ch = content[i];
|
|
600
639
|
if (escapeNext) {
|
|
601
|
-
current += ch;
|
|
602
640
|
escapeNext = false;
|
|
603
641
|
continue;
|
|
604
642
|
}
|
|
605
643
|
if (ch === "\\" && inString) {
|
|
606
|
-
current += ch;
|
|
607
644
|
escapeNext = true;
|
|
608
645
|
continue;
|
|
609
646
|
}
|
|
610
|
-
if ((ch === '"' || ch === "`") && !inString) {
|
|
647
|
+
if ((ch === '"' || ch === "'" || ch === "`") && !inString) {
|
|
611
648
|
inString = true;
|
|
612
649
|
stringChar = ch;
|
|
613
|
-
current += ch;
|
|
614
650
|
continue;
|
|
615
651
|
}
|
|
616
652
|
if (ch === stringChar && inString) {
|
|
617
653
|
inString = false;
|
|
618
654
|
stringChar = "";
|
|
619
|
-
current += ch;
|
|
620
655
|
continue;
|
|
621
656
|
}
|
|
622
657
|
if (inString) {
|
|
623
|
-
current += ch;
|
|
624
658
|
continue;
|
|
625
659
|
}
|
|
626
660
|
if (ch === "(" || ch === "[" || ch === "{") {
|
|
627
661
|
depth++;
|
|
628
|
-
current += ch;
|
|
629
662
|
} else if (ch === ")" || ch === "]" || ch === "}") {
|
|
630
663
|
depth--;
|
|
631
|
-
current += ch;
|
|
632
664
|
} else if (ch === "," && depth === 0) {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
} else {
|
|
636
|
-
current += ch;
|
|
665
|
+
pushArg(i);
|
|
666
|
+
segmentStart = i + 1;
|
|
637
667
|
}
|
|
638
668
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
642
|
-
return args;
|
|
669
|
+
pushArg(content.length);
|
|
670
|
+
return { args, argSpans };
|
|
643
671
|
}
|
|
644
672
|
/**
|
|
645
673
|
* Parse inline arguments: middleware(arg1, arg2) or middleware[arg1, arg2]
|
|
@@ -651,7 +679,7 @@ var Parser = class {
|
|
|
651
679
|
const ch = this.cur();
|
|
652
680
|
if (ch !== "(" && ch !== "[") {
|
|
653
681
|
this.pos = trimmedStart;
|
|
654
|
-
return [];
|
|
682
|
+
return { args: [], argSpans: [] };
|
|
655
683
|
}
|
|
656
684
|
const openChar = ch;
|
|
657
685
|
const closeChar = openChar === "(" ? ")" : "]";
|
|
@@ -703,9 +731,9 @@ var Parser = class {
|
|
|
703
731
|
const argsContent = this.text.slice(contentStart, this.pos);
|
|
704
732
|
this.pos++;
|
|
705
733
|
if (argsContent.trim().length === 0) {
|
|
706
|
-
return [];
|
|
734
|
+
return { args: [], argSpans: [] };
|
|
707
735
|
}
|
|
708
|
-
return this.splitBalancedArgs(argsContent);
|
|
736
|
+
return this.splitBalancedArgs(argsContent, contentStart);
|
|
709
737
|
}
|
|
710
738
|
parseResultStep() {
|
|
711
739
|
this.skipWhitespaceOnly();
|
|
@@ -783,11 +811,13 @@ var Parser = class {
|
|
|
783
811
|
this.skipWhitespaceOnly();
|
|
784
812
|
const branches = [];
|
|
785
813
|
while (true) {
|
|
814
|
+
this.skipStandaloneCommentsBeforeKeywords(["case", "default:", "end"]);
|
|
786
815
|
const branch = this.tryParse(() => this.parseDispatchBranch());
|
|
787
816
|
if (!branch) break;
|
|
788
817
|
branches.push(branch);
|
|
789
818
|
this.skipWhitespaceOnly();
|
|
790
819
|
}
|
|
820
|
+
this.skipStandaloneCommentsBeforeKeywords(["default:", "end"]);
|
|
791
821
|
const defaultBranch = this.tryParse(() => {
|
|
792
822
|
this.expect("default:");
|
|
793
823
|
this.skipWhitespaceOnly();
|