links-notation 0.21.1 → 0.21.3
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.js +439 -225
- package/package.json +1 -1
- package/src/StreamParser.js +3 -2
- package/src/comments.js +6 -70
- package/src/grammar.pegjs +54 -76
- package/src/parser-generated.js +304 -186
- package/src/quotes.js +251 -0
- package/tests/Issue316QuoteRuns.test.js +163 -0
- package/tests/NestingDepth.test.js +124 -0
- package/tests/support/nestingDepthWorker.js +15 -0
package/src/parser-generated.js
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
// https://peggyjs.org/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
import { DelimitedReferences } from './quotes.js';
|
|
8
|
+
|
|
6
9
|
class peg$SyntaxError extends SyntaxError {
|
|
7
10
|
constructor(message, expected, found, location) {
|
|
8
11
|
super(message);
|
|
@@ -179,11 +182,11 @@ function peg$parse(input, options) {
|
|
|
179
182
|
|
|
180
183
|
const peg$e0 = peg$classExpectation([" ", "\t"], false, false, false);
|
|
181
184
|
const peg$e1 = peg$classExpectation(["\r", "\n"], false, false, false);
|
|
182
|
-
const peg$e2 = peg$
|
|
183
|
-
const peg$e3 = peg$literalExpectation("
|
|
184
|
-
const peg$e4 = peg$literalExpectation("
|
|
185
|
-
const peg$e5 = peg$literalExpectation("
|
|
186
|
-
const peg$e6 = peg$
|
|
185
|
+
const peg$e2 = peg$anyExpectation();
|
|
186
|
+
const peg$e3 = peg$literalExpectation("(", false);
|
|
187
|
+
const peg$e4 = peg$literalExpectation(")", false);
|
|
188
|
+
const peg$e5 = peg$literalExpectation(":", false);
|
|
189
|
+
const peg$e6 = peg$literalExpectation("\"", false);
|
|
187
190
|
const peg$e7 = peg$literalExpectation("'", false);
|
|
188
191
|
const peg$e8 = peg$literalExpectation("`", false);
|
|
189
192
|
const peg$e9 = peg$literalExpectation(" ", false);
|
|
@@ -197,31 +200,40 @@ function peg$parse(input, options) {
|
|
|
197
200
|
function peg$f4(fl, list) { popIndentation(); return [fl].concat(list || []); }
|
|
198
201
|
function peg$f5(l) { return l; }
|
|
199
202
|
function peg$f6(l) { return l; }
|
|
200
|
-
function peg$f7(
|
|
203
|
+
function peg$f7() { return !unreadableLines.has(lineKey(offset())); }
|
|
204
|
+
function peg$f8(e, saved, l) {
|
|
205
|
+
if (l === null) {
|
|
206
|
+
// No child line followed the indentation. Forget what looking for one
|
|
207
|
+
// pushed, so the next line is compared with this line's indentation.
|
|
208
|
+
indentationStack = saved;
|
|
209
|
+
return e;
|
|
210
|
+
}
|
|
201
211
|
return Object.assign({}, e, { children: l });
|
|
202
212
|
}
|
|
203
|
-
function peg$
|
|
204
|
-
function peg$
|
|
205
|
-
function peg$
|
|
206
|
-
function peg$
|
|
207
|
-
|
|
208
|
-
|
|
213
|
+
function peg$f9() { unreadableLines.add(lineKey(offset())); return false; }
|
|
214
|
+
function peg$f10(l) { return l; }
|
|
215
|
+
function peg$f11(i) { return { id: i }; }
|
|
216
|
+
function peg$f12(g, rest) {
|
|
217
|
+
return rest === null ? g : { values: [g].concat(rest) };
|
|
218
|
+
}
|
|
219
|
+
function peg$f13() { return null; }
|
|
209
220
|
function peg$f14(fl) { return fl; }
|
|
210
221
|
function peg$f15(vl) { return vl; }
|
|
211
222
|
function peg$f16(body) {
|
|
212
223
|
exitNestedContext();
|
|
213
224
|
return body;
|
|
214
225
|
}
|
|
215
|
-
function peg$f17(
|
|
216
|
-
function peg$f18() { return { nested:
|
|
217
|
-
function peg$f19() { return
|
|
218
|
-
function peg$f20(
|
|
219
|
-
function peg$f21(
|
|
220
|
-
function peg$f22(
|
|
221
|
-
function peg$f23(v) { return { values: v }; }
|
|
222
|
-
function peg$f24(
|
|
223
|
-
function peg$f25(
|
|
224
|
-
function peg$f26() {
|
|
226
|
+
function peg$f17() { exitNestedContext(); return false; }
|
|
227
|
+
function peg$f18(l) { return { nested: l }; }
|
|
228
|
+
function peg$f19() { return { nested: [] }; }
|
|
229
|
+
function peg$f20() { return enterNestedContext(); }
|
|
230
|
+
function peg$f21(value) { return value; }
|
|
231
|
+
function peg$f22(list) { return list; }
|
|
232
|
+
function peg$f23(id, v) { return { id: id, values: v }; }
|
|
233
|
+
function peg$f24(v) { return { values: v }; }
|
|
234
|
+
function peg$f25(id) { return { id: id, values: [] }; }
|
|
235
|
+
function peg$f26(chars) { return chars.join(''); }
|
|
236
|
+
function peg$f27() {
|
|
225
237
|
const pos = offset();
|
|
226
238
|
const result = parseQuotedStringAt(input, pos, '"');
|
|
227
239
|
if (result) {
|
|
@@ -231,11 +243,11 @@ function peg$parse(input, options) {
|
|
|
231
243
|
}
|
|
232
244
|
return false;
|
|
233
245
|
}
|
|
234
|
-
function peg$
|
|
235
|
-
function peg$
|
|
236
|
-
function peg$
|
|
237
|
-
function peg$
|
|
238
|
-
function peg$
|
|
246
|
+
function peg$f28(chars) { return parsedValue; }
|
|
247
|
+
function peg$f29(c, cs) { return [c].concat(cs).join(''); }
|
|
248
|
+
function peg$f30() { return parsedLength > 1 && (parsedLength--, true); }
|
|
249
|
+
function peg$f31(c) { return c; }
|
|
250
|
+
function peg$f32() {
|
|
239
251
|
const pos = offset();
|
|
240
252
|
const result = parseQuotedStringAt(input, pos, "'");
|
|
241
253
|
if (result) {
|
|
@@ -245,11 +257,11 @@ function peg$parse(input, options) {
|
|
|
245
257
|
}
|
|
246
258
|
return false;
|
|
247
259
|
}
|
|
248
|
-
function peg$
|
|
249
|
-
function peg$
|
|
250
|
-
function peg$
|
|
251
|
-
function peg$
|
|
252
|
-
function peg$
|
|
260
|
+
function peg$f33(chars) { return parsedValue; }
|
|
261
|
+
function peg$f34(c, cs) { return [c].concat(cs).join(''); }
|
|
262
|
+
function peg$f35() { return parsedLength > 1 && (parsedLength--, true); }
|
|
263
|
+
function peg$f36(c) { return c; }
|
|
264
|
+
function peg$f37() {
|
|
253
265
|
const pos = offset();
|
|
254
266
|
const result = parseQuotedStringAt(input, pos, '`');
|
|
255
267
|
if (result) {
|
|
@@ -259,15 +271,16 @@ function peg$parse(input, options) {
|
|
|
259
271
|
}
|
|
260
272
|
return false;
|
|
261
273
|
}
|
|
262
|
-
function peg$
|
|
263
|
-
function peg$
|
|
264
|
-
function peg$
|
|
265
|
-
function peg$
|
|
266
|
-
function peg$
|
|
267
|
-
function peg$
|
|
268
|
-
function peg$
|
|
269
|
-
function peg$
|
|
270
|
-
function peg$
|
|
274
|
+
function peg$f38(chars) { return parsedValue; }
|
|
275
|
+
function peg$f39(c, cs) { return [c].concat(cs).join(''); }
|
|
276
|
+
function peg$f40() { return parsedLength > 1 && (parsedLength--, true); }
|
|
277
|
+
function peg$f41(c) { return c; }
|
|
278
|
+
function peg$f42() { return indentationStack.slice(); }
|
|
279
|
+
function peg$f43(spaces) { setBaseIndentation(spaces); }
|
|
280
|
+
function peg$f44(spaces) { return normalizeIndentation(spaces) > getCurrentIndentation(); }
|
|
281
|
+
function peg$f45(spaces) { pushIndentation(spaces); }
|
|
282
|
+
function peg$f46(spaces) { return checkIndentation(spaces); }
|
|
283
|
+
function peg$f47() { return isInsideNestedContext(); }
|
|
271
284
|
let peg$currPos = options.peg$currPos | 0;
|
|
272
285
|
let peg$savedPos = peg$currPos;
|
|
273
286
|
const peg$posDetailsCache = [{ line: 1, column: 1 }];
|
|
@@ -637,21 +650,39 @@ function peg$parse(input, options) {
|
|
|
637
650
|
}
|
|
638
651
|
|
|
639
652
|
function peg$parseelement() {
|
|
640
|
-
let s0, s1, s2, s3;
|
|
653
|
+
let s0, s1, s2, s3, s4, s5, s6;
|
|
641
654
|
|
|
642
655
|
s0 = peg$currPos;
|
|
643
|
-
|
|
656
|
+
peg$savedPos = peg$currPos;
|
|
657
|
+
s1 = peg$f7();
|
|
658
|
+
if (s1) {
|
|
659
|
+
s1 = undefined;
|
|
660
|
+
} else {
|
|
661
|
+
s1 = peg$FAILED;
|
|
662
|
+
}
|
|
644
663
|
if (s1 !== peg$FAILED) {
|
|
645
|
-
s2 = peg$
|
|
664
|
+
s2 = peg$parseanyLink();
|
|
646
665
|
if (s2 !== peg$FAILED) {
|
|
647
|
-
s3 = peg$
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
666
|
+
s3 = peg$parseSAVE_INDENTATION();
|
|
667
|
+
s4 = peg$currPos;
|
|
668
|
+
s5 = peg$parsePUSH_INDENTATION();
|
|
669
|
+
if (s5 !== peg$FAILED) {
|
|
670
|
+
s6 = peg$parselinks();
|
|
671
|
+
if (s6 !== peg$FAILED) {
|
|
672
|
+
s4 = s6;
|
|
673
|
+
} else {
|
|
674
|
+
peg$currPos = s4;
|
|
675
|
+
s4 = peg$FAILED;
|
|
676
|
+
}
|
|
651
677
|
} else {
|
|
652
|
-
peg$currPos =
|
|
653
|
-
|
|
678
|
+
peg$currPos = s4;
|
|
679
|
+
s4 = peg$FAILED;
|
|
680
|
+
}
|
|
681
|
+
if (s4 === peg$FAILED) {
|
|
682
|
+
s4 = null;
|
|
654
683
|
}
|
|
684
|
+
peg$savedPos = s0;
|
|
685
|
+
s0 = peg$f8(s2, s3, s4);
|
|
655
686
|
} else {
|
|
656
687
|
peg$currPos = s0;
|
|
657
688
|
s0 = peg$FAILED;
|
|
@@ -662,12 +693,32 @@ function peg$parse(input, options) {
|
|
|
662
693
|
}
|
|
663
694
|
if (s0 === peg$FAILED) {
|
|
664
695
|
s0 = peg$currPos;
|
|
665
|
-
|
|
696
|
+
peg$savedPos = peg$currPos;
|
|
697
|
+
s1 = peg$f9();
|
|
698
|
+
if (s1) {
|
|
699
|
+
s1 = undefined;
|
|
700
|
+
} else {
|
|
701
|
+
s1 = peg$FAILED;
|
|
702
|
+
}
|
|
666
703
|
if (s1 !== peg$FAILED) {
|
|
667
|
-
peg$
|
|
668
|
-
|
|
704
|
+
if (input.length > peg$currPos) {
|
|
705
|
+
s2 = input.charAt(peg$currPos);
|
|
706
|
+
peg$currPos++;
|
|
707
|
+
} else {
|
|
708
|
+
s2 = peg$FAILED;
|
|
709
|
+
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
710
|
+
}
|
|
711
|
+
if (s2 !== peg$FAILED) {
|
|
712
|
+
s1 = [s1, s2];
|
|
713
|
+
s0 = s1;
|
|
714
|
+
} else {
|
|
715
|
+
peg$currPos = s0;
|
|
716
|
+
s0 = peg$FAILED;
|
|
717
|
+
}
|
|
718
|
+
} else {
|
|
719
|
+
peg$currPos = s0;
|
|
720
|
+
s0 = peg$FAILED;
|
|
669
721
|
}
|
|
670
|
-
s0 = s1;
|
|
671
722
|
}
|
|
672
723
|
|
|
673
724
|
return s0;
|
|
@@ -680,7 +731,7 @@ function peg$parse(input, options) {
|
|
|
680
731
|
s1 = peg$parsenestedGroup();
|
|
681
732
|
if (s1 !== peg$FAILED) {
|
|
682
733
|
peg$savedPos = s0;
|
|
683
|
-
s1 = peg$
|
|
734
|
+
s1 = peg$f10(s1);
|
|
684
735
|
}
|
|
685
736
|
s0 = s1;
|
|
686
737
|
if (s0 === peg$FAILED) {
|
|
@@ -688,7 +739,7 @@ function peg$parse(input, options) {
|
|
|
688
739
|
s1 = peg$parsereference();
|
|
689
740
|
if (s1 !== peg$FAILED) {
|
|
690
741
|
peg$savedPos = s0;
|
|
691
|
-
s1 = peg$
|
|
742
|
+
s1 = peg$f11(s1);
|
|
692
743
|
}
|
|
693
744
|
s0 = s1;
|
|
694
745
|
}
|
|
@@ -700,12 +751,26 @@ function peg$parse(input, options) {
|
|
|
700
751
|
let s0, s1, s2;
|
|
701
752
|
|
|
702
753
|
s0 = peg$currPos;
|
|
703
|
-
s1 = peg$
|
|
754
|
+
s1 = peg$currPos;
|
|
755
|
+
peg$silentFails++;
|
|
756
|
+
if (input.charCodeAt(peg$currPos) === 40) {
|
|
757
|
+
s2 = peg$c0;
|
|
758
|
+
peg$currPos++;
|
|
759
|
+
} else {
|
|
760
|
+
s2 = peg$FAILED;
|
|
761
|
+
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
762
|
+
}
|
|
763
|
+
peg$silentFails--;
|
|
764
|
+
if (s2 !== peg$FAILED) {
|
|
765
|
+
peg$currPos = s1;
|
|
766
|
+
s1 = undefined;
|
|
767
|
+
} else {
|
|
768
|
+
s1 = peg$FAILED;
|
|
769
|
+
}
|
|
704
770
|
if (s1 !== peg$FAILED) {
|
|
705
|
-
s2 = peg$
|
|
771
|
+
s2 = peg$parsegroupLink();
|
|
706
772
|
if (s2 !== peg$FAILED) {
|
|
707
|
-
|
|
708
|
-
s0 = peg$f11(s1);
|
|
773
|
+
s0 = s2;
|
|
709
774
|
} else {
|
|
710
775
|
peg$currPos = s0;
|
|
711
776
|
s0 = peg$FAILED;
|
|
@@ -716,20 +781,88 @@ function peg$parse(input, options) {
|
|
|
716
781
|
}
|
|
717
782
|
if (s0 === peg$FAILED) {
|
|
718
783
|
s0 = peg$currPos;
|
|
719
|
-
s1 = peg$
|
|
784
|
+
s1 = peg$currPos;
|
|
785
|
+
peg$silentFails++;
|
|
786
|
+
if (input.charCodeAt(peg$currPos) === 40) {
|
|
787
|
+
s2 = peg$c0;
|
|
788
|
+
peg$currPos++;
|
|
789
|
+
} else {
|
|
790
|
+
s2 = peg$FAILED;
|
|
791
|
+
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
792
|
+
}
|
|
793
|
+
peg$silentFails--;
|
|
794
|
+
if (s2 === peg$FAILED) {
|
|
795
|
+
s1 = undefined;
|
|
796
|
+
} else {
|
|
797
|
+
peg$currPos = s1;
|
|
798
|
+
s1 = peg$FAILED;
|
|
799
|
+
}
|
|
720
800
|
if (s1 !== peg$FAILED) {
|
|
801
|
+
s2 = peg$parseindentedIdLink();
|
|
802
|
+
if (s2 === peg$FAILED) {
|
|
803
|
+
s2 = peg$parsesingleLineAnyLink();
|
|
804
|
+
}
|
|
805
|
+
if (s2 !== peg$FAILED) {
|
|
806
|
+
s0 = s2;
|
|
807
|
+
} else {
|
|
808
|
+
peg$currPos = s0;
|
|
809
|
+
s0 = peg$FAILED;
|
|
810
|
+
}
|
|
811
|
+
} else {
|
|
812
|
+
peg$currPos = s0;
|
|
813
|
+
s0 = peg$FAILED;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
return s0;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
function peg$parsegroupLink() {
|
|
821
|
+
let s0, s1, s2;
|
|
822
|
+
|
|
823
|
+
s0 = peg$currPos;
|
|
824
|
+
s1 = peg$parsenestedGroup();
|
|
825
|
+
if (s1 !== peg$FAILED) {
|
|
826
|
+
s2 = peg$parsegroupLinkRest();
|
|
827
|
+
if (s2 !== peg$FAILED) {
|
|
721
828
|
peg$savedPos = s0;
|
|
722
|
-
|
|
829
|
+
s0 = peg$f12(s1, s2);
|
|
830
|
+
} else {
|
|
831
|
+
peg$currPos = s0;
|
|
832
|
+
s0 = peg$FAILED;
|
|
723
833
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
834
|
+
} else {
|
|
835
|
+
peg$currPos = s0;
|
|
836
|
+
s0 = peg$FAILED;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
return s0;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
function peg$parsegroupLinkRest() {
|
|
843
|
+
let s0, s1, s2;
|
|
844
|
+
|
|
845
|
+
s0 = peg$currPos;
|
|
846
|
+
s1 = peg$parseeol();
|
|
847
|
+
if (s1 !== peg$FAILED) {
|
|
848
|
+
peg$savedPos = s0;
|
|
849
|
+
s1 = peg$f13();
|
|
850
|
+
}
|
|
851
|
+
s0 = s1;
|
|
852
|
+
if (s0 === peg$FAILED) {
|
|
853
|
+
s0 = peg$currPos;
|
|
854
|
+
s1 = [];
|
|
855
|
+
s2 = peg$parsesingleLineValueAndWhitespace();
|
|
856
|
+
while (s2 !== peg$FAILED) {
|
|
857
|
+
s1.push(s2);
|
|
858
|
+
s2 = peg$parsesingleLineValueAndWhitespace();
|
|
859
|
+
}
|
|
860
|
+
s2 = peg$parseeol();
|
|
861
|
+
if (s2 !== peg$FAILED) {
|
|
732
862
|
s0 = s1;
|
|
863
|
+
} else {
|
|
864
|
+
peg$currPos = s0;
|
|
865
|
+
s0 = peg$FAILED;
|
|
733
866
|
}
|
|
734
867
|
}
|
|
735
868
|
|
|
@@ -784,7 +917,7 @@ function peg$parse(input, options) {
|
|
|
784
917
|
peg$currPos++;
|
|
785
918
|
} else {
|
|
786
919
|
s1 = peg$FAILED;
|
|
787
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
920
|
+
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
788
921
|
}
|
|
789
922
|
if (s1 !== peg$FAILED) {
|
|
790
923
|
s2 = peg$parseENTER_NESTED_CONTEXT();
|
|
@@ -805,6 +938,35 @@ function peg$parse(input, options) {
|
|
|
805
938
|
peg$currPos = s0;
|
|
806
939
|
s0 = peg$FAILED;
|
|
807
940
|
}
|
|
941
|
+
if (s0 === peg$FAILED) {
|
|
942
|
+
s0 = peg$currPos;
|
|
943
|
+
if (input.charCodeAt(peg$currPos) === 40) {
|
|
944
|
+
s1 = peg$c0;
|
|
945
|
+
peg$currPos++;
|
|
946
|
+
} else {
|
|
947
|
+
s1 = peg$FAILED;
|
|
948
|
+
if (peg$silentFails === 0) { peg$fail(peg$e3); }
|
|
949
|
+
}
|
|
950
|
+
if (s1 !== peg$FAILED) {
|
|
951
|
+
peg$savedPos = peg$currPos;
|
|
952
|
+
s2 = peg$f17();
|
|
953
|
+
if (s2) {
|
|
954
|
+
s2 = undefined;
|
|
955
|
+
} else {
|
|
956
|
+
s2 = peg$FAILED;
|
|
957
|
+
}
|
|
958
|
+
if (s2 !== peg$FAILED) {
|
|
959
|
+
s1 = [s1, s2];
|
|
960
|
+
s0 = s1;
|
|
961
|
+
} else {
|
|
962
|
+
peg$currPos = s0;
|
|
963
|
+
s0 = peg$FAILED;
|
|
964
|
+
}
|
|
965
|
+
} else {
|
|
966
|
+
peg$currPos = s0;
|
|
967
|
+
s0 = peg$FAILED;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
808
970
|
|
|
809
971
|
return s0;
|
|
810
972
|
}
|
|
@@ -822,11 +984,11 @@ function peg$parse(input, options) {
|
|
|
822
984
|
peg$currPos++;
|
|
823
985
|
} else {
|
|
824
986
|
s4 = peg$FAILED;
|
|
825
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
987
|
+
if (peg$silentFails === 0) { peg$fail(peg$e4); }
|
|
826
988
|
}
|
|
827
989
|
if (s4 !== peg$FAILED) {
|
|
828
990
|
peg$savedPos = s0;
|
|
829
|
-
s0 = peg$
|
|
991
|
+
s0 = peg$f18(s2);
|
|
830
992
|
} else {
|
|
831
993
|
peg$currPos = s0;
|
|
832
994
|
s0 = peg$FAILED;
|
|
@@ -843,11 +1005,11 @@ function peg$parse(input, options) {
|
|
|
843
1005
|
peg$currPos++;
|
|
844
1006
|
} else {
|
|
845
1007
|
s2 = peg$FAILED;
|
|
846
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1008
|
+
if (peg$silentFails === 0) { peg$fail(peg$e4); }
|
|
847
1009
|
}
|
|
848
1010
|
if (s2 !== peg$FAILED) {
|
|
849
1011
|
peg$savedPos = s0;
|
|
850
|
-
s0 = peg$
|
|
1012
|
+
s0 = peg$f19();
|
|
851
1013
|
} else {
|
|
852
1014
|
peg$currPos = s0;
|
|
853
1015
|
s0 = peg$FAILED;
|
|
@@ -861,7 +1023,7 @@ function peg$parse(input, options) {
|
|
|
861
1023
|
let s0;
|
|
862
1024
|
|
|
863
1025
|
peg$savedPos = peg$currPos;
|
|
864
|
-
s0 = peg$
|
|
1026
|
+
s0 = peg$f20();
|
|
865
1027
|
if (s0) {
|
|
866
1028
|
s0 = undefined;
|
|
867
1029
|
} else {
|
|
@@ -879,7 +1041,7 @@ function peg$parse(input, options) {
|
|
|
879
1041
|
s2 = peg$parsereferenceOrLink();
|
|
880
1042
|
if (s2 !== peg$FAILED) {
|
|
881
1043
|
peg$savedPos = s0;
|
|
882
|
-
s0 = peg$
|
|
1044
|
+
s0 = peg$f21(s2);
|
|
883
1045
|
} else {
|
|
884
1046
|
peg$currPos = s0;
|
|
885
1047
|
s0 = peg$FAILED;
|
|
@@ -904,7 +1066,7 @@ function peg$parse(input, options) {
|
|
|
904
1066
|
}
|
|
905
1067
|
if (s1 !== peg$FAILED) {
|
|
906
1068
|
peg$savedPos = s0;
|
|
907
|
-
s1 = peg$
|
|
1069
|
+
s1 = peg$f22(s1);
|
|
908
1070
|
}
|
|
909
1071
|
s0 = s1;
|
|
910
1072
|
|
|
@@ -924,13 +1086,13 @@ function peg$parse(input, options) {
|
|
|
924
1086
|
peg$currPos++;
|
|
925
1087
|
} else {
|
|
926
1088
|
s4 = peg$FAILED;
|
|
927
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1089
|
+
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
928
1090
|
}
|
|
929
1091
|
if (s4 !== peg$FAILED) {
|
|
930
1092
|
s5 = peg$parsesingleLineValues();
|
|
931
1093
|
if (s5 !== peg$FAILED) {
|
|
932
1094
|
peg$savedPos = s0;
|
|
933
|
-
s0 = peg$
|
|
1095
|
+
s0 = peg$f23(s2, s5);
|
|
934
1096
|
} else {
|
|
935
1097
|
peg$currPos = s0;
|
|
936
1098
|
s0 = peg$FAILED;
|
|
@@ -954,7 +1116,7 @@ function peg$parse(input, options) {
|
|
|
954
1116
|
s1 = peg$parsesingleLineValues();
|
|
955
1117
|
if (s1 !== peg$FAILED) {
|
|
956
1118
|
peg$savedPos = s0;
|
|
957
|
-
s1 = peg$
|
|
1119
|
+
s1 = peg$f24(s1);
|
|
958
1120
|
}
|
|
959
1121
|
s0 = s1;
|
|
960
1122
|
|
|
@@ -973,13 +1135,13 @@ function peg$parse(input, options) {
|
|
|
973
1135
|
peg$currPos++;
|
|
974
1136
|
} else {
|
|
975
1137
|
s3 = peg$FAILED;
|
|
976
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1138
|
+
if (peg$silentFails === 0) { peg$fail(peg$e5); }
|
|
977
1139
|
}
|
|
978
1140
|
if (s3 !== peg$FAILED) {
|
|
979
1141
|
s4 = peg$parseeol();
|
|
980
1142
|
if (s4 !== peg$FAILED) {
|
|
981
1143
|
peg$savedPos = s0;
|
|
982
|
-
s0 = peg$
|
|
1144
|
+
s0 = peg$f25(s1);
|
|
983
1145
|
} else {
|
|
984
1146
|
peg$currPos = s0;
|
|
985
1147
|
s0 = peg$FAILED;
|
|
@@ -1023,7 +1185,7 @@ function peg$parse(input, options) {
|
|
|
1023
1185
|
}
|
|
1024
1186
|
if (s1 !== peg$FAILED) {
|
|
1025
1187
|
peg$savedPos = s0;
|
|
1026
|
-
s1 = peg$
|
|
1188
|
+
s1 = peg$f26(s1);
|
|
1027
1189
|
}
|
|
1028
1190
|
s0 = s1;
|
|
1029
1191
|
|
|
@@ -1055,7 +1217,7 @@ function peg$parse(input, options) {
|
|
|
1055
1217
|
peg$currPos++;
|
|
1056
1218
|
} else {
|
|
1057
1219
|
s2 = peg$FAILED;
|
|
1058
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1220
|
+
if (peg$silentFails === 0) { peg$fail(peg$e6); }
|
|
1059
1221
|
}
|
|
1060
1222
|
peg$silentFails--;
|
|
1061
1223
|
if (s2 !== peg$FAILED) {
|
|
@@ -1066,7 +1228,7 @@ function peg$parse(input, options) {
|
|
|
1066
1228
|
}
|
|
1067
1229
|
if (s1 !== peg$FAILED) {
|
|
1068
1230
|
peg$savedPos = peg$currPos;
|
|
1069
|
-
s2 = peg$
|
|
1231
|
+
s2 = peg$f27();
|
|
1070
1232
|
if (s2) {
|
|
1071
1233
|
s2 = undefined;
|
|
1072
1234
|
} else {
|
|
@@ -1076,7 +1238,7 @@ function peg$parse(input, options) {
|
|
|
1076
1238
|
s3 = peg$parseconsumeDouble();
|
|
1077
1239
|
if (s3 !== peg$FAILED) {
|
|
1078
1240
|
peg$savedPos = s0;
|
|
1079
|
-
s0 = peg$
|
|
1241
|
+
s0 = peg$f28(s3);
|
|
1080
1242
|
} else {
|
|
1081
1243
|
peg$currPos = s0;
|
|
1082
1244
|
s0 = peg$FAILED;
|
|
@@ -1102,7 +1264,7 @@ function peg$parse(input, options) {
|
|
|
1102
1264
|
peg$currPos++;
|
|
1103
1265
|
} else {
|
|
1104
1266
|
s1 = peg$FAILED;
|
|
1105
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1267
|
+
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
1106
1268
|
}
|
|
1107
1269
|
if (s1 !== peg$FAILED) {
|
|
1108
1270
|
s2 = [];
|
|
@@ -1112,7 +1274,7 @@ function peg$parse(input, options) {
|
|
|
1112
1274
|
s3 = peg$parseconsumeDoubleMore();
|
|
1113
1275
|
}
|
|
1114
1276
|
peg$savedPos = s0;
|
|
1115
|
-
s0 = peg$
|
|
1277
|
+
s0 = peg$f29(s1, s2);
|
|
1116
1278
|
} else {
|
|
1117
1279
|
peg$currPos = s0;
|
|
1118
1280
|
s0 = peg$FAILED;
|
|
@@ -1126,7 +1288,7 @@ function peg$parse(input, options) {
|
|
|
1126
1288
|
|
|
1127
1289
|
s0 = peg$currPos;
|
|
1128
1290
|
peg$savedPos = peg$currPos;
|
|
1129
|
-
s1 = peg$
|
|
1291
|
+
s1 = peg$f30();
|
|
1130
1292
|
if (s1) {
|
|
1131
1293
|
s1 = undefined;
|
|
1132
1294
|
} else {
|
|
@@ -1138,11 +1300,11 @@ function peg$parse(input, options) {
|
|
|
1138
1300
|
peg$currPos++;
|
|
1139
1301
|
} else {
|
|
1140
1302
|
s2 = peg$FAILED;
|
|
1141
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1303
|
+
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
1142
1304
|
}
|
|
1143
1305
|
if (s2 !== peg$FAILED) {
|
|
1144
1306
|
peg$savedPos = s0;
|
|
1145
|
-
s0 = peg$
|
|
1307
|
+
s0 = peg$f31(s2);
|
|
1146
1308
|
} else {
|
|
1147
1309
|
peg$currPos = s0;
|
|
1148
1310
|
s0 = peg$FAILED;
|
|
@@ -1177,7 +1339,7 @@ function peg$parse(input, options) {
|
|
|
1177
1339
|
}
|
|
1178
1340
|
if (s1 !== peg$FAILED) {
|
|
1179
1341
|
peg$savedPos = peg$currPos;
|
|
1180
|
-
s2 = peg$
|
|
1342
|
+
s2 = peg$f32();
|
|
1181
1343
|
if (s2) {
|
|
1182
1344
|
s2 = undefined;
|
|
1183
1345
|
} else {
|
|
@@ -1187,7 +1349,7 @@ function peg$parse(input, options) {
|
|
|
1187
1349
|
s3 = peg$parseconsumeSingle();
|
|
1188
1350
|
if (s3 !== peg$FAILED) {
|
|
1189
1351
|
peg$savedPos = s0;
|
|
1190
|
-
s0 = peg$
|
|
1352
|
+
s0 = peg$f33(s3);
|
|
1191
1353
|
} else {
|
|
1192
1354
|
peg$currPos = s0;
|
|
1193
1355
|
s0 = peg$FAILED;
|
|
@@ -1213,7 +1375,7 @@ function peg$parse(input, options) {
|
|
|
1213
1375
|
peg$currPos++;
|
|
1214
1376
|
} else {
|
|
1215
1377
|
s1 = peg$FAILED;
|
|
1216
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1378
|
+
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
1217
1379
|
}
|
|
1218
1380
|
if (s1 !== peg$FAILED) {
|
|
1219
1381
|
s2 = [];
|
|
@@ -1223,7 +1385,7 @@ function peg$parse(input, options) {
|
|
|
1223
1385
|
s3 = peg$parseconsumeSingleMore();
|
|
1224
1386
|
}
|
|
1225
1387
|
peg$savedPos = s0;
|
|
1226
|
-
s0 = peg$
|
|
1388
|
+
s0 = peg$f34(s1, s2);
|
|
1227
1389
|
} else {
|
|
1228
1390
|
peg$currPos = s0;
|
|
1229
1391
|
s0 = peg$FAILED;
|
|
@@ -1237,7 +1399,7 @@ function peg$parse(input, options) {
|
|
|
1237
1399
|
|
|
1238
1400
|
s0 = peg$currPos;
|
|
1239
1401
|
peg$savedPos = peg$currPos;
|
|
1240
|
-
s1 = peg$
|
|
1402
|
+
s1 = peg$f35();
|
|
1241
1403
|
if (s1) {
|
|
1242
1404
|
s1 = undefined;
|
|
1243
1405
|
} else {
|
|
@@ -1249,11 +1411,11 @@ function peg$parse(input, options) {
|
|
|
1249
1411
|
peg$currPos++;
|
|
1250
1412
|
} else {
|
|
1251
1413
|
s2 = peg$FAILED;
|
|
1252
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1414
|
+
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
1253
1415
|
}
|
|
1254
1416
|
if (s2 !== peg$FAILED) {
|
|
1255
1417
|
peg$savedPos = s0;
|
|
1256
|
-
s0 = peg$
|
|
1418
|
+
s0 = peg$f36(s2);
|
|
1257
1419
|
} else {
|
|
1258
1420
|
peg$currPos = s0;
|
|
1259
1421
|
s0 = peg$FAILED;
|
|
@@ -1288,7 +1450,7 @@ function peg$parse(input, options) {
|
|
|
1288
1450
|
}
|
|
1289
1451
|
if (s1 !== peg$FAILED) {
|
|
1290
1452
|
peg$savedPos = peg$currPos;
|
|
1291
|
-
s2 = peg$
|
|
1453
|
+
s2 = peg$f37();
|
|
1292
1454
|
if (s2) {
|
|
1293
1455
|
s2 = undefined;
|
|
1294
1456
|
} else {
|
|
@@ -1298,7 +1460,7 @@ function peg$parse(input, options) {
|
|
|
1298
1460
|
s3 = peg$parseconsumeBacktick();
|
|
1299
1461
|
if (s3 !== peg$FAILED) {
|
|
1300
1462
|
peg$savedPos = s0;
|
|
1301
|
-
s0 = peg$
|
|
1463
|
+
s0 = peg$f38(s3);
|
|
1302
1464
|
} else {
|
|
1303
1465
|
peg$currPos = s0;
|
|
1304
1466
|
s0 = peg$FAILED;
|
|
@@ -1324,7 +1486,7 @@ function peg$parse(input, options) {
|
|
|
1324
1486
|
peg$currPos++;
|
|
1325
1487
|
} else {
|
|
1326
1488
|
s1 = peg$FAILED;
|
|
1327
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1489
|
+
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
1328
1490
|
}
|
|
1329
1491
|
if (s1 !== peg$FAILED) {
|
|
1330
1492
|
s2 = [];
|
|
@@ -1334,7 +1496,7 @@ function peg$parse(input, options) {
|
|
|
1334
1496
|
s3 = peg$parseconsumeBacktickMore();
|
|
1335
1497
|
}
|
|
1336
1498
|
peg$savedPos = s0;
|
|
1337
|
-
s0 = peg$
|
|
1499
|
+
s0 = peg$f39(s1, s2);
|
|
1338
1500
|
} else {
|
|
1339
1501
|
peg$currPos = s0;
|
|
1340
1502
|
s0 = peg$FAILED;
|
|
@@ -1348,7 +1510,7 @@ function peg$parse(input, options) {
|
|
|
1348
1510
|
|
|
1349
1511
|
s0 = peg$currPos;
|
|
1350
1512
|
peg$savedPos = peg$currPos;
|
|
1351
|
-
s1 = peg$
|
|
1513
|
+
s1 = peg$f40();
|
|
1352
1514
|
if (s1) {
|
|
1353
1515
|
s1 = undefined;
|
|
1354
1516
|
} else {
|
|
@@ -1360,11 +1522,11 @@ function peg$parse(input, options) {
|
|
|
1360
1522
|
peg$currPos++;
|
|
1361
1523
|
} else {
|
|
1362
1524
|
s2 = peg$FAILED;
|
|
1363
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1525
|
+
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
1364
1526
|
}
|
|
1365
1527
|
if (s2 !== peg$FAILED) {
|
|
1366
1528
|
peg$savedPos = s0;
|
|
1367
|
-
s0 = peg$
|
|
1529
|
+
s0 = peg$f41(s2);
|
|
1368
1530
|
} else {
|
|
1369
1531
|
peg$currPos = s0;
|
|
1370
1532
|
s0 = peg$FAILED;
|
|
@@ -1377,6 +1539,18 @@ function peg$parse(input, options) {
|
|
|
1377
1539
|
return s0;
|
|
1378
1540
|
}
|
|
1379
1541
|
|
|
1542
|
+
function peg$parseSAVE_INDENTATION() {
|
|
1543
|
+
let s0, s1;
|
|
1544
|
+
|
|
1545
|
+
s0 = peg$currPos;
|
|
1546
|
+
s1 = '';
|
|
1547
|
+
peg$savedPos = s0;
|
|
1548
|
+
s1 = peg$f42();
|
|
1549
|
+
s0 = s1;
|
|
1550
|
+
|
|
1551
|
+
return s0;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1380
1554
|
function peg$parseSET_BASE_INDENTATION() {
|
|
1381
1555
|
let s0, s1, s2;
|
|
1382
1556
|
|
|
@@ -1400,7 +1574,7 @@ function peg$parse(input, options) {
|
|
|
1400
1574
|
}
|
|
1401
1575
|
}
|
|
1402
1576
|
peg$savedPos = s0;
|
|
1403
|
-
s1 = peg$
|
|
1577
|
+
s1 = peg$f43(s1);
|
|
1404
1578
|
s0 = s1;
|
|
1405
1579
|
|
|
1406
1580
|
return s0;
|
|
@@ -1429,7 +1603,7 @@ function peg$parse(input, options) {
|
|
|
1429
1603
|
}
|
|
1430
1604
|
}
|
|
1431
1605
|
peg$savedPos = peg$currPos;
|
|
1432
|
-
s2 = peg$
|
|
1606
|
+
s2 = peg$f44(s1);
|
|
1433
1607
|
if (s2) {
|
|
1434
1608
|
s2 = undefined;
|
|
1435
1609
|
} else {
|
|
@@ -1437,7 +1611,7 @@ function peg$parse(input, options) {
|
|
|
1437
1611
|
}
|
|
1438
1612
|
if (s2 !== peg$FAILED) {
|
|
1439
1613
|
peg$savedPos = s0;
|
|
1440
|
-
s0 = peg$
|
|
1614
|
+
s0 = peg$f45(s1);
|
|
1441
1615
|
} else {
|
|
1442
1616
|
peg$currPos = s0;
|
|
1443
1617
|
s0 = peg$FAILED;
|
|
@@ -1469,7 +1643,7 @@ function peg$parse(input, options) {
|
|
|
1469
1643
|
}
|
|
1470
1644
|
}
|
|
1471
1645
|
peg$savedPos = peg$currPos;
|
|
1472
|
-
s2 = peg$
|
|
1646
|
+
s2 = peg$f46(s1);
|
|
1473
1647
|
if (s2) {
|
|
1474
1648
|
s2 = undefined;
|
|
1475
1649
|
} else {
|
|
@@ -1669,7 +1843,7 @@ function peg$parse(input, options) {
|
|
|
1669
1843
|
|
|
1670
1844
|
s0 = peg$currPos;
|
|
1671
1845
|
peg$savedPos = peg$currPos;
|
|
1672
|
-
s1 = peg$
|
|
1846
|
+
s1 = peg$f47();
|
|
1673
1847
|
if (s1) {
|
|
1674
1848
|
s1 = undefined;
|
|
1675
1849
|
} else {
|
|
@@ -1683,7 +1857,7 @@ function peg$parse(input, options) {
|
|
|
1683
1857
|
peg$currPos++;
|
|
1684
1858
|
} else {
|
|
1685
1859
|
s3 = peg$FAILED;
|
|
1686
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1860
|
+
if (peg$silentFails === 0) { peg$fail(peg$e4); }
|
|
1687
1861
|
}
|
|
1688
1862
|
peg$silentFails--;
|
|
1689
1863
|
if (s3 !== peg$FAILED) {
|
|
@@ -1717,7 +1891,7 @@ function peg$parse(input, options) {
|
|
|
1717
1891
|
peg$currPos++;
|
|
1718
1892
|
} else {
|
|
1719
1893
|
s1 = peg$FAILED;
|
|
1720
|
-
if (peg$silentFails === 0) { peg$fail(peg$
|
|
1894
|
+
if (peg$silentFails === 0) { peg$fail(peg$e2); }
|
|
1721
1895
|
}
|
|
1722
1896
|
peg$silentFails--;
|
|
1723
1897
|
if (s1 === peg$FAILED) {
|
|
@@ -1803,14 +1977,27 @@ function peg$parse(input, options) {
|
|
|
1803
1977
|
// group opens a nested context that starts fresh at indentation level zero,
|
|
1804
1978
|
// so line breaks and indentation mean the same thing at every depth.
|
|
1805
1979
|
let contextStack = [];
|
|
1980
|
+
// Lines already found unreadable, keyed by where they start and whether they
|
|
1981
|
+
// are inside a parenthesised group. Reading a line depends on nothing else: a
|
|
1982
|
+
// group starts a fresh indentation context, and indentation only decides
|
|
1983
|
+
// which lines become children, so a line that could not be read once never
|
|
1984
|
+
// can be. A line that does not parse as the first child of the line above it
|
|
1985
|
+
// is tried again as a sibling at every enclosing indentation level, and
|
|
1986
|
+
// without this each of those attempts would read the whole line again.
|
|
1987
|
+
let unreadableLines = new Set();
|
|
1806
1988
|
|
|
1807
1989
|
function resetState() {
|
|
1808
1990
|
indentationStack = [0];
|
|
1809
1991
|
baseIndentation = null;
|
|
1810
1992
|
contextStack = [];
|
|
1993
|
+
unreadableLines = new Set();
|
|
1811
1994
|
return true;
|
|
1812
1995
|
}
|
|
1813
1996
|
|
|
1997
|
+
function lineKey(position) {
|
|
1998
|
+
return contextStack.length > 0 ? -1 - position : position;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
1814
2001
|
function enterNestedContext() {
|
|
1815
2002
|
contextStack.push({ indentationStack, baseIndentation });
|
|
1816
2003
|
indentationStack = [0];
|
|
@@ -1864,87 +2051,18 @@ function peg$parse(input, options) {
|
|
|
1864
2051
|
return indentationStack[indentationStack.length - 1];
|
|
1865
2052
|
}
|
|
1866
2053
|
|
|
1867
|
-
//
|
|
1868
|
-
//
|
|
1869
|
-
|
|
1870
|
-
// n-quote reading is only taken when it carries something the pairs cannot.
|
|
1871
|
-
function isSubstantiveBody(content) {
|
|
1872
|
-
let depth = 0;
|
|
1873
|
-
let hasVisible = false;
|
|
1874
|
-
|
|
1875
|
-
for (const c of content) {
|
|
1876
|
-
if (c === '(') {
|
|
1877
|
-
depth++;
|
|
1878
|
-
} else if (c === ')') {
|
|
1879
|
-
depth--;
|
|
1880
|
-
if (depth < 0) {
|
|
1881
|
-
return false;
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
if (!/[ \t\n\r]/.test(c)) {
|
|
1885
|
-
hasVisible = true;
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
return hasVisible && depth === 0;
|
|
1890
|
-
}
|
|
2054
|
+
// Delimited references of this document, each read once however many
|
|
2055
|
+
// alternatives ask for it (see quotes.js for how a reference is read)
|
|
2056
|
+
const delimitedReferences = new DelimitedReferences(input);
|
|
1891
2057
|
|
|
1892
2058
|
// Universal procedural parser for N-quote strings (any N >= 1)
|
|
1893
2059
|
// Parses from the given position in the input string
|
|
1894
|
-
// A run of an even number of delimiters that does not open a reference with a
|
|
1895
|
-
// substantive body is the empty reference: the shortest reading, a bare
|
|
1896
|
-
// delimiter pair enclosing nothing, wins over a longer n-quote delimiter.
|
|
1897
2060
|
// Returns { value, length } or null
|
|
1898
2061
|
function parseQuotedStringAt(inputStr, startPos, quoteChar) {
|
|
1899
2062
|
if (startPos >= inputStr.length || inputStr[startPos] !== quoteChar) {
|
|
1900
2063
|
return null;
|
|
1901
2064
|
}
|
|
1902
|
-
|
|
1903
|
-
// Count opening quotes
|
|
1904
|
-
let quoteCount = 0;
|
|
1905
|
-
let pos = startPos;
|
|
1906
|
-
while (pos < inputStr.length && inputStr[pos] === quoteChar) {
|
|
1907
|
-
quoteCount++;
|
|
1908
|
-
pos++;
|
|
1909
|
-
}
|
|
1910
|
-
|
|
1911
|
-
const isEvenRun = quoteCount % 2 === 0;
|
|
1912
|
-
const emptyReference = isEvenRun ? { value: '', length: quoteCount } : null;
|
|
1913
|
-
|
|
1914
|
-
const closeSeq = quoteChar.repeat(quoteCount);
|
|
1915
|
-
const escapeSeq = quoteChar.repeat(quoteCount * 2);
|
|
1916
|
-
|
|
1917
|
-
let content = '';
|
|
1918
|
-
while (pos < inputStr.length) {
|
|
1919
|
-
// Check for escape sequence (2*N quotes)
|
|
1920
|
-
if (inputStr.substr(pos, escapeSeq.length) === escapeSeq) {
|
|
1921
|
-
content += closeSeq; // 2*N quotes become N quotes
|
|
1922
|
-
pos += escapeSeq.length;
|
|
1923
|
-
continue;
|
|
1924
|
-
}
|
|
1925
|
-
|
|
1926
|
-
// Check for closing sequence (exactly N quotes)
|
|
1927
|
-
if (inputStr.substr(pos, quoteCount) === closeSeq) {
|
|
1928
|
-
// Verify it's exactly N quotes (not followed by more of same char)
|
|
1929
|
-
const afterClose = pos + quoteCount;
|
|
1930
|
-
if (afterClose >= inputStr.length || inputStr[afterClose] !== quoteChar) {
|
|
1931
|
-
// Found valid closing
|
|
1932
|
-
if (isEvenRun && !isSubstantiveBody(content)) {
|
|
1933
|
-
return emptyReference;
|
|
1934
|
-
}
|
|
1935
|
-
return {
|
|
1936
|
-
value: content,
|
|
1937
|
-
length: afterClose - startPos
|
|
1938
|
-
};
|
|
1939
|
-
}
|
|
1940
|
-
}
|
|
1941
|
-
|
|
1942
|
-
// Add character to content
|
|
1943
|
-
content += inputStr[pos];
|
|
1944
|
-
pos++;
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
return emptyReference; // No valid closing found
|
|
2065
|
+
return delimitedReferences.readAt(startPos);
|
|
1948
2066
|
}
|
|
1949
2067
|
|
|
1950
2068
|
// Global state for passing parsed values between predicate and action
|