webpipe-js 2.0.4 → 2.0.6
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 +15 -8
- package/dist/index.mjs +15 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -520,23 +520,30 @@ var Parser = class {
|
|
|
520
520
|
this.skipSpaces();
|
|
521
521
|
this.expect("then:");
|
|
522
522
|
this.skipSpaces();
|
|
523
|
-
const thenBranch = this.parseIfPipeline("else:");
|
|
523
|
+
const thenBranch = this.parseIfPipeline("else:", "end");
|
|
524
524
|
this.skipSpaces();
|
|
525
525
|
const elseBranch = this.tryParse(() => {
|
|
526
526
|
this.expect("else:");
|
|
527
527
|
this.skipSpaces();
|
|
528
|
-
return this.
|
|
528
|
+
return this.parseIfPipeline("end");
|
|
529
|
+
});
|
|
530
|
+
this.skipSpaces();
|
|
531
|
+
this.tryParse(() => {
|
|
532
|
+
this.expect("end");
|
|
533
|
+
return true;
|
|
529
534
|
});
|
|
530
535
|
return { kind: "If", condition, thenBranch, elseBranch: elseBranch || void 0 };
|
|
531
536
|
}
|
|
532
|
-
parseIfPipeline(
|
|
537
|
+
parseIfPipeline(...stopKeywords) {
|
|
533
538
|
const steps = [];
|
|
534
539
|
while (true) {
|
|
535
540
|
const save = this.pos;
|
|
536
|
-
this.
|
|
537
|
-
|
|
538
|
-
this.pos
|
|
539
|
-
|
|
541
|
+
this.skipSpaces();
|
|
542
|
+
for (const keyword of stopKeywords) {
|
|
543
|
+
if (this.text.startsWith(keyword, this.pos)) {
|
|
544
|
+
this.pos = save;
|
|
545
|
+
return { steps };
|
|
546
|
+
}
|
|
540
547
|
}
|
|
541
548
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
542
549
|
this.pos = save;
|
|
@@ -551,7 +558,7 @@ var Parser = class {
|
|
|
551
558
|
const steps = [];
|
|
552
559
|
while (true) {
|
|
553
560
|
const save = this.pos;
|
|
554
|
-
this.
|
|
561
|
+
this.skipSpaces();
|
|
555
562
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
556
563
|
this.pos = save;
|
|
557
564
|
break;
|
package/dist/index.mjs
CHANGED
|
@@ -471,23 +471,30 @@ var Parser = class {
|
|
|
471
471
|
this.skipSpaces();
|
|
472
472
|
this.expect("then:");
|
|
473
473
|
this.skipSpaces();
|
|
474
|
-
const thenBranch = this.parseIfPipeline("else:");
|
|
474
|
+
const thenBranch = this.parseIfPipeline("else:", "end");
|
|
475
475
|
this.skipSpaces();
|
|
476
476
|
const elseBranch = this.tryParse(() => {
|
|
477
477
|
this.expect("else:");
|
|
478
478
|
this.skipSpaces();
|
|
479
|
-
return this.
|
|
479
|
+
return this.parseIfPipeline("end");
|
|
480
|
+
});
|
|
481
|
+
this.skipSpaces();
|
|
482
|
+
this.tryParse(() => {
|
|
483
|
+
this.expect("end");
|
|
484
|
+
return true;
|
|
480
485
|
});
|
|
481
486
|
return { kind: "If", condition, thenBranch, elseBranch: elseBranch || void 0 };
|
|
482
487
|
}
|
|
483
|
-
parseIfPipeline(
|
|
488
|
+
parseIfPipeline(...stopKeywords) {
|
|
484
489
|
const steps = [];
|
|
485
490
|
while (true) {
|
|
486
491
|
const save = this.pos;
|
|
487
|
-
this.
|
|
488
|
-
|
|
489
|
-
this.pos
|
|
490
|
-
|
|
492
|
+
this.skipSpaces();
|
|
493
|
+
for (const keyword of stopKeywords) {
|
|
494
|
+
if (this.text.startsWith(keyword, this.pos)) {
|
|
495
|
+
this.pos = save;
|
|
496
|
+
return { steps };
|
|
497
|
+
}
|
|
491
498
|
}
|
|
492
499
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
493
500
|
this.pos = save;
|
|
@@ -502,7 +509,7 @@ var Parser = class {
|
|
|
502
509
|
const steps = [];
|
|
503
510
|
while (true) {
|
|
504
511
|
const save = this.pos;
|
|
505
|
-
this.
|
|
512
|
+
this.skipSpaces();
|
|
506
513
|
if (!this.text.startsWith("|>", this.pos)) {
|
|
507
514
|
this.pos = save;
|
|
508
515
|
break;
|