markdown-parser 0.0.7 → 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.
@@ -1,3462 +0,0 @@
1
- markdownparser = (function() {
2
- /*
3
- * Generated by PEG.js 0.8.0.
4
- *
5
- * http://pegjs.majda.cz/
6
- */
7
-
8
- function peg$subclass(child, parent) {
9
- function ctor() { this.constructor = child; }
10
- ctor.prototype = parent.prototype;
11
- child.prototype = new ctor();
12
- }
13
-
14
- function SyntaxError(message, expected, found, offset, line, column) {
15
- this.message = message;
16
- this.expected = expected;
17
- this.found = found;
18
- this.offset = offset;
19
- this.line = line;
20
- this.column = column;
21
-
22
- this.name = "SyntaxError";
23
- }
24
-
25
- peg$subclass(SyntaxError, Error);
26
-
27
- function parse(input) {
28
- var options = arguments.length > 1 ? arguments[1] : {},
29
-
30
- peg$FAILED = {},
31
-
32
- peg$startRuleFunctions = { start: peg$parsestart },
33
- peg$startRuleFunction = peg$parsestart,
34
-
35
- peg$c0 = [],
36
- peg$c1 = peg$FAILED,
37
- peg$c2 = function(info) {
38
- return extractList(info);
39
- },
40
- peg$c3 = /^[1-9]/,
41
- peg$c4 = { type: "class", value: "[1-9]", description: "[1-9]" },
42
- peg$c5 = void 0,
43
- peg$c6 = { type: "any", description: "any character" },
44
- peg$c7 = "\r\n",
45
- peg$c8 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" },
46
- peg$c9 = "\r",
47
- peg$c10 = { type: "literal", value: "\r", description: "\"\\r\"" },
48
- peg$c11 = "\n",
49
- peg$c12 = { type: "literal", value: "\n", description: "\"\\n\"" },
50
- peg$c13 = " ",
51
- peg$c14 = { type: "literal", value: " ", description: "\" \"" },
52
- peg$c15 = "\t",
53
- peg$c16 = { type: "literal", value: "\t", description: "\"\\t\"" },
54
- peg$c17 = /^[ -']/,
55
- peg$c18 = { type: "class", value: "[ -']", description: "[ -']" },
56
- peg$c19 = /^[+-@]/,
57
- peg$c20 = { type: "class", value: "[+-@]", description: "[+-@]" },
58
- peg$c21 = /^[A-Z]/,
59
- peg$c22 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
60
- peg$c23 = /^[a-z]/,
61
- peg$c24 = { type: "class", value: "[a-z]", description: "[a-z]" },
62
- peg$c25 = /^[`-z]/,
63
- peg$c26 = { type: "class", value: "[`-z]", description: "[`-z]" },
64
- peg$c27 = /^[ -*]/,
65
- peg$c28 = { type: "class", value: "[ -*]", description: "[ -*]" },
66
- peg$c29 = /^[A-[]/,
67
- peg$c30 = { type: "class", value: "[A-[]", description: "[A-[]" },
68
- peg$c31 = /^[A-_]/,
69
- peg$c32 = { type: "class", value: "[A-_]", description: "[A-_]" },
70
- peg$c33 = /^[a-~]/,
71
- peg$c34 = { type: "class", value: "[a-~]", description: "[a-~]" },
72
- peg$c35 = /^[ -@]/,
73
- peg$c36 = { type: "class", value: "[ -@]", description: "[ -@]" },
74
- peg$c37 = /^[A-`]/,
75
- peg$c38 = { type: "class", value: "[A-`]", description: "[A-`]" },
76
- peg$c39 = /^[a-\xFFFF]/,
77
- peg$c40 = { type: "class", value: "[a-\\xFFFF]", description: "[a-\\xFFFF]" },
78
- peg$c41 = /^[\-]/,
79
- peg$c42 = { type: "class", value: "[\\-]", description: "[\\-]" },
80
- peg$c43 = null,
81
- peg$c44 = function(text) {
82
- return {
83
- others: text.join("")
84
- }
85
- },
86
- peg$c45 = "#",
87
- peg$c46 = { type: "literal", value: "#", description: "\"#\"" },
88
- peg$c47 = function(text) {
89
- return {
90
- heading: text.join("")
91
- }
92
- },
93
- peg$c48 = function(text) {
94
- return {
95
- section: text.join("")
96
- }
97
- },
98
- peg$c49 = /^[*]/,
99
- peg$c50 = { type: "class", value: "[*]", description: "[*]" },
100
- peg$c51 = function(text) {
101
- return {
102
- italic: text.join("")
103
- }
104
- },
105
- peg$c52 = /^[_]/,
106
- peg$c53 = { type: "class", value: "[_]", description: "[_]" },
107
- peg$c54 = function(text) {
108
- return {
109
- bold: text.join("")
110
- }
111
- },
112
- peg$c55 = /^[~]/,
113
- peg$c56 = { type: "class", value: "[~]", description: "[~]" },
114
- peg$c57 = function(text) {
115
- return {
116
- strikethrough : text.join("")
117
- }
118
- },
119
- peg$c58 = "* ",
120
- peg$c59 = { type: "literal", value: "* ", description: "\"* \"" },
121
- peg$c60 = "- ",
122
- peg$c61 = { type: "literal", value: "- ", description: "\"- \"" },
123
- peg$c62 = function(text) {return text.join("").trim()},
124
- peg$c63 = "- [x] ",
125
- peg$c64 = { type: "literal", value: "- [x] ", description: "\"- [x] \"" },
126
- peg$c65 = "- [ ] ",
127
- peg$c66 = { type: "literal", value: "- [ ] ", description: "\"- [ ] \"" },
128
- peg$c67 = " ",
129
- peg$c68 = { type: "literal", value: " ", description: "\" \"" },
130
- peg$c69 = ". ",
131
- peg$c70 = { type: "literal", value: ". ", description: "\". \"" },
132
- peg$c71 = function(lists) {
133
- return {
134
- lists: lists
135
- }
136
- },
137
- peg$c72 = function(tasks) {
138
- return {
139
- tasks: tasks
140
- }
141
- },
142
- peg$c73 = function(lists) {
143
- return {
144
- listsOrdered: lists
145
- }
146
- },
147
- peg$c74 = "html",
148
- peg$c75 = { type: "literal", value: "html", description: "\"html\"" },
149
- peg$c76 = "javascript",
150
- peg$c77 = { type: "literal", value: "javascript", description: "\"javascript\"" },
151
- peg$c78 = /^[`]/,
152
- peg$c79 = { type: "class", value: "[`]", description: "[`]" },
153
- peg$c80 = function(text) {return text.join("")},
154
- peg$c81 = "```",
155
- peg$c82 = { type: "literal", value: "```", description: "\"```\"" },
156
- peg$c83 = function(type, code) {
157
- return {
158
- code: code,
159
- type: type
160
- }
161
- },
162
- peg$c84 = /^[[]/,
163
- peg$c85 = { type: "class", value: "[[]", description: "[[]" },
164
- peg$c86 = /^[\]]/,
165
- peg$c87 = { type: "class", value: "[\\]]", description: "[\\]]" },
166
- peg$c88 = function() {return ""},
167
- peg$c89 = /^[(]/,
168
- peg$c90 = { type: "class", value: "[(]", description: "[(]" },
169
- peg$c91 = /^[)]/,
170
- peg$c92 = { type: "class", value: "[)]", description: "[)]" },
171
- peg$c93 = "",
172
- peg$c94 = function(title, href) {
173
- return {
174
- references: {
175
- title: title,
176
- href: href,
177
- image: isImage(href)
178
- }
179
- }
180
- },
181
- peg$c95 = /^[0-9a-f]/i,
182
- peg$c96 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" },
183
- peg$c97 = /^[\x80-\uFFFF]/,
184
- peg$c98 = { type: "class", value: "[\\x80-\\uFFFF]", description: "[\\x80-\\uFFFF]" },
185
- peg$c99 = "\\",
186
- peg$c100 = { type: "literal", value: "\\", description: "\"\\\\\"" },
187
- peg$c101 = /^[ \t\r\n\f]/,
188
- peg$c102 = { type: "class", value: "[ \\t\\r\\n\\f]", description: "[ \\t\\r\\n\\f]" },
189
- peg$c103 = function(digits) {
190
- return String.fromCharCode(parseInt(digits, 16));
191
- },
192
- peg$c104 = /^[^\r\n\f0-9a-f]/i,
193
- peg$c105 = { type: "class", value: "[^\\r\\n\\f0-9a-f]i", description: "[^\\r\\n\\f0-9a-f]i" },
194
- peg$c106 = function(ch) { return ch; },
195
- peg$c107 = /^[_a-z]/i,
196
- peg$c108 = { type: "class", value: "[_a-z]i", description: "[_a-z]i" },
197
- peg$c109 = /^[_a-z0-9\-]/i,
198
- peg$c110 = { type: "class", value: "[_a-z0-9\\-]i", description: "[_a-z0-9\\-]i" },
199
- peg$c111 = "\"",
200
- peg$c112 = { type: "literal", value: "\"", description: "\"\\\"\"" },
201
- peg$c113 = /^[^\n\r\f\\"]/,
202
- peg$c114 = { type: "class", value: "[^\\n\\r\\f\\\\\"]", description: "[^\\n\\r\\f\\\\\"]" },
203
- peg$c115 = function(nl) { return ""; },
204
- peg$c116 = function(chars) {
205
- return chars.join("");
206
- },
207
- peg$c117 = "'",
208
- peg$c118 = { type: "literal", value: "'", description: "\"'\"" },
209
- peg$c119 = /^[^\n\r\f\\']/,
210
- peg$c120 = { type: "class", value: "[^\\n\\r\\f\\\\']", description: "[^\\n\\r\\f\\\\']" },
211
- peg$c121 = /^[_a-zA-Z0-9\-\n]/,
212
- peg$c122 = { type: "class", value: "[_a-zA-Z0-9\\-\\n]", description: "[_a-zA-Z0-9\\-\\n]" },
213
- peg$c123 = function(chars) { return chars.join("")},
214
- peg$c124 = "/*",
215
- peg$c125 = { type: "literal", value: "/*", description: "\"/*\"" },
216
- peg$c126 = /^[^*]/,
217
- peg$c127 = { type: "class", value: "[^*]", description: "[^*]" },
218
- peg$c128 = "*",
219
- peg$c129 = { type: "literal", value: "*", description: "\"*\"" },
220
- peg$c130 = /^[^\/*]/,
221
- peg$c131 = { type: "class", value: "[^\\/*]", description: "[^\\/*]" },
222
- peg$c132 = "/",
223
- peg$c133 = { type: "literal", value: "/", description: "\"/\"" },
224
- peg$c134 = "-",
225
- peg$c135 = { type: "literal", value: "-", description: "\"-\"" },
226
- peg$c136 = function(prefix, start, chars) {
227
- return prefix + start + chars.join("");
228
- },
229
- peg$c137 = function(chars) { return chars.join(""); },
230
- peg$c138 = /^[+\-]/,
231
- peg$c139 = { type: "class", value: "[+\\-]", description: "[+\\-]" },
232
- peg$c140 = /^[0-9]/,
233
- peg$c141 = { type: "class", value: "[0-9]", description: "[0-9]" },
234
- peg$c142 = ".",
235
- peg$c143 = { type: "literal", value: ".", description: "\".\"" },
236
- peg$c144 = "e",
237
- peg$c145 = { type: "literal", value: "e", description: "\"e\"" },
238
- peg$c146 = function() {
239
- return parseFloat(text());
240
- },
241
- peg$c147 = /^[!#$%&*-[\]-~]/,
242
- peg$c148 = { type: "class", value: "[!#$%&*-[\\]-~]", description: "[!#$%&*-[\\]-~]" },
243
- peg$c149 = "\f",
244
- peg$c150 = { type: "literal", value: "\f", description: "\"\\f\"" },
245
-
246
- peg$currPos = 0,
247
- peg$reportedPos = 0,
248
- peg$cachedPos = 0,
249
- peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
250
- peg$maxFailPos = 0,
251
- peg$maxFailExpected = [],
252
- peg$silentFails = 0,
253
-
254
- peg$result;
255
-
256
- if ("startRule" in options) {
257
- if (!(options.startRule in peg$startRuleFunctions)) {
258
- throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
259
- }
260
-
261
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
262
- }
263
-
264
- function text() {
265
- return input.substring(peg$reportedPos, peg$currPos);
266
- }
267
-
268
- function offset() {
269
- return peg$reportedPos;
270
- }
271
-
272
- function line() {
273
- return peg$computePosDetails(peg$reportedPos).line;
274
- }
275
-
276
- function column() {
277
- return peg$computePosDetails(peg$reportedPos).column;
278
- }
279
-
280
- function expected(description) {
281
- throw peg$buildException(
282
- null,
283
- [{ type: "other", description: description }],
284
- peg$reportedPos
285
- );
286
- }
287
-
288
- function error(message) {
289
- throw peg$buildException(message, null, peg$reportedPos);
290
- }
291
-
292
- function peg$computePosDetails(pos) {
293
- function advance(details, startPos, endPos) {
294
- var p, ch;
295
-
296
- for (p = startPos; p < endPos; p++) {
297
- ch = input.charAt(p);
298
- if (ch === "\n") {
299
- if (!details.seenCR) { details.line++; }
300
- details.column = 1;
301
- details.seenCR = false;
302
- } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
303
- details.line++;
304
- details.column = 1;
305
- details.seenCR = true;
306
- } else {
307
- details.column++;
308
- details.seenCR = false;
309
- }
310
- }
311
- }
312
-
313
- if (peg$cachedPos !== pos) {
314
- if (peg$cachedPos > pos) {
315
- peg$cachedPos = 0;
316
- peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
317
- }
318
- advance(peg$cachedPosDetails, peg$cachedPos, pos);
319
- peg$cachedPos = pos;
320
- }
321
-
322
- return peg$cachedPosDetails;
323
- }
324
-
325
- function peg$fail(expected) {
326
- if (peg$currPos < peg$maxFailPos) { return; }
327
-
328
- if (peg$currPos > peg$maxFailPos) {
329
- peg$maxFailPos = peg$currPos;
330
- peg$maxFailExpected = [];
331
- }
332
-
333
- peg$maxFailExpected.push(expected);
334
- }
335
-
336
- function peg$buildException(message, expected, pos) {
337
- function cleanupExpected(expected) {
338
- var i = 1;
339
-
340
- expected.sort(function(a, b) {
341
- if (a.description < b.description) {
342
- return -1;
343
- } else if (a.description > b.description) {
344
- return 1;
345
- } else {
346
- return 0;
347
- }
348
- });
349
-
350
- while (i < expected.length) {
351
- if (expected[i - 1] === expected[i]) {
352
- expected.splice(i, 1);
353
- } else {
354
- i++;
355
- }
356
- }
357
- }
358
-
359
- function buildMessage(expected, found) {
360
- function stringEscape(s) {
361
- function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
362
-
363
- return s
364
- .replace(/\\/g, '\\\\')
365
- .replace(/"/g, '\\"')
366
- .replace(/\x08/g, '\\b')
367
- .replace(/\t/g, '\\t')
368
- .replace(/\n/g, '\\n')
369
- .replace(/\f/g, '\\f')
370
- .replace(/\r/g, '\\r')
371
- .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
372
- .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
373
- .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
374
- .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
375
- }
376
-
377
- var expectedDescs = new Array(expected.length),
378
- expectedDesc, foundDesc, i;
379
-
380
- for (i = 0; i < expected.length; i++) {
381
- expectedDescs[i] = expected[i].description;
382
- }
383
-
384
- expectedDesc = expected.length > 1
385
- ? expectedDescs.slice(0, -1).join(", ")
386
- + " or "
387
- + expectedDescs[expected.length - 1]
388
- : expectedDescs[0];
389
-
390
- foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
391
-
392
- return "Expected " + expectedDesc + " but " + foundDesc + " found.";
393
- }
394
-
395
- var posDetails = peg$computePosDetails(pos),
396
- found = pos < input.length ? input.charAt(pos) : null;
397
-
398
- if (expected !== null) {
399
- cleanupExpected(expected);
400
- }
401
-
402
- return new SyntaxError(
403
- message !== null ? message : buildMessage(expected, found),
404
- expected,
405
- found,
406
- pos,
407
- posDetails.line,
408
- posDetails.column
409
- );
410
- }
411
-
412
- function peg$parsestart() {
413
- var s0, s1, s2;
414
-
415
- s0 = peg$currPos;
416
- s1 = [];
417
- s2 = peg$parseMarkdown();
418
- if (s2 !== peg$FAILED) {
419
- while (s2 !== peg$FAILED) {
420
- s1.push(s2);
421
- s2 = peg$parseMarkdown();
422
- }
423
- } else {
424
- s1 = peg$c1;
425
- }
426
- if (s1 !== peg$FAILED) {
427
- peg$reportedPos = s0;
428
- s1 = peg$c2(s1);
429
- }
430
- s0 = s1;
431
-
432
- return s0;
433
- }
434
-
435
- function peg$parseMarkdown() {
436
- var s0;
437
-
438
- s0 = peg$parseEndOfLine();
439
- if (s0 === peg$FAILED) {
440
- s0 = peg$parseHeading();
441
- if (s0 === peg$FAILED) {
442
- s0 = peg$parseBold();
443
- if (s0 === peg$FAILED) {
444
- s0 = peg$parseItalic();
445
- if (s0 === peg$FAILED) {
446
- s0 = peg$parseStrikethrough();
447
- if (s0 === peg$FAILED) {
448
- s0 = peg$parseTasks();
449
- if (s0 === peg$FAILED) {
450
- s0 = peg$parseLists();
451
- if (s0 === peg$FAILED) {
452
- s0 = peg$parseOrderedLists();
453
- if (s0 === peg$FAILED) {
454
- s0 = peg$parseInlineCode();
455
- if (s0 === peg$FAILED) {
456
- s0 = peg$parseMultiplelLineCode();
457
- if (s0 === peg$FAILED) {
458
- s0 = peg$parseReferences();
459
- if (s0 === peg$FAILED) {
460
- s0 = peg$parseReferencesEmpty();
461
- if (s0 === peg$FAILED) {
462
- s0 = peg$parseSection();
463
- if (s0 === peg$FAILED) {
464
- s0 = peg$parseOthers();
465
- if (s0 === peg$FAILED) {
466
- s0 = peg$parseSpace();
467
- }
468
- }
469
- }
470
- }
471
- }
472
- }
473
- }
474
- }
475
- }
476
- }
477
- }
478
- }
479
- }
480
- }
481
-
482
- return s0;
483
- }
484
-
485
- function peg$parseDigit1_9() {
486
- var s0;
487
-
488
- if (peg$c3.test(input.charAt(peg$currPos))) {
489
- s0 = input.charAt(peg$currPos);
490
- peg$currPos++;
491
- } else {
492
- s0 = peg$FAILED;
493
- if (peg$silentFails === 0) { peg$fail(peg$c4); }
494
- }
495
-
496
- return s0;
497
- }
498
-
499
- function peg$parseEOF() {
500
- var s0, s1;
501
-
502
- s0 = peg$currPos;
503
- peg$silentFails++;
504
- if (input.length > peg$currPos) {
505
- s1 = input.charAt(peg$currPos);
506
- peg$currPos++;
507
- } else {
508
- s1 = peg$FAILED;
509
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
510
- }
511
- peg$silentFails--;
512
- if (s1 === peg$FAILED) {
513
- s0 = peg$c5;
514
- } else {
515
- peg$currPos = s0;
516
- s0 = peg$c1;
517
- }
518
-
519
- return s0;
520
- }
521
-
522
- function peg$parsecrlf() {
523
- var s0;
524
-
525
- if (input.substr(peg$currPos, 2) === peg$c7) {
526
- s0 = peg$c7;
527
- peg$currPos += 2;
528
- } else {
529
- s0 = peg$FAILED;
530
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
531
- }
532
- if (s0 === peg$FAILED) {
533
- if (input.charCodeAt(peg$currPos) === 13) {
534
- s0 = peg$c9;
535
- peg$currPos++;
536
- } else {
537
- s0 = peg$FAILED;
538
- if (peg$silentFails === 0) { peg$fail(peg$c10); }
539
- }
540
- if (s0 === peg$FAILED) {
541
- if (input.charCodeAt(peg$currPos) === 10) {
542
- s0 = peg$c11;
543
- peg$currPos++;
544
- } else {
545
- s0 = peg$FAILED;
546
- if (peg$silentFails === 0) { peg$fail(peg$c12); }
547
- }
548
- }
549
- }
550
-
551
- return s0;
552
- }
553
-
554
- function peg$parseEatLine() {
555
- var s0, s1, s2, s3, s4;
556
-
557
- s0 = [];
558
- s1 = peg$currPos;
559
- s2 = peg$currPos;
560
- peg$silentFails++;
561
- s3 = peg$parsecrlf();
562
- peg$silentFails--;
563
- if (s3 === peg$FAILED) {
564
- s2 = peg$c5;
565
- } else {
566
- peg$currPos = s2;
567
- s2 = peg$c1;
568
- }
569
- if (s2 !== peg$FAILED) {
570
- s3 = peg$currPos;
571
- peg$silentFails++;
572
- s4 = peg$parseEOF();
573
- peg$silentFails--;
574
- if (s4 === peg$FAILED) {
575
- s3 = peg$c5;
576
- } else {
577
- peg$currPos = s3;
578
- s3 = peg$c1;
579
- }
580
- if (s3 !== peg$FAILED) {
581
- if (input.length > peg$currPos) {
582
- s4 = input.charAt(peg$currPos);
583
- peg$currPos++;
584
- } else {
585
- s4 = peg$FAILED;
586
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
587
- }
588
- if (s4 !== peg$FAILED) {
589
- s2 = [s2, s3, s4];
590
- s1 = s2;
591
- } else {
592
- peg$currPos = s1;
593
- s1 = peg$c1;
594
- }
595
- } else {
596
- peg$currPos = s1;
597
- s1 = peg$c1;
598
- }
599
- } else {
600
- peg$currPos = s1;
601
- s1 = peg$c1;
602
- }
603
- while (s1 !== peg$FAILED) {
604
- s0.push(s1);
605
- s1 = peg$currPos;
606
- s2 = peg$currPos;
607
- peg$silentFails++;
608
- s3 = peg$parsecrlf();
609
- peg$silentFails--;
610
- if (s3 === peg$FAILED) {
611
- s2 = peg$c5;
612
- } else {
613
- peg$currPos = s2;
614
- s2 = peg$c1;
615
- }
616
- if (s2 !== peg$FAILED) {
617
- s3 = peg$currPos;
618
- peg$silentFails++;
619
- s4 = peg$parseEOF();
620
- peg$silentFails--;
621
- if (s4 === peg$FAILED) {
622
- s3 = peg$c5;
623
- } else {
624
- peg$currPos = s3;
625
- s3 = peg$c1;
626
- }
627
- if (s3 !== peg$FAILED) {
628
- if (input.length > peg$currPos) {
629
- s4 = input.charAt(peg$currPos);
630
- peg$currPos++;
631
- } else {
632
- s4 = peg$FAILED;
633
- if (peg$silentFails === 0) { peg$fail(peg$c6); }
634
- }
635
- if (s4 !== peg$FAILED) {
636
- s2 = [s2, s3, s4];
637
- s1 = s2;
638
- } else {
639
- peg$currPos = s1;
640
- s1 = peg$c1;
641
- }
642
- } else {
643
- peg$currPos = s1;
644
- s1 = peg$c1;
645
- }
646
- } else {
647
- peg$currPos = s1;
648
- s1 = peg$c1;
649
- }
650
- }
651
-
652
- return s0;
653
- }
654
-
655
- function peg$parseEndOfLine() {
656
- var s0, s1;
657
-
658
- s0 = [];
659
- if (input.substr(peg$currPos, 2) === peg$c7) {
660
- s1 = peg$c7;
661
- peg$currPos += 2;
662
- } else {
663
- s1 = peg$FAILED;
664
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
665
- }
666
- if (s1 === peg$FAILED) {
667
- if (input.charCodeAt(peg$currPos) === 10) {
668
- s1 = peg$c11;
669
- peg$currPos++;
670
- } else {
671
- s1 = peg$FAILED;
672
- if (peg$silentFails === 0) { peg$fail(peg$c12); }
673
- }
674
- if (s1 === peg$FAILED) {
675
- if (input.charCodeAt(peg$currPos) === 13) {
676
- s1 = peg$c9;
677
- peg$currPos++;
678
- } else {
679
- s1 = peg$FAILED;
680
- if (peg$silentFails === 0) { peg$fail(peg$c10); }
681
- }
682
- }
683
- }
684
- if (s1 !== peg$FAILED) {
685
- while (s1 !== peg$FAILED) {
686
- s0.push(s1);
687
- if (input.substr(peg$currPos, 2) === peg$c7) {
688
- s1 = peg$c7;
689
- peg$currPos += 2;
690
- } else {
691
- s1 = peg$FAILED;
692
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
693
- }
694
- if (s1 === peg$FAILED) {
695
- if (input.charCodeAt(peg$currPos) === 10) {
696
- s1 = peg$c11;
697
- peg$currPos++;
698
- } else {
699
- s1 = peg$FAILED;
700
- if (peg$silentFails === 0) { peg$fail(peg$c12); }
701
- }
702
- if (s1 === peg$FAILED) {
703
- if (input.charCodeAt(peg$currPos) === 13) {
704
- s1 = peg$c9;
705
- peg$currPos++;
706
- } else {
707
- s1 = peg$FAILED;
708
- if (peg$silentFails === 0) { peg$fail(peg$c10); }
709
- }
710
- }
711
- }
712
- }
713
- } else {
714
- s0 = peg$c1;
715
- }
716
-
717
- return s0;
718
- }
719
-
720
- function peg$parseSpace() {
721
- var s0, s1;
722
-
723
- s0 = [];
724
- if (input.charCodeAt(peg$currPos) === 32) {
725
- s1 = peg$c13;
726
- peg$currPos++;
727
- } else {
728
- s1 = peg$FAILED;
729
- if (peg$silentFails === 0) { peg$fail(peg$c14); }
730
- }
731
- if (s1 !== peg$FAILED) {
732
- while (s1 !== peg$FAILED) {
733
- s0.push(s1);
734
- if (input.charCodeAt(peg$currPos) === 32) {
735
- s1 = peg$c13;
736
- peg$currPos++;
737
- } else {
738
- s1 = peg$FAILED;
739
- if (peg$silentFails === 0) { peg$fail(peg$c14); }
740
- }
741
- }
742
- } else {
743
- s0 = peg$c1;
744
- }
745
- if (s0 === peg$FAILED) {
746
- if (input.charCodeAt(peg$currPos) === 9) {
747
- s0 = peg$c15;
748
- peg$currPos++;
749
- } else {
750
- s0 = peg$FAILED;
751
- if (peg$silentFails === 0) { peg$fail(peg$c16); }
752
- }
753
- if (s0 === peg$FAILED) {
754
- s0 = peg$parseEndOfLine();
755
- }
756
- }
757
-
758
- return s0;
759
- }
760
-
761
- function peg$parseAnyText() {
762
- var s0;
763
-
764
- if (peg$c17.test(input.charAt(peg$currPos))) {
765
- s0 = input.charAt(peg$currPos);
766
- peg$currPos++;
767
- } else {
768
- s0 = peg$FAILED;
769
- if (peg$silentFails === 0) { peg$fail(peg$c18); }
770
- }
771
- if (s0 === peg$FAILED) {
772
- if (peg$c19.test(input.charAt(peg$currPos))) {
773
- s0 = input.charAt(peg$currPos);
774
- peg$currPos++;
775
- } else {
776
- s0 = peg$FAILED;
777
- if (peg$silentFails === 0) { peg$fail(peg$c20); }
778
- }
779
- if (s0 === peg$FAILED) {
780
- if (peg$c21.test(input.charAt(peg$currPos))) {
781
- s0 = input.charAt(peg$currPos);
782
- peg$currPos++;
783
- } else {
784
- s0 = peg$FAILED;
785
- if (peg$silentFails === 0) { peg$fail(peg$c22); }
786
- }
787
- if (s0 === peg$FAILED) {
788
- if (peg$c23.test(input.charAt(peg$currPos))) {
789
- s0 = input.charAt(peg$currPos);
790
- peg$currPos++;
791
- } else {
792
- s0 = peg$FAILED;
793
- if (peg$silentFails === 0) { peg$fail(peg$c24); }
794
- }
795
- if (s0 === peg$FAILED) {
796
- s0 = peg$parsenonascii();
797
- }
798
- }
799
- }
800
- }
801
-
802
- return s0;
803
- }
804
-
805
- function peg$parseListText() {
806
- var s0;
807
-
808
- if (peg$c17.test(input.charAt(peg$currPos))) {
809
- s0 = input.charAt(peg$currPos);
810
- peg$currPos++;
811
- } else {
812
- s0 = peg$FAILED;
813
- if (peg$silentFails === 0) { peg$fail(peg$c18); }
814
- }
815
- if (s0 === peg$FAILED) {
816
- if (peg$c19.test(input.charAt(peg$currPos))) {
817
- s0 = input.charAt(peg$currPos);
818
- peg$currPos++;
819
- } else {
820
- s0 = peg$FAILED;
821
- if (peg$silentFails === 0) { peg$fail(peg$c20); }
822
- }
823
- if (s0 === peg$FAILED) {
824
- if (peg$c21.test(input.charAt(peg$currPos))) {
825
- s0 = input.charAt(peg$currPos);
826
- peg$currPos++;
827
- } else {
828
- s0 = peg$FAILED;
829
- if (peg$silentFails === 0) { peg$fail(peg$c22); }
830
- }
831
- if (s0 === peg$FAILED) {
832
- if (peg$c25.test(input.charAt(peg$currPos))) {
833
- s0 = input.charAt(peg$currPos);
834
- peg$currPos++;
835
- } else {
836
- s0 = peg$FAILED;
837
- if (peg$silentFails === 0) { peg$fail(peg$c26); }
838
- }
839
- if (s0 === peg$FAILED) {
840
- s0 = peg$parsenonascii();
841
- }
842
- }
843
- }
844
- }
845
-
846
- return s0;
847
- }
848
-
849
- function peg$parseLinkText() {
850
- var s0;
851
-
852
- if (peg$c27.test(input.charAt(peg$currPos))) {
853
- s0 = input.charAt(peg$currPos);
854
- peg$currPos++;
855
- } else {
856
- s0 = peg$FAILED;
857
- if (peg$silentFails === 0) { peg$fail(peg$c28); }
858
- }
859
- if (s0 === peg$FAILED) {
860
- if (peg$c19.test(input.charAt(peg$currPos))) {
861
- s0 = input.charAt(peg$currPos);
862
- peg$currPos++;
863
- } else {
864
- s0 = peg$FAILED;
865
- if (peg$silentFails === 0) { peg$fail(peg$c20); }
866
- }
867
- if (s0 === peg$FAILED) {
868
- if (peg$c29.test(input.charAt(peg$currPos))) {
869
- s0 = input.charAt(peg$currPos);
870
- peg$currPos++;
871
- } else {
872
- s0 = peg$FAILED;
873
- if (peg$silentFails === 0) { peg$fail(peg$c30); }
874
- }
875
- if (s0 === peg$FAILED) {
876
- if (peg$c23.test(input.charAt(peg$currPos))) {
877
- s0 = input.charAt(peg$currPos);
878
- peg$currPos++;
879
- } else {
880
- s0 = peg$FAILED;
881
- if (peg$silentFails === 0) { peg$fail(peg$c24); }
882
- }
883
- if (s0 === peg$FAILED) {
884
- s0 = peg$parsenonascii();
885
- }
886
- }
887
- }
888
- }
889
-
890
- return s0;
891
- }
892
-
893
- function peg$parseCodeText() {
894
- var s0;
895
-
896
- if (peg$c27.test(input.charAt(peg$currPos))) {
897
- s0 = input.charAt(peg$currPos);
898
- peg$currPos++;
899
- } else {
900
- s0 = peg$FAILED;
901
- if (peg$silentFails === 0) { peg$fail(peg$c28); }
902
- }
903
- if (s0 === peg$FAILED) {
904
- if (peg$c19.test(input.charAt(peg$currPos))) {
905
- s0 = input.charAt(peg$currPos);
906
- peg$currPos++;
907
- } else {
908
- s0 = peg$FAILED;
909
- if (peg$silentFails === 0) { peg$fail(peg$c20); }
910
- }
911
- if (s0 === peg$FAILED) {
912
- if (peg$c31.test(input.charAt(peg$currPos))) {
913
- s0 = input.charAt(peg$currPos);
914
- peg$currPos++;
915
- } else {
916
- s0 = peg$FAILED;
917
- if (peg$silentFails === 0) { peg$fail(peg$c32); }
918
- }
919
- if (s0 === peg$FAILED) {
920
- if (peg$c33.test(input.charAt(peg$currPos))) {
921
- s0 = input.charAt(peg$currPos);
922
- peg$currPos++;
923
- } else {
924
- s0 = peg$FAILED;
925
- if (peg$silentFails === 0) { peg$fail(peg$c34); }
926
- }
927
- if (s0 === peg$FAILED) {
928
- s0 = peg$parsenonascii();
929
- if (s0 === peg$FAILED) {
930
- s0 = peg$parseEndOfLine();
931
- if (s0 === peg$FAILED) {
932
- s0 = peg$parseSpace();
933
- }
934
- }
935
- }
936
- }
937
- }
938
- }
939
-
940
- return s0;
941
- }
942
-
943
- function peg$parseAnyText2() {
944
- var s0;
945
-
946
- if (peg$c35.test(input.charAt(peg$currPos))) {
947
- s0 = input.charAt(peg$currPos);
948
- peg$currPos++;
949
- } else {
950
- s0 = peg$FAILED;
951
- if (peg$silentFails === 0) { peg$fail(peg$c36); }
952
- }
953
- if (s0 === peg$FAILED) {
954
- if (peg$c37.test(input.charAt(peg$currPos))) {
955
- s0 = input.charAt(peg$currPos);
956
- peg$currPos++;
957
- } else {
958
- s0 = peg$FAILED;
959
- if (peg$silentFails === 0) { peg$fail(peg$c38); }
960
- }
961
- if (s0 === peg$FAILED) {
962
- if (peg$c39.test(input.charAt(peg$currPos))) {
963
- s0 = input.charAt(peg$currPos);
964
- peg$currPos++;
965
- } else {
966
- s0 = peg$FAILED;
967
- if (peg$silentFails === 0) { peg$fail(peg$c40); }
968
- }
969
- if (s0 === peg$FAILED) {
970
- s0 = peg$parsenonascii();
971
- }
972
- }
973
- }
974
-
975
- return s0;
976
- }
977
-
978
- function peg$parseSectionText() {
979
- var s0, s1;
980
-
981
- s0 = [];
982
- if (peg$c41.test(input.charAt(peg$currPos))) {
983
- s1 = input.charAt(peg$currPos);
984
- peg$currPos++;
985
- } else {
986
- s1 = peg$FAILED;
987
- if (peg$silentFails === 0) { peg$fail(peg$c42); }
988
- }
989
- if (s1 !== peg$FAILED) {
990
- while (s1 !== peg$FAILED) {
991
- s0.push(s1);
992
- if (peg$c41.test(input.charAt(peg$currPos))) {
993
- s1 = input.charAt(peg$currPos);
994
- peg$currPos++;
995
- } else {
996
- s1 = peg$FAILED;
997
- if (peg$silentFails === 0) { peg$fail(peg$c42); }
998
- }
999
- }
1000
- } else {
1001
- s0 = peg$c1;
1002
- }
1003
- if (s0 === peg$FAILED) {
1004
- if (peg$c35.test(input.charAt(peg$currPos))) {
1005
- s0 = input.charAt(peg$currPos);
1006
- peg$currPos++;
1007
- } else {
1008
- s0 = peg$FAILED;
1009
- if (peg$silentFails === 0) { peg$fail(peg$c36); }
1010
- }
1011
- if (s0 === peg$FAILED) {
1012
- if (peg$c37.test(input.charAt(peg$currPos))) {
1013
- s0 = input.charAt(peg$currPos);
1014
- peg$currPos++;
1015
- } else {
1016
- s0 = peg$FAILED;
1017
- if (peg$silentFails === 0) { peg$fail(peg$c38); }
1018
- }
1019
- if (s0 === peg$FAILED) {
1020
- if (peg$c23.test(input.charAt(peg$currPos))) {
1021
- s0 = input.charAt(peg$currPos);
1022
- peg$currPos++;
1023
- } else {
1024
- s0 = peg$FAILED;
1025
- if (peg$silentFails === 0) { peg$fail(peg$c24); }
1026
- }
1027
- if (s0 === peg$FAILED) {
1028
- s0 = peg$parsenonascii();
1029
- }
1030
- }
1031
- }
1032
- }
1033
-
1034
- return s0;
1035
- }
1036
-
1037
- function peg$parseOthers() {
1038
- var s0, s1, s2, s3;
1039
-
1040
- s0 = peg$currPos;
1041
- s1 = peg$parseSpace();
1042
- if (s1 === peg$FAILED) {
1043
- s1 = peg$c43;
1044
- }
1045
- if (s1 !== peg$FAILED) {
1046
- s2 = [];
1047
- s3 = peg$parseAnyText2();
1048
- if (s3 !== peg$FAILED) {
1049
- while (s3 !== peg$FAILED) {
1050
- s2.push(s3);
1051
- s3 = peg$parseAnyText2();
1052
- }
1053
- } else {
1054
- s2 = peg$c1;
1055
- }
1056
- if (s2 !== peg$FAILED) {
1057
- s3 = peg$parseSpace();
1058
- if (s3 === peg$FAILED) {
1059
- s3 = peg$c43;
1060
- }
1061
- if (s3 !== peg$FAILED) {
1062
- peg$reportedPos = s0;
1063
- s1 = peg$c44(s2);
1064
- s0 = s1;
1065
- } else {
1066
- peg$currPos = s0;
1067
- s0 = peg$c1;
1068
- }
1069
- } else {
1070
- peg$currPos = s0;
1071
- s0 = peg$c1;
1072
- }
1073
- } else {
1074
- peg$currPos = s0;
1075
- s0 = peg$c1;
1076
- }
1077
-
1078
- return s0;
1079
- }
1080
-
1081
- function peg$parseHeading() {
1082
- var s0, s1, s2, s3;
1083
-
1084
- s0 = peg$currPos;
1085
- s1 = [];
1086
- if (input.charCodeAt(peg$currPos) === 35) {
1087
- s2 = peg$c45;
1088
- peg$currPos++;
1089
- } else {
1090
- s2 = peg$FAILED;
1091
- if (peg$silentFails === 0) { peg$fail(peg$c46); }
1092
- }
1093
- if (s2 !== peg$FAILED) {
1094
- while (s2 !== peg$FAILED) {
1095
- s1.push(s2);
1096
- if (input.charCodeAt(peg$currPos) === 35) {
1097
- s2 = peg$c45;
1098
- peg$currPos++;
1099
- } else {
1100
- s2 = peg$FAILED;
1101
- if (peg$silentFails === 0) { peg$fail(peg$c46); }
1102
- }
1103
- }
1104
- } else {
1105
- s1 = peg$c1;
1106
- }
1107
- if (s1 !== peg$FAILED) {
1108
- s2 = [];
1109
- s3 = peg$parseAnyText();
1110
- if (s3 !== peg$FAILED) {
1111
- while (s3 !== peg$FAILED) {
1112
- s2.push(s3);
1113
- s3 = peg$parseAnyText();
1114
- }
1115
- } else {
1116
- s2 = peg$c1;
1117
- }
1118
- if (s2 !== peg$FAILED) {
1119
- s3 = peg$parseSpace();
1120
- if (s3 === peg$FAILED) {
1121
- s3 = peg$c43;
1122
- }
1123
- if (s3 !== peg$FAILED) {
1124
- peg$reportedPos = s0;
1125
- s1 = peg$c47(s2);
1126
- s0 = s1;
1127
- } else {
1128
- peg$currPos = s0;
1129
- s0 = peg$c1;
1130
- }
1131
- } else {
1132
- peg$currPos = s0;
1133
- s0 = peg$c1;
1134
- }
1135
- } else {
1136
- peg$currPos = s0;
1137
- s0 = peg$c1;
1138
- }
1139
-
1140
- return s0;
1141
- }
1142
-
1143
- function peg$parseSection() {
1144
- var s0, s1, s2, s3, s4;
1145
-
1146
- s0 = peg$currPos;
1147
- s1 = [];
1148
- s2 = peg$parseSectionText();
1149
- if (s2 !== peg$FAILED) {
1150
- while (s2 !== peg$FAILED) {
1151
- s1.push(s2);
1152
- s2 = peg$parseSectionText();
1153
- }
1154
- } else {
1155
- s1 = peg$c1;
1156
- }
1157
- if (s1 !== peg$FAILED) {
1158
- if (input.substr(peg$currPos, 2) === peg$c7) {
1159
- s2 = peg$c7;
1160
- peg$currPos += 2;
1161
- } else {
1162
- s2 = peg$FAILED;
1163
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
1164
- }
1165
- if (s2 === peg$FAILED) {
1166
- if (input.charCodeAt(peg$currPos) === 10) {
1167
- s2 = peg$c11;
1168
- peg$currPos++;
1169
- } else {
1170
- s2 = peg$FAILED;
1171
- if (peg$silentFails === 0) { peg$fail(peg$c12); }
1172
- }
1173
- if (s2 === peg$FAILED) {
1174
- if (input.charCodeAt(peg$currPos) === 13) {
1175
- s2 = peg$c9;
1176
- peg$currPos++;
1177
- } else {
1178
- s2 = peg$FAILED;
1179
- if (peg$silentFails === 0) { peg$fail(peg$c10); }
1180
- }
1181
- }
1182
- }
1183
- if (s2 !== peg$FAILED) {
1184
- s3 = [];
1185
- if (peg$c41.test(input.charAt(peg$currPos))) {
1186
- s4 = input.charAt(peg$currPos);
1187
- peg$currPos++;
1188
- } else {
1189
- s4 = peg$FAILED;
1190
- if (peg$silentFails === 0) { peg$fail(peg$c42); }
1191
- }
1192
- if (s4 !== peg$FAILED) {
1193
- while (s4 !== peg$FAILED) {
1194
- s3.push(s4);
1195
- if (peg$c41.test(input.charAt(peg$currPos))) {
1196
- s4 = input.charAt(peg$currPos);
1197
- peg$currPos++;
1198
- } else {
1199
- s4 = peg$FAILED;
1200
- if (peg$silentFails === 0) { peg$fail(peg$c42); }
1201
- }
1202
- }
1203
- } else {
1204
- s3 = peg$c1;
1205
- }
1206
- if (s3 !== peg$FAILED) {
1207
- s4 = peg$parseEndOfLine();
1208
- if (s4 === peg$FAILED) {
1209
- s4 = peg$c43;
1210
- }
1211
- if (s4 !== peg$FAILED) {
1212
- peg$reportedPos = s0;
1213
- s1 = peg$c48(s1);
1214
- s0 = s1;
1215
- } else {
1216
- peg$currPos = s0;
1217
- s0 = peg$c1;
1218
- }
1219
- } else {
1220
- peg$currPos = s0;
1221
- s0 = peg$c1;
1222
- }
1223
- } else {
1224
- peg$currPos = s0;
1225
- s0 = peg$c1;
1226
- }
1227
- } else {
1228
- peg$currPos = s0;
1229
- s0 = peg$c1;
1230
- }
1231
-
1232
- return s0;
1233
- }
1234
-
1235
- function peg$parseItalic() {
1236
- var s0, s1, s2, s3, s4, s5;
1237
-
1238
- s0 = peg$currPos;
1239
- s1 = [];
1240
- s2 = peg$parseAnyText();
1241
- if (s2 !== peg$FAILED) {
1242
- while (s2 !== peg$FAILED) {
1243
- s1.push(s2);
1244
- s2 = peg$parseAnyText();
1245
- }
1246
- } else {
1247
- s1 = peg$c1;
1248
- }
1249
- if (s1 === peg$FAILED) {
1250
- s1 = peg$c43;
1251
- }
1252
- if (s1 !== peg$FAILED) {
1253
- if (peg$c49.test(input.charAt(peg$currPos))) {
1254
- s2 = input.charAt(peg$currPos);
1255
- peg$currPos++;
1256
- } else {
1257
- s2 = peg$FAILED;
1258
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
1259
- }
1260
- if (s2 !== peg$FAILED) {
1261
- s3 = [];
1262
- s4 = peg$parseAnyText();
1263
- if (s4 !== peg$FAILED) {
1264
- while (s4 !== peg$FAILED) {
1265
- s3.push(s4);
1266
- s4 = peg$parseAnyText();
1267
- }
1268
- } else {
1269
- s3 = peg$c1;
1270
- }
1271
- if (s3 !== peg$FAILED) {
1272
- if (peg$c49.test(input.charAt(peg$currPos))) {
1273
- s4 = input.charAt(peg$currPos);
1274
- peg$currPos++;
1275
- } else {
1276
- s4 = peg$FAILED;
1277
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
1278
- }
1279
- if (s4 !== peg$FAILED) {
1280
- s5 = peg$parseSpace();
1281
- if (s5 === peg$FAILED) {
1282
- s5 = peg$c43;
1283
- }
1284
- if (s5 !== peg$FAILED) {
1285
- peg$reportedPos = s0;
1286
- s1 = peg$c51(s3);
1287
- s0 = s1;
1288
- } else {
1289
- peg$currPos = s0;
1290
- s0 = peg$c1;
1291
- }
1292
- } else {
1293
- peg$currPos = s0;
1294
- s0 = peg$c1;
1295
- }
1296
- } else {
1297
- peg$currPos = s0;
1298
- s0 = peg$c1;
1299
- }
1300
- } else {
1301
- peg$currPos = s0;
1302
- s0 = peg$c1;
1303
- }
1304
- } else {
1305
- peg$currPos = s0;
1306
- s0 = peg$c1;
1307
- }
1308
-
1309
- return s0;
1310
- }
1311
-
1312
- function peg$parseBold() {
1313
- var s0, s1, s2, s3, s4, s5, s6;
1314
-
1315
- s0 = peg$currPos;
1316
- s1 = [];
1317
- s2 = peg$parseAnyText();
1318
- if (s2 !== peg$FAILED) {
1319
- while (s2 !== peg$FAILED) {
1320
- s1.push(s2);
1321
- s2 = peg$parseAnyText();
1322
- }
1323
- } else {
1324
- s1 = peg$c1;
1325
- }
1326
- if (s1 === peg$FAILED) {
1327
- s1 = peg$c43;
1328
- }
1329
- if (s1 !== peg$FAILED) {
1330
- s2 = peg$currPos;
1331
- if (peg$c49.test(input.charAt(peg$currPos))) {
1332
- s3 = input.charAt(peg$currPos);
1333
- peg$currPos++;
1334
- } else {
1335
- s3 = peg$FAILED;
1336
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
1337
- }
1338
- if (s3 !== peg$FAILED) {
1339
- if (peg$c49.test(input.charAt(peg$currPos))) {
1340
- s4 = input.charAt(peg$currPos);
1341
- peg$currPos++;
1342
- } else {
1343
- s4 = peg$FAILED;
1344
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
1345
- }
1346
- if (s4 !== peg$FAILED) {
1347
- s3 = [s3, s4];
1348
- s2 = s3;
1349
- } else {
1350
- peg$currPos = s2;
1351
- s2 = peg$c1;
1352
- }
1353
- } else {
1354
- peg$currPos = s2;
1355
- s2 = peg$c1;
1356
- }
1357
- if (s2 === peg$FAILED) {
1358
- s2 = peg$currPos;
1359
- if (peg$c52.test(input.charAt(peg$currPos))) {
1360
- s3 = input.charAt(peg$currPos);
1361
- peg$currPos++;
1362
- } else {
1363
- s3 = peg$FAILED;
1364
- if (peg$silentFails === 0) { peg$fail(peg$c53); }
1365
- }
1366
- if (s3 !== peg$FAILED) {
1367
- if (peg$c52.test(input.charAt(peg$currPos))) {
1368
- s4 = input.charAt(peg$currPos);
1369
- peg$currPos++;
1370
- } else {
1371
- s4 = peg$FAILED;
1372
- if (peg$silentFails === 0) { peg$fail(peg$c53); }
1373
- }
1374
- if (s4 !== peg$FAILED) {
1375
- s3 = [s3, s4];
1376
- s2 = s3;
1377
- } else {
1378
- peg$currPos = s2;
1379
- s2 = peg$c1;
1380
- }
1381
- } else {
1382
- peg$currPos = s2;
1383
- s2 = peg$c1;
1384
- }
1385
- }
1386
- if (s2 !== peg$FAILED) {
1387
- s3 = [];
1388
- s4 = peg$parseAnyText();
1389
- if (s4 !== peg$FAILED) {
1390
- while (s4 !== peg$FAILED) {
1391
- s3.push(s4);
1392
- s4 = peg$parseAnyText();
1393
- }
1394
- } else {
1395
- s3 = peg$c1;
1396
- }
1397
- if (s3 !== peg$FAILED) {
1398
- s4 = peg$currPos;
1399
- if (peg$c49.test(input.charAt(peg$currPos))) {
1400
- s5 = input.charAt(peg$currPos);
1401
- peg$currPos++;
1402
- } else {
1403
- s5 = peg$FAILED;
1404
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
1405
- }
1406
- if (s5 !== peg$FAILED) {
1407
- if (peg$c49.test(input.charAt(peg$currPos))) {
1408
- s6 = input.charAt(peg$currPos);
1409
- peg$currPos++;
1410
- } else {
1411
- s6 = peg$FAILED;
1412
- if (peg$silentFails === 0) { peg$fail(peg$c50); }
1413
- }
1414
- if (s6 !== peg$FAILED) {
1415
- s5 = [s5, s6];
1416
- s4 = s5;
1417
- } else {
1418
- peg$currPos = s4;
1419
- s4 = peg$c1;
1420
- }
1421
- } else {
1422
- peg$currPos = s4;
1423
- s4 = peg$c1;
1424
- }
1425
- if (s4 === peg$FAILED) {
1426
- s4 = peg$currPos;
1427
- if (peg$c52.test(input.charAt(peg$currPos))) {
1428
- s5 = input.charAt(peg$currPos);
1429
- peg$currPos++;
1430
- } else {
1431
- s5 = peg$FAILED;
1432
- if (peg$silentFails === 0) { peg$fail(peg$c53); }
1433
- }
1434
- if (s5 !== peg$FAILED) {
1435
- if (peg$c52.test(input.charAt(peg$currPos))) {
1436
- s6 = input.charAt(peg$currPos);
1437
- peg$currPos++;
1438
- } else {
1439
- s6 = peg$FAILED;
1440
- if (peg$silentFails === 0) { peg$fail(peg$c53); }
1441
- }
1442
- if (s6 !== peg$FAILED) {
1443
- s5 = [s5, s6];
1444
- s4 = s5;
1445
- } else {
1446
- peg$currPos = s4;
1447
- s4 = peg$c1;
1448
- }
1449
- } else {
1450
- peg$currPos = s4;
1451
- s4 = peg$c1;
1452
- }
1453
- }
1454
- if (s4 !== peg$FAILED) {
1455
- s5 = peg$parseSpace();
1456
- if (s5 === peg$FAILED) {
1457
- s5 = peg$c43;
1458
- }
1459
- if (s5 !== peg$FAILED) {
1460
- peg$reportedPos = s0;
1461
- s1 = peg$c54(s3);
1462
- s0 = s1;
1463
- } else {
1464
- peg$currPos = s0;
1465
- s0 = peg$c1;
1466
- }
1467
- } else {
1468
- peg$currPos = s0;
1469
- s0 = peg$c1;
1470
- }
1471
- } else {
1472
- peg$currPos = s0;
1473
- s0 = peg$c1;
1474
- }
1475
- } else {
1476
- peg$currPos = s0;
1477
- s0 = peg$c1;
1478
- }
1479
- } else {
1480
- peg$currPos = s0;
1481
- s0 = peg$c1;
1482
- }
1483
-
1484
- return s0;
1485
- }
1486
-
1487
- function peg$parseStrikethrough() {
1488
- var s0, s1, s2, s3, s4, s5, s6;
1489
-
1490
- s0 = peg$currPos;
1491
- if (peg$c55.test(input.charAt(peg$currPos))) {
1492
- s1 = input.charAt(peg$currPos);
1493
- peg$currPos++;
1494
- } else {
1495
- s1 = peg$FAILED;
1496
- if (peg$silentFails === 0) { peg$fail(peg$c56); }
1497
- }
1498
- if (s1 !== peg$FAILED) {
1499
- if (peg$c55.test(input.charAt(peg$currPos))) {
1500
- s2 = input.charAt(peg$currPos);
1501
- peg$currPos++;
1502
- } else {
1503
- s2 = peg$FAILED;
1504
- if (peg$silentFails === 0) { peg$fail(peg$c56); }
1505
- }
1506
- if (s2 !== peg$FAILED) {
1507
- s3 = [];
1508
- s4 = peg$parseAnyText();
1509
- if (s4 !== peg$FAILED) {
1510
- while (s4 !== peg$FAILED) {
1511
- s3.push(s4);
1512
- s4 = peg$parseAnyText();
1513
- }
1514
- } else {
1515
- s3 = peg$c1;
1516
- }
1517
- if (s3 !== peg$FAILED) {
1518
- if (peg$c55.test(input.charAt(peg$currPos))) {
1519
- s4 = input.charAt(peg$currPos);
1520
- peg$currPos++;
1521
- } else {
1522
- s4 = peg$FAILED;
1523
- if (peg$silentFails === 0) { peg$fail(peg$c56); }
1524
- }
1525
- if (s4 !== peg$FAILED) {
1526
- if (peg$c55.test(input.charAt(peg$currPos))) {
1527
- s5 = input.charAt(peg$currPos);
1528
- peg$currPos++;
1529
- } else {
1530
- s5 = peg$FAILED;
1531
- if (peg$silentFails === 0) { peg$fail(peg$c56); }
1532
- }
1533
- if (s5 !== peg$FAILED) {
1534
- s6 = peg$parseSpace();
1535
- if (s6 === peg$FAILED) {
1536
- s6 = peg$c43;
1537
- }
1538
- if (s6 !== peg$FAILED) {
1539
- peg$reportedPos = s0;
1540
- s1 = peg$c57(s3);
1541
- s0 = s1;
1542
- } else {
1543
- peg$currPos = s0;
1544
- s0 = peg$c1;
1545
- }
1546
- } else {
1547
- peg$currPos = s0;
1548
- s0 = peg$c1;
1549
- }
1550
- } else {
1551
- peg$currPos = s0;
1552
- s0 = peg$c1;
1553
- }
1554
- } else {
1555
- peg$currPos = s0;
1556
- s0 = peg$c1;
1557
- }
1558
- } else {
1559
- peg$currPos = s0;
1560
- s0 = peg$c1;
1561
- }
1562
- } else {
1563
- peg$currPos = s0;
1564
- s0 = peg$c1;
1565
- }
1566
-
1567
- return s0;
1568
- }
1569
-
1570
- function peg$parseListItem() {
1571
- var s0, s1, s2, s3;
1572
-
1573
- s0 = peg$currPos;
1574
- if (input.substr(peg$currPos, 2) === peg$c58) {
1575
- s1 = peg$c58;
1576
- peg$currPos += 2;
1577
- } else {
1578
- s1 = peg$FAILED;
1579
- if (peg$silentFails === 0) { peg$fail(peg$c59); }
1580
- }
1581
- if (s1 === peg$FAILED) {
1582
- if (input.substr(peg$currPos, 2) === peg$c60) {
1583
- s1 = peg$c60;
1584
- peg$currPos += 2;
1585
- } else {
1586
- s1 = peg$FAILED;
1587
- if (peg$silentFails === 0) { peg$fail(peg$c61); }
1588
- }
1589
- }
1590
- if (s1 !== peg$FAILED) {
1591
- s2 = [];
1592
- s3 = peg$parseListText();
1593
- if (s3 !== peg$FAILED) {
1594
- while (s3 !== peg$FAILED) {
1595
- s2.push(s3);
1596
- s3 = peg$parseListText();
1597
- }
1598
- } else {
1599
- s2 = peg$c1;
1600
- }
1601
- if (s2 !== peg$FAILED) {
1602
- s3 = peg$parseSpace();
1603
- if (s3 === peg$FAILED) {
1604
- s3 = peg$c43;
1605
- }
1606
- if (s3 !== peg$FAILED) {
1607
- peg$reportedPos = s0;
1608
- s1 = peg$c62(s2);
1609
- s0 = s1;
1610
- } else {
1611
- peg$currPos = s0;
1612
- s0 = peg$c1;
1613
- }
1614
- } else {
1615
- peg$currPos = s0;
1616
- s0 = peg$c1;
1617
- }
1618
- } else {
1619
- peg$currPos = s0;
1620
- s0 = peg$c1;
1621
- }
1622
-
1623
- return s0;
1624
- }
1625
-
1626
- function peg$parseTaskItem() {
1627
- var s0, s1, s2, s3;
1628
-
1629
- s0 = peg$currPos;
1630
- if (input.substr(peg$currPos, 6) === peg$c63) {
1631
- s1 = peg$c63;
1632
- peg$currPos += 6;
1633
- } else {
1634
- s1 = peg$FAILED;
1635
- if (peg$silentFails === 0) { peg$fail(peg$c64); }
1636
- }
1637
- if (s1 === peg$FAILED) {
1638
- if (input.substr(peg$currPos, 6) === peg$c65) {
1639
- s1 = peg$c65;
1640
- peg$currPos += 6;
1641
- } else {
1642
- s1 = peg$FAILED;
1643
- if (peg$silentFails === 0) { peg$fail(peg$c66); }
1644
- }
1645
- }
1646
- if (s1 !== peg$FAILED) {
1647
- s2 = [];
1648
- s3 = peg$parseAnyText();
1649
- if (s3 !== peg$FAILED) {
1650
- while (s3 !== peg$FAILED) {
1651
- s2.push(s3);
1652
- s3 = peg$parseAnyText();
1653
- }
1654
- } else {
1655
- s2 = peg$c1;
1656
- }
1657
- if (s2 !== peg$FAILED) {
1658
- s3 = peg$parseSpace();
1659
- if (s3 === peg$FAILED) {
1660
- s3 = peg$c43;
1661
- }
1662
- if (s3 !== peg$FAILED) {
1663
- peg$reportedPos = s0;
1664
- s1 = peg$c62(s2);
1665
- s0 = s1;
1666
- } else {
1667
- peg$currPos = s0;
1668
- s0 = peg$c1;
1669
- }
1670
- } else {
1671
- peg$currPos = s0;
1672
- s0 = peg$c1;
1673
- }
1674
- } else {
1675
- peg$currPos = s0;
1676
- s0 = peg$c1;
1677
- }
1678
-
1679
- return s0;
1680
- }
1681
-
1682
- function peg$parseOrderedListItem() {
1683
- var s0, s1, s2, s3, s4;
1684
-
1685
- s0 = peg$currPos;
1686
- if (input.substr(peg$currPos, 2) === peg$c67) {
1687
- s1 = peg$c67;
1688
- peg$currPos += 2;
1689
- } else {
1690
- s1 = peg$FAILED;
1691
- if (peg$silentFails === 0) { peg$fail(peg$c68); }
1692
- }
1693
- if (s1 === peg$FAILED) {
1694
- s1 = peg$c43;
1695
- }
1696
- if (s1 !== peg$FAILED) {
1697
- s2 = peg$currPos;
1698
- s3 = [];
1699
- s4 = peg$parseDigit1_9();
1700
- if (s4 !== peg$FAILED) {
1701
- while (s4 !== peg$FAILED) {
1702
- s3.push(s4);
1703
- s4 = peg$parseDigit1_9();
1704
- }
1705
- } else {
1706
- s3 = peg$c1;
1707
- }
1708
- if (s3 !== peg$FAILED) {
1709
- if (input.substr(peg$currPos, 2) === peg$c69) {
1710
- s4 = peg$c69;
1711
- peg$currPos += 2;
1712
- } else {
1713
- s4 = peg$FAILED;
1714
- if (peg$silentFails === 0) { peg$fail(peg$c70); }
1715
- }
1716
- if (s4 !== peg$FAILED) {
1717
- s3 = [s3, s4];
1718
- s2 = s3;
1719
- } else {
1720
- peg$currPos = s2;
1721
- s2 = peg$c1;
1722
- }
1723
- } else {
1724
- peg$currPos = s2;
1725
- s2 = peg$c1;
1726
- }
1727
- if (s2 !== peg$FAILED) {
1728
- s3 = [];
1729
- s4 = peg$parseAnyText();
1730
- if (s4 !== peg$FAILED) {
1731
- while (s4 !== peg$FAILED) {
1732
- s3.push(s4);
1733
- s4 = peg$parseAnyText();
1734
- }
1735
- } else {
1736
- s3 = peg$c1;
1737
- }
1738
- if (s3 !== peg$FAILED) {
1739
- s4 = peg$parseSpace();
1740
- if (s4 === peg$FAILED) {
1741
- s4 = peg$c43;
1742
- }
1743
- if (s4 !== peg$FAILED) {
1744
- peg$reportedPos = s0;
1745
- s1 = peg$c62(s3);
1746
- s0 = s1;
1747
- } else {
1748
- peg$currPos = s0;
1749
- s0 = peg$c1;
1750
- }
1751
- } else {
1752
- peg$currPos = s0;
1753
- s0 = peg$c1;
1754
- }
1755
- } else {
1756
- peg$currPos = s0;
1757
- s0 = peg$c1;
1758
- }
1759
- } else {
1760
- peg$currPos = s0;
1761
- s0 = peg$c1;
1762
- }
1763
-
1764
- return s0;
1765
- }
1766
-
1767
- function peg$parseLists() {
1768
- var s0, s1, s2;
1769
-
1770
- s0 = peg$currPos;
1771
- s1 = [];
1772
- s2 = peg$parseListItem();
1773
- if (s2 !== peg$FAILED) {
1774
- while (s2 !== peg$FAILED) {
1775
- s1.push(s2);
1776
- s2 = peg$parseListItem();
1777
- }
1778
- } else {
1779
- s1 = peg$c1;
1780
- }
1781
- if (s1 !== peg$FAILED) {
1782
- peg$reportedPos = s0;
1783
- s1 = peg$c71(s1);
1784
- }
1785
- s0 = s1;
1786
-
1787
- return s0;
1788
- }
1789
-
1790
- function peg$parseTasks() {
1791
- var s0, s1, s2;
1792
-
1793
- s0 = peg$currPos;
1794
- s1 = [];
1795
- s2 = peg$parseTaskItem();
1796
- if (s2 !== peg$FAILED) {
1797
- while (s2 !== peg$FAILED) {
1798
- s1.push(s2);
1799
- s2 = peg$parseTaskItem();
1800
- }
1801
- } else {
1802
- s1 = peg$c1;
1803
- }
1804
- if (s1 !== peg$FAILED) {
1805
- peg$reportedPos = s0;
1806
- s1 = peg$c72(s1);
1807
- }
1808
- s0 = s1;
1809
-
1810
- return s0;
1811
- }
1812
-
1813
- function peg$parseOrderedLists() {
1814
- var s0, s1, s2;
1815
-
1816
- s0 = peg$currPos;
1817
- s1 = [];
1818
- s2 = peg$parseOrderedListItem();
1819
- if (s2 !== peg$FAILED) {
1820
- while (s2 !== peg$FAILED) {
1821
- s1.push(s2);
1822
- s2 = peg$parseOrderedListItem();
1823
- }
1824
- } else {
1825
- s1 = peg$c1;
1826
- }
1827
- if (s1 !== peg$FAILED) {
1828
- peg$reportedPos = s0;
1829
- s1 = peg$c73(s1);
1830
- }
1831
- s0 = s1;
1832
-
1833
- return s0;
1834
- }
1835
-
1836
- function peg$parseType() {
1837
- var s0;
1838
-
1839
- if (input.substr(peg$currPos, 4) === peg$c74) {
1840
- s0 = peg$c74;
1841
- peg$currPos += 4;
1842
- } else {
1843
- s0 = peg$FAILED;
1844
- if (peg$silentFails === 0) { peg$fail(peg$c75); }
1845
- }
1846
- if (s0 === peg$FAILED) {
1847
- if (input.substr(peg$currPos, 10) === peg$c76) {
1848
- s0 = peg$c76;
1849
- peg$currPos += 10;
1850
- } else {
1851
- s0 = peg$FAILED;
1852
- if (peg$silentFails === 0) { peg$fail(peg$c77); }
1853
- }
1854
- }
1855
-
1856
- return s0;
1857
- }
1858
-
1859
- function peg$parseInlineCode() {
1860
- var s0, s1, s2, s3, s4, s5, s6;
1861
-
1862
- s0 = peg$currPos;
1863
- s1 = peg$parseAnyText();
1864
- if (s1 !== peg$FAILED) {
1865
- if (peg$c78.test(input.charAt(peg$currPos))) {
1866
- s2 = input.charAt(peg$currPos);
1867
- peg$currPos++;
1868
- } else {
1869
- s2 = peg$FAILED;
1870
- if (peg$silentFails === 0) { peg$fail(peg$c79); }
1871
- }
1872
- if (s2 !== peg$FAILED) {
1873
- s3 = [];
1874
- s4 = peg$parseAnyText();
1875
- if (s4 !== peg$FAILED) {
1876
- while (s4 !== peg$FAILED) {
1877
- s3.push(s4);
1878
- s4 = peg$parseAnyText();
1879
- }
1880
- } else {
1881
- s3 = peg$c1;
1882
- }
1883
- if (s3 !== peg$FAILED) {
1884
- if (peg$c78.test(input.charAt(peg$currPos))) {
1885
- s4 = input.charAt(peg$currPos);
1886
- peg$currPos++;
1887
- } else {
1888
- s4 = peg$FAILED;
1889
- if (peg$silentFails === 0) { peg$fail(peg$c79); }
1890
- }
1891
- if (s4 !== peg$FAILED) {
1892
- s5 = [];
1893
- s6 = peg$parseAnyText();
1894
- if (s6 !== peg$FAILED) {
1895
- while (s6 !== peg$FAILED) {
1896
- s5.push(s6);
1897
- s6 = peg$parseAnyText();
1898
- }
1899
- } else {
1900
- s5 = peg$c1;
1901
- }
1902
- if (s5 !== peg$FAILED) {
1903
- s6 = peg$parseSpace();
1904
- if (s6 === peg$FAILED) {
1905
- s6 = peg$c43;
1906
- }
1907
- if (s6 !== peg$FAILED) {
1908
- peg$reportedPos = s0;
1909
- s1 = peg$c80(s3);
1910
- s0 = s1;
1911
- } else {
1912
- peg$currPos = s0;
1913
- s0 = peg$c1;
1914
- }
1915
- } else {
1916
- peg$currPos = s0;
1917
- s0 = peg$c1;
1918
- }
1919
- } else {
1920
- peg$currPos = s0;
1921
- s0 = peg$c1;
1922
- }
1923
- } else {
1924
- peg$currPos = s0;
1925
- s0 = peg$c1;
1926
- }
1927
- } else {
1928
- peg$currPos = s0;
1929
- s0 = peg$c1;
1930
- }
1931
- } else {
1932
- peg$currPos = s0;
1933
- s0 = peg$c1;
1934
- }
1935
-
1936
- return s0;
1937
- }
1938
-
1939
- function peg$parseLineCode() {
1940
- var s0, s1, s2;
1941
-
1942
- s0 = peg$currPos;
1943
- s1 = [];
1944
- s2 = peg$parseCodeText();
1945
- if (s2 !== peg$FAILED) {
1946
- while (s2 !== peg$FAILED) {
1947
- s1.push(s2);
1948
- s2 = peg$parseCodeText();
1949
- }
1950
- } else {
1951
- s1 = peg$c1;
1952
- }
1953
- if (s1 !== peg$FAILED) {
1954
- peg$reportedPos = s0;
1955
- s1 = peg$c62(s1);
1956
- }
1957
- s0 = s1;
1958
-
1959
- return s0;
1960
- }
1961
-
1962
- function peg$parseTypeHtml() {
1963
- var s0;
1964
-
1965
- if (input.substr(peg$currPos, 4) === peg$c74) {
1966
- s0 = peg$c74;
1967
- peg$currPos += 4;
1968
- } else {
1969
- s0 = peg$FAILED;
1970
- if (peg$silentFails === 0) { peg$fail(peg$c75); }
1971
- }
1972
-
1973
- return s0;
1974
- }
1975
-
1976
- function peg$parseTypeJS() {
1977
- var s0;
1978
-
1979
- if (input.substr(peg$currPos, 10) === peg$c76) {
1980
- s0 = peg$c76;
1981
- peg$currPos += 10;
1982
- } else {
1983
- s0 = peg$FAILED;
1984
- if (peg$silentFails === 0) { peg$fail(peg$c77); }
1985
- }
1986
-
1987
- return s0;
1988
- }
1989
-
1990
- function peg$parseMultiplelLineCode() {
1991
- var s0, s1, s2, s3, s4, s5, s6;
1992
-
1993
- s0 = peg$currPos;
1994
- if (input.substr(peg$currPos, 3) === peg$c81) {
1995
- s1 = peg$c81;
1996
- peg$currPos += 3;
1997
- } else {
1998
- s1 = peg$FAILED;
1999
- if (peg$silentFails === 0) { peg$fail(peg$c82); }
2000
- }
2001
- if (s1 !== peg$FAILED) {
2002
- s2 = peg$parseTypeJS();
2003
- if (s2 === peg$FAILED) {
2004
- s2 = peg$parseTypeHtml();
2005
- }
2006
- if (s2 === peg$FAILED) {
2007
- s2 = peg$c43;
2008
- }
2009
- if (s2 !== peg$FAILED) {
2010
- s3 = peg$parseSpace();
2011
- if (s3 === peg$FAILED) {
2012
- s3 = peg$c43;
2013
- }
2014
- if (s3 !== peg$FAILED) {
2015
- s4 = [];
2016
- s5 = peg$parseLineCode();
2017
- if (s5 !== peg$FAILED) {
2018
- while (s5 !== peg$FAILED) {
2019
- s4.push(s5);
2020
- s5 = peg$parseLineCode();
2021
- }
2022
- } else {
2023
- s4 = peg$c1;
2024
- }
2025
- if (s4 !== peg$FAILED) {
2026
- if (input.substr(peg$currPos, 3) === peg$c81) {
2027
- s5 = peg$c81;
2028
- peg$currPos += 3;
2029
- } else {
2030
- s5 = peg$FAILED;
2031
- if (peg$silentFails === 0) { peg$fail(peg$c82); }
2032
- }
2033
- if (s5 !== peg$FAILED) {
2034
- s6 = peg$parseSpace();
2035
- if (s6 === peg$FAILED) {
2036
- s6 = peg$c43;
2037
- }
2038
- if (s6 !== peg$FAILED) {
2039
- peg$reportedPos = s0;
2040
- s1 = peg$c83(s2, s4);
2041
- s0 = s1;
2042
- } else {
2043
- peg$currPos = s0;
2044
- s0 = peg$c1;
2045
- }
2046
- } else {
2047
- peg$currPos = s0;
2048
- s0 = peg$c1;
2049
- }
2050
- } else {
2051
- peg$currPos = s0;
2052
- s0 = peg$c1;
2053
- }
2054
- } else {
2055
- peg$currPos = s0;
2056
- s0 = peg$c1;
2057
- }
2058
- } else {
2059
- peg$currPos = s0;
2060
- s0 = peg$c1;
2061
- }
2062
- } else {
2063
- peg$currPos = s0;
2064
- s0 = peg$c1;
2065
- }
2066
-
2067
- return s0;
2068
- }
2069
-
2070
- function peg$parseLinkTitle() {
2071
- var s0, s1, s2, s3;
2072
-
2073
- s0 = peg$currPos;
2074
- if (peg$c84.test(input.charAt(peg$currPos))) {
2075
- s1 = input.charAt(peg$currPos);
2076
- peg$currPos++;
2077
- } else {
2078
- s1 = peg$FAILED;
2079
- if (peg$silentFails === 0) { peg$fail(peg$c85); }
2080
- }
2081
- if (s1 !== peg$FAILED) {
2082
- s2 = [];
2083
- s3 = peg$parseLinkText();
2084
- if (s3 !== peg$FAILED) {
2085
- while (s3 !== peg$FAILED) {
2086
- s2.push(s3);
2087
- s3 = peg$parseLinkText();
2088
- }
2089
- } else {
2090
- s2 = peg$c1;
2091
- }
2092
- if (s2 !== peg$FAILED) {
2093
- if (peg$c86.test(input.charAt(peg$currPos))) {
2094
- s3 = input.charAt(peg$currPos);
2095
- peg$currPos++;
2096
- } else {
2097
- s3 = peg$FAILED;
2098
- if (peg$silentFails === 0) { peg$fail(peg$c87); }
2099
- }
2100
- if (s3 !== peg$FAILED) {
2101
- peg$reportedPos = s0;
2102
- s1 = peg$c80(s2);
2103
- s0 = s1;
2104
- } else {
2105
- peg$currPos = s0;
2106
- s0 = peg$c1;
2107
- }
2108
- } else {
2109
- peg$currPos = s0;
2110
- s0 = peg$c1;
2111
- }
2112
- } else {
2113
- peg$currPos = s0;
2114
- s0 = peg$c1;
2115
- }
2116
-
2117
- return s0;
2118
- }
2119
-
2120
- function peg$parseLinkTitleEmpty() {
2121
- var s0, s1, s2;
2122
-
2123
- s0 = peg$currPos;
2124
- if (peg$c84.test(input.charAt(peg$currPos))) {
2125
- s1 = input.charAt(peg$currPos);
2126
- peg$currPos++;
2127
- } else {
2128
- s1 = peg$FAILED;
2129
- if (peg$silentFails === 0) { peg$fail(peg$c85); }
2130
- }
2131
- if (s1 !== peg$FAILED) {
2132
- if (peg$c86.test(input.charAt(peg$currPos))) {
2133
- s2 = input.charAt(peg$currPos);
2134
- peg$currPos++;
2135
- } else {
2136
- s2 = peg$FAILED;
2137
- if (peg$silentFails === 0) { peg$fail(peg$c87); }
2138
- }
2139
- if (s2 !== peg$FAILED) {
2140
- peg$reportedPos = s0;
2141
- s1 = peg$c88();
2142
- s0 = s1;
2143
- } else {
2144
- peg$currPos = s0;
2145
- s0 = peg$c1;
2146
- }
2147
- } else {
2148
- peg$currPos = s0;
2149
- s0 = peg$c1;
2150
- }
2151
-
2152
- return s0;
2153
- }
2154
-
2155
- function peg$parseLinkRef() {
2156
- var s0, s1, s2, s3;
2157
-
2158
- s0 = peg$currPos;
2159
- if (peg$c89.test(input.charAt(peg$currPos))) {
2160
- s1 = input.charAt(peg$currPos);
2161
- peg$currPos++;
2162
- } else {
2163
- s1 = peg$FAILED;
2164
- if (peg$silentFails === 0) { peg$fail(peg$c90); }
2165
- }
2166
- if (s1 !== peg$FAILED) {
2167
- s2 = [];
2168
- s3 = peg$parseAnyText();
2169
- if (s3 !== peg$FAILED) {
2170
- while (s3 !== peg$FAILED) {
2171
- s2.push(s3);
2172
- s3 = peg$parseAnyText();
2173
- }
2174
- } else {
2175
- s2 = peg$c1;
2176
- }
2177
- if (s2 !== peg$FAILED) {
2178
- if (peg$c91.test(input.charAt(peg$currPos))) {
2179
- s3 = input.charAt(peg$currPos);
2180
- peg$currPos++;
2181
- } else {
2182
- s3 = peg$FAILED;
2183
- if (peg$silentFails === 0) { peg$fail(peg$c92); }
2184
- }
2185
- if (s3 !== peg$FAILED) {
2186
- peg$reportedPos = s0;
2187
- s1 = peg$c80(s2);
2188
- s0 = s1;
2189
- } else {
2190
- peg$currPos = s0;
2191
- s0 = peg$c1;
2192
- }
2193
- } else {
2194
- peg$currPos = s0;
2195
- s0 = peg$c1;
2196
- }
2197
- } else {
2198
- peg$currPos = s0;
2199
- s0 = peg$c1;
2200
- }
2201
-
2202
- return s0;
2203
- }
2204
-
2205
- function peg$parseReferences() {
2206
- var s0, s1, s2, s3, s4;
2207
-
2208
- s0 = peg$currPos;
2209
- s1 = [];
2210
- s2 = peg$parseAnyText();
2211
- if (s2 !== peg$FAILED) {
2212
- while (s2 !== peg$FAILED) {
2213
- s1.push(s2);
2214
- s2 = peg$parseAnyText();
2215
- }
2216
- } else {
2217
- s1 = peg$c1;
2218
- }
2219
- if (s1 === peg$FAILED) {
2220
- s1 = peg$c93;
2221
- }
2222
- if (s1 !== peg$FAILED) {
2223
- s2 = peg$parseLinkTitle();
2224
- if (s2 !== peg$FAILED) {
2225
- s3 = peg$parseLinkRef();
2226
- if (s3 !== peg$FAILED) {
2227
- s4 = peg$parseSpace();
2228
- if (s4 === peg$FAILED) {
2229
- s4 = peg$c43;
2230
- }
2231
- if (s4 !== peg$FAILED) {
2232
- peg$reportedPos = s0;
2233
- s1 = peg$c94(s2, s3);
2234
- s0 = s1;
2235
- } else {
2236
- peg$currPos = s0;
2237
- s0 = peg$c1;
2238
- }
2239
- } else {
2240
- peg$currPos = s0;
2241
- s0 = peg$c1;
2242
- }
2243
- } else {
2244
- peg$currPos = s0;
2245
- s0 = peg$c1;
2246
- }
2247
- } else {
2248
- peg$currPos = s0;
2249
- s0 = peg$c1;
2250
- }
2251
-
2252
- return s0;
2253
- }
2254
-
2255
- function peg$parseReferencesEmpty() {
2256
- var s0, s1, s2, s3, s4;
2257
-
2258
- s0 = peg$currPos;
2259
- s1 = [];
2260
- s2 = peg$parseAnyText();
2261
- if (s2 !== peg$FAILED) {
2262
- while (s2 !== peg$FAILED) {
2263
- s1.push(s2);
2264
- s2 = peg$parseAnyText();
2265
- }
2266
- } else {
2267
- s1 = peg$c1;
2268
- }
2269
- if (s1 === peg$FAILED) {
2270
- s1 = peg$c93;
2271
- }
2272
- if (s1 !== peg$FAILED) {
2273
- s2 = peg$parseLinkTitleEmpty();
2274
- if (s2 !== peg$FAILED) {
2275
- s3 = peg$parseLinkRef();
2276
- if (s3 !== peg$FAILED) {
2277
- s4 = peg$parseSpace();
2278
- if (s4 === peg$FAILED) {
2279
- s4 = peg$c43;
2280
- }
2281
- if (s4 !== peg$FAILED) {
2282
- peg$reportedPos = s0;
2283
- s1 = peg$c94(s2, s3);
2284
- s0 = s1;
2285
- } else {
2286
- peg$currPos = s0;
2287
- s0 = peg$c1;
2288
- }
2289
- } else {
2290
- peg$currPos = s0;
2291
- s0 = peg$c1;
2292
- }
2293
- } else {
2294
- peg$currPos = s0;
2295
- s0 = peg$c1;
2296
- }
2297
- } else {
2298
- peg$currPos = s0;
2299
- s0 = peg$c1;
2300
- }
2301
-
2302
- return s0;
2303
- }
2304
-
2305
- function peg$parseh() {
2306
- var s0;
2307
-
2308
- if (peg$c95.test(input.charAt(peg$currPos))) {
2309
- s0 = input.charAt(peg$currPos);
2310
- peg$currPos++;
2311
- } else {
2312
- s0 = peg$FAILED;
2313
- if (peg$silentFails === 0) { peg$fail(peg$c96); }
2314
- }
2315
-
2316
- return s0;
2317
- }
2318
-
2319
- function peg$parsenonascii() {
2320
- var s0;
2321
-
2322
- if (peg$c97.test(input.charAt(peg$currPos))) {
2323
- s0 = input.charAt(peg$currPos);
2324
- peg$currPos++;
2325
- } else {
2326
- s0 = peg$FAILED;
2327
- if (peg$silentFails === 0) { peg$fail(peg$c98); }
2328
- }
2329
-
2330
- return s0;
2331
- }
2332
-
2333
- function peg$parseunicode() {
2334
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
2335
-
2336
- s0 = peg$currPos;
2337
- if (input.charCodeAt(peg$currPos) === 92) {
2338
- s1 = peg$c99;
2339
- peg$currPos++;
2340
- } else {
2341
- s1 = peg$FAILED;
2342
- if (peg$silentFails === 0) { peg$fail(peg$c100); }
2343
- }
2344
- if (s1 !== peg$FAILED) {
2345
- s2 = peg$currPos;
2346
- s3 = peg$currPos;
2347
- s4 = peg$parseh();
2348
- if (s4 !== peg$FAILED) {
2349
- s5 = peg$parseh();
2350
- if (s5 === peg$FAILED) {
2351
- s5 = peg$c43;
2352
- }
2353
- if (s5 !== peg$FAILED) {
2354
- s6 = peg$parseh();
2355
- if (s6 === peg$FAILED) {
2356
- s6 = peg$c43;
2357
- }
2358
- if (s6 !== peg$FAILED) {
2359
- s7 = peg$parseh();
2360
- if (s7 === peg$FAILED) {
2361
- s7 = peg$c43;
2362
- }
2363
- if (s7 !== peg$FAILED) {
2364
- s8 = peg$parseh();
2365
- if (s8 === peg$FAILED) {
2366
- s8 = peg$c43;
2367
- }
2368
- if (s8 !== peg$FAILED) {
2369
- s9 = peg$parseh();
2370
- if (s9 === peg$FAILED) {
2371
- s9 = peg$c43;
2372
- }
2373
- if (s9 !== peg$FAILED) {
2374
- s4 = [s4, s5, s6, s7, s8, s9];
2375
- s3 = s4;
2376
- } else {
2377
- peg$currPos = s3;
2378
- s3 = peg$c1;
2379
- }
2380
- } else {
2381
- peg$currPos = s3;
2382
- s3 = peg$c1;
2383
- }
2384
- } else {
2385
- peg$currPos = s3;
2386
- s3 = peg$c1;
2387
- }
2388
- } else {
2389
- peg$currPos = s3;
2390
- s3 = peg$c1;
2391
- }
2392
- } else {
2393
- peg$currPos = s3;
2394
- s3 = peg$c1;
2395
- }
2396
- } else {
2397
- peg$currPos = s3;
2398
- s3 = peg$c1;
2399
- }
2400
- if (s3 !== peg$FAILED) {
2401
- s3 = input.substring(s2, peg$currPos);
2402
- }
2403
- s2 = s3;
2404
- if (s2 !== peg$FAILED) {
2405
- if (input.substr(peg$currPos, 2) === peg$c7) {
2406
- s3 = peg$c7;
2407
- peg$currPos += 2;
2408
- } else {
2409
- s3 = peg$FAILED;
2410
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
2411
- }
2412
- if (s3 === peg$FAILED) {
2413
- if (peg$c101.test(input.charAt(peg$currPos))) {
2414
- s3 = input.charAt(peg$currPos);
2415
- peg$currPos++;
2416
- } else {
2417
- s3 = peg$FAILED;
2418
- if (peg$silentFails === 0) { peg$fail(peg$c102); }
2419
- }
2420
- }
2421
- if (s3 === peg$FAILED) {
2422
- s3 = peg$c43;
2423
- }
2424
- if (s3 !== peg$FAILED) {
2425
- peg$reportedPos = s0;
2426
- s1 = peg$c103(s2);
2427
- s0 = s1;
2428
- } else {
2429
- peg$currPos = s0;
2430
- s0 = peg$c1;
2431
- }
2432
- } else {
2433
- peg$currPos = s0;
2434
- s0 = peg$c1;
2435
- }
2436
- } else {
2437
- peg$currPos = s0;
2438
- s0 = peg$c1;
2439
- }
2440
-
2441
- return s0;
2442
- }
2443
-
2444
- function peg$parseescape() {
2445
- var s0, s1, s2;
2446
-
2447
- s0 = peg$parseunicode();
2448
- if (s0 === peg$FAILED) {
2449
- s0 = peg$currPos;
2450
- if (input.charCodeAt(peg$currPos) === 92) {
2451
- s1 = peg$c99;
2452
- peg$currPos++;
2453
- } else {
2454
- s1 = peg$FAILED;
2455
- if (peg$silentFails === 0) { peg$fail(peg$c100); }
2456
- }
2457
- if (s1 !== peg$FAILED) {
2458
- if (peg$c104.test(input.charAt(peg$currPos))) {
2459
- s2 = input.charAt(peg$currPos);
2460
- peg$currPos++;
2461
- } else {
2462
- s2 = peg$FAILED;
2463
- if (peg$silentFails === 0) { peg$fail(peg$c105); }
2464
- }
2465
- if (s2 !== peg$FAILED) {
2466
- peg$reportedPos = s0;
2467
- s1 = peg$c106(s2);
2468
- s0 = s1;
2469
- } else {
2470
- peg$currPos = s0;
2471
- s0 = peg$c1;
2472
- }
2473
- } else {
2474
- peg$currPos = s0;
2475
- s0 = peg$c1;
2476
- }
2477
- }
2478
-
2479
- return s0;
2480
- }
2481
-
2482
- function peg$parsenmstart() {
2483
- var s0;
2484
-
2485
- if (peg$c107.test(input.charAt(peg$currPos))) {
2486
- s0 = input.charAt(peg$currPos);
2487
- peg$currPos++;
2488
- } else {
2489
- s0 = peg$FAILED;
2490
- if (peg$silentFails === 0) { peg$fail(peg$c108); }
2491
- }
2492
- if (s0 === peg$FAILED) {
2493
- s0 = peg$parsenonascii();
2494
- if (s0 === peg$FAILED) {
2495
- s0 = peg$parseescape();
2496
- }
2497
- }
2498
-
2499
- return s0;
2500
- }
2501
-
2502
- function peg$parsenmchar() {
2503
- var s0;
2504
-
2505
- if (peg$c109.test(input.charAt(peg$currPos))) {
2506
- s0 = input.charAt(peg$currPos);
2507
- peg$currPos++;
2508
- } else {
2509
- s0 = peg$FAILED;
2510
- if (peg$silentFails === 0) { peg$fail(peg$c110); }
2511
- }
2512
- if (s0 === peg$FAILED) {
2513
- s0 = peg$parsenonascii();
2514
- if (s0 === peg$FAILED) {
2515
- s0 = peg$parseescape();
2516
- }
2517
- }
2518
-
2519
- return s0;
2520
- }
2521
-
2522
- function peg$parsestring1() {
2523
- var s0, s1, s2, s3, s4, s5;
2524
-
2525
- s0 = peg$currPos;
2526
- if (input.charCodeAt(peg$currPos) === 34) {
2527
- s1 = peg$c111;
2528
- peg$currPos++;
2529
- } else {
2530
- s1 = peg$FAILED;
2531
- if (peg$silentFails === 0) { peg$fail(peg$c112); }
2532
- }
2533
- if (s1 !== peg$FAILED) {
2534
- s2 = [];
2535
- if (peg$c113.test(input.charAt(peg$currPos))) {
2536
- s3 = input.charAt(peg$currPos);
2537
- peg$currPos++;
2538
- } else {
2539
- s3 = peg$FAILED;
2540
- if (peg$silentFails === 0) { peg$fail(peg$c114); }
2541
- }
2542
- if (s3 === peg$FAILED) {
2543
- s3 = peg$currPos;
2544
- if (input.charCodeAt(peg$currPos) === 92) {
2545
- s4 = peg$c99;
2546
- peg$currPos++;
2547
- } else {
2548
- s4 = peg$FAILED;
2549
- if (peg$silentFails === 0) { peg$fail(peg$c100); }
2550
- }
2551
- if (s4 !== peg$FAILED) {
2552
- s5 = peg$parsenl();
2553
- if (s5 !== peg$FAILED) {
2554
- peg$reportedPos = s3;
2555
- s4 = peg$c115(s5);
2556
- s3 = s4;
2557
- } else {
2558
- peg$currPos = s3;
2559
- s3 = peg$c1;
2560
- }
2561
- } else {
2562
- peg$currPos = s3;
2563
- s3 = peg$c1;
2564
- }
2565
- if (s3 === peg$FAILED) {
2566
- s3 = peg$parseescape();
2567
- }
2568
- }
2569
- while (s3 !== peg$FAILED) {
2570
- s2.push(s3);
2571
- if (peg$c113.test(input.charAt(peg$currPos))) {
2572
- s3 = input.charAt(peg$currPos);
2573
- peg$currPos++;
2574
- } else {
2575
- s3 = peg$FAILED;
2576
- if (peg$silentFails === 0) { peg$fail(peg$c114); }
2577
- }
2578
- if (s3 === peg$FAILED) {
2579
- s3 = peg$currPos;
2580
- if (input.charCodeAt(peg$currPos) === 92) {
2581
- s4 = peg$c99;
2582
- peg$currPos++;
2583
- } else {
2584
- s4 = peg$FAILED;
2585
- if (peg$silentFails === 0) { peg$fail(peg$c100); }
2586
- }
2587
- if (s4 !== peg$FAILED) {
2588
- s5 = peg$parsenl();
2589
- if (s5 !== peg$FAILED) {
2590
- peg$reportedPos = s3;
2591
- s4 = peg$c115(s5);
2592
- s3 = s4;
2593
- } else {
2594
- peg$currPos = s3;
2595
- s3 = peg$c1;
2596
- }
2597
- } else {
2598
- peg$currPos = s3;
2599
- s3 = peg$c1;
2600
- }
2601
- if (s3 === peg$FAILED) {
2602
- s3 = peg$parseescape();
2603
- }
2604
- }
2605
- }
2606
- if (s2 !== peg$FAILED) {
2607
- if (input.charCodeAt(peg$currPos) === 34) {
2608
- s3 = peg$c111;
2609
- peg$currPos++;
2610
- } else {
2611
- s3 = peg$FAILED;
2612
- if (peg$silentFails === 0) { peg$fail(peg$c112); }
2613
- }
2614
- if (s3 !== peg$FAILED) {
2615
- peg$reportedPos = s0;
2616
- s1 = peg$c116(s2);
2617
- s0 = s1;
2618
- } else {
2619
- peg$currPos = s0;
2620
- s0 = peg$c1;
2621
- }
2622
- } else {
2623
- peg$currPos = s0;
2624
- s0 = peg$c1;
2625
- }
2626
- } else {
2627
- peg$currPos = s0;
2628
- s0 = peg$c1;
2629
- }
2630
-
2631
- return s0;
2632
- }
2633
-
2634
- function peg$parsestring2() {
2635
- var s0, s1, s2, s3, s4, s5;
2636
-
2637
- s0 = peg$currPos;
2638
- if (input.charCodeAt(peg$currPos) === 39) {
2639
- s1 = peg$c117;
2640
- peg$currPos++;
2641
- } else {
2642
- s1 = peg$FAILED;
2643
- if (peg$silentFails === 0) { peg$fail(peg$c118); }
2644
- }
2645
- if (s1 !== peg$FAILED) {
2646
- s2 = [];
2647
- if (peg$c119.test(input.charAt(peg$currPos))) {
2648
- s3 = input.charAt(peg$currPos);
2649
- peg$currPos++;
2650
- } else {
2651
- s3 = peg$FAILED;
2652
- if (peg$silentFails === 0) { peg$fail(peg$c120); }
2653
- }
2654
- if (s3 === peg$FAILED) {
2655
- s3 = peg$currPos;
2656
- if (input.charCodeAt(peg$currPos) === 92) {
2657
- s4 = peg$c99;
2658
- peg$currPos++;
2659
- } else {
2660
- s4 = peg$FAILED;
2661
- if (peg$silentFails === 0) { peg$fail(peg$c100); }
2662
- }
2663
- if (s4 !== peg$FAILED) {
2664
- s5 = peg$parsenl();
2665
- if (s5 !== peg$FAILED) {
2666
- peg$reportedPos = s3;
2667
- s4 = peg$c115(s5);
2668
- s3 = s4;
2669
- } else {
2670
- peg$currPos = s3;
2671
- s3 = peg$c1;
2672
- }
2673
- } else {
2674
- peg$currPos = s3;
2675
- s3 = peg$c1;
2676
- }
2677
- if (s3 === peg$FAILED) {
2678
- s3 = peg$parseescape();
2679
- }
2680
- }
2681
- while (s3 !== peg$FAILED) {
2682
- s2.push(s3);
2683
- if (peg$c119.test(input.charAt(peg$currPos))) {
2684
- s3 = input.charAt(peg$currPos);
2685
- peg$currPos++;
2686
- } else {
2687
- s3 = peg$FAILED;
2688
- if (peg$silentFails === 0) { peg$fail(peg$c120); }
2689
- }
2690
- if (s3 === peg$FAILED) {
2691
- s3 = peg$currPos;
2692
- if (input.charCodeAt(peg$currPos) === 92) {
2693
- s4 = peg$c99;
2694
- peg$currPos++;
2695
- } else {
2696
- s4 = peg$FAILED;
2697
- if (peg$silentFails === 0) { peg$fail(peg$c100); }
2698
- }
2699
- if (s4 !== peg$FAILED) {
2700
- s5 = peg$parsenl();
2701
- if (s5 !== peg$FAILED) {
2702
- peg$reportedPos = s3;
2703
- s4 = peg$c115(s5);
2704
- s3 = s4;
2705
- } else {
2706
- peg$currPos = s3;
2707
- s3 = peg$c1;
2708
- }
2709
- } else {
2710
- peg$currPos = s3;
2711
- s3 = peg$c1;
2712
- }
2713
- if (s3 === peg$FAILED) {
2714
- s3 = peg$parseescape();
2715
- }
2716
- }
2717
- }
2718
- if (s2 !== peg$FAILED) {
2719
- if (input.charCodeAt(peg$currPos) === 39) {
2720
- s3 = peg$c117;
2721
- peg$currPos++;
2722
- } else {
2723
- s3 = peg$FAILED;
2724
- if (peg$silentFails === 0) { peg$fail(peg$c118); }
2725
- }
2726
- if (s3 !== peg$FAILED) {
2727
- peg$reportedPos = s0;
2728
- s1 = peg$c116(s2);
2729
- s0 = s1;
2730
- } else {
2731
- peg$currPos = s0;
2732
- s0 = peg$c1;
2733
- }
2734
- } else {
2735
- peg$currPos = s0;
2736
- s0 = peg$c1;
2737
- }
2738
- } else {
2739
- peg$currPos = s0;
2740
- s0 = peg$c1;
2741
- }
2742
-
2743
- return s0;
2744
- }
2745
-
2746
- function peg$parsestring() {
2747
- var s0, s1, s2;
2748
-
2749
- s0 = peg$currPos;
2750
- s1 = peg$parsestring1();
2751
- if (s1 === peg$FAILED) {
2752
- s1 = [];
2753
- if (peg$c121.test(input.charAt(peg$currPos))) {
2754
- s2 = input.charAt(peg$currPos);
2755
- peg$currPos++;
2756
- } else {
2757
- s2 = peg$FAILED;
2758
- if (peg$silentFails === 0) { peg$fail(peg$c122); }
2759
- }
2760
- if (s2 !== peg$FAILED) {
2761
- while (s2 !== peg$FAILED) {
2762
- s1.push(s2);
2763
- if (peg$c121.test(input.charAt(peg$currPos))) {
2764
- s2 = input.charAt(peg$currPos);
2765
- peg$currPos++;
2766
- } else {
2767
- s2 = peg$FAILED;
2768
- if (peg$silentFails === 0) { peg$fail(peg$c122); }
2769
- }
2770
- }
2771
- } else {
2772
- s1 = peg$c1;
2773
- }
2774
- }
2775
- if (s1 !== peg$FAILED) {
2776
- peg$reportedPos = s0;
2777
- s1 = peg$c123(s1);
2778
- }
2779
- s0 = s1;
2780
-
2781
- return s0;
2782
- }
2783
-
2784
- function peg$parsecomment() {
2785
- var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
2786
-
2787
- s0 = peg$currPos;
2788
- if (input.substr(peg$currPos, 2) === peg$c124) {
2789
- s1 = peg$c124;
2790
- peg$currPos += 2;
2791
- } else {
2792
- s1 = peg$FAILED;
2793
- if (peg$silentFails === 0) { peg$fail(peg$c125); }
2794
- }
2795
- if (s1 !== peg$FAILED) {
2796
- s2 = [];
2797
- if (peg$c126.test(input.charAt(peg$currPos))) {
2798
- s3 = input.charAt(peg$currPos);
2799
- peg$currPos++;
2800
- } else {
2801
- s3 = peg$FAILED;
2802
- if (peg$silentFails === 0) { peg$fail(peg$c127); }
2803
- }
2804
- while (s3 !== peg$FAILED) {
2805
- s2.push(s3);
2806
- if (peg$c126.test(input.charAt(peg$currPos))) {
2807
- s3 = input.charAt(peg$currPos);
2808
- peg$currPos++;
2809
- } else {
2810
- s3 = peg$FAILED;
2811
- if (peg$silentFails === 0) { peg$fail(peg$c127); }
2812
- }
2813
- }
2814
- if (s2 !== peg$FAILED) {
2815
- s3 = [];
2816
- if (input.charCodeAt(peg$currPos) === 42) {
2817
- s4 = peg$c128;
2818
- peg$currPos++;
2819
- } else {
2820
- s4 = peg$FAILED;
2821
- if (peg$silentFails === 0) { peg$fail(peg$c129); }
2822
- }
2823
- if (s4 !== peg$FAILED) {
2824
- while (s4 !== peg$FAILED) {
2825
- s3.push(s4);
2826
- if (input.charCodeAt(peg$currPos) === 42) {
2827
- s4 = peg$c128;
2828
- peg$currPos++;
2829
- } else {
2830
- s4 = peg$FAILED;
2831
- if (peg$silentFails === 0) { peg$fail(peg$c129); }
2832
- }
2833
- }
2834
- } else {
2835
- s3 = peg$c1;
2836
- }
2837
- if (s3 !== peg$FAILED) {
2838
- s4 = [];
2839
- s5 = peg$currPos;
2840
- if (peg$c130.test(input.charAt(peg$currPos))) {
2841
- s6 = input.charAt(peg$currPos);
2842
- peg$currPos++;
2843
- } else {
2844
- s6 = peg$FAILED;
2845
- if (peg$silentFails === 0) { peg$fail(peg$c131); }
2846
- }
2847
- if (s6 !== peg$FAILED) {
2848
- s7 = [];
2849
- if (peg$c126.test(input.charAt(peg$currPos))) {
2850
- s8 = input.charAt(peg$currPos);
2851
- peg$currPos++;
2852
- } else {
2853
- s8 = peg$FAILED;
2854
- if (peg$silentFails === 0) { peg$fail(peg$c127); }
2855
- }
2856
- while (s8 !== peg$FAILED) {
2857
- s7.push(s8);
2858
- if (peg$c126.test(input.charAt(peg$currPos))) {
2859
- s8 = input.charAt(peg$currPos);
2860
- peg$currPos++;
2861
- } else {
2862
- s8 = peg$FAILED;
2863
- if (peg$silentFails === 0) { peg$fail(peg$c127); }
2864
- }
2865
- }
2866
- if (s7 !== peg$FAILED) {
2867
- s8 = [];
2868
- if (input.charCodeAt(peg$currPos) === 42) {
2869
- s9 = peg$c128;
2870
- peg$currPos++;
2871
- } else {
2872
- s9 = peg$FAILED;
2873
- if (peg$silentFails === 0) { peg$fail(peg$c129); }
2874
- }
2875
- if (s9 !== peg$FAILED) {
2876
- while (s9 !== peg$FAILED) {
2877
- s8.push(s9);
2878
- if (input.charCodeAt(peg$currPos) === 42) {
2879
- s9 = peg$c128;
2880
- peg$currPos++;
2881
- } else {
2882
- s9 = peg$FAILED;
2883
- if (peg$silentFails === 0) { peg$fail(peg$c129); }
2884
- }
2885
- }
2886
- } else {
2887
- s8 = peg$c1;
2888
- }
2889
- if (s8 !== peg$FAILED) {
2890
- s6 = [s6, s7, s8];
2891
- s5 = s6;
2892
- } else {
2893
- peg$currPos = s5;
2894
- s5 = peg$c1;
2895
- }
2896
- } else {
2897
- peg$currPos = s5;
2898
- s5 = peg$c1;
2899
- }
2900
- } else {
2901
- peg$currPos = s5;
2902
- s5 = peg$c1;
2903
- }
2904
- while (s5 !== peg$FAILED) {
2905
- s4.push(s5);
2906
- s5 = peg$currPos;
2907
- if (peg$c130.test(input.charAt(peg$currPos))) {
2908
- s6 = input.charAt(peg$currPos);
2909
- peg$currPos++;
2910
- } else {
2911
- s6 = peg$FAILED;
2912
- if (peg$silentFails === 0) { peg$fail(peg$c131); }
2913
- }
2914
- if (s6 !== peg$FAILED) {
2915
- s7 = [];
2916
- if (peg$c126.test(input.charAt(peg$currPos))) {
2917
- s8 = input.charAt(peg$currPos);
2918
- peg$currPos++;
2919
- } else {
2920
- s8 = peg$FAILED;
2921
- if (peg$silentFails === 0) { peg$fail(peg$c127); }
2922
- }
2923
- while (s8 !== peg$FAILED) {
2924
- s7.push(s8);
2925
- if (peg$c126.test(input.charAt(peg$currPos))) {
2926
- s8 = input.charAt(peg$currPos);
2927
- peg$currPos++;
2928
- } else {
2929
- s8 = peg$FAILED;
2930
- if (peg$silentFails === 0) { peg$fail(peg$c127); }
2931
- }
2932
- }
2933
- if (s7 !== peg$FAILED) {
2934
- s8 = [];
2935
- if (input.charCodeAt(peg$currPos) === 42) {
2936
- s9 = peg$c128;
2937
- peg$currPos++;
2938
- } else {
2939
- s9 = peg$FAILED;
2940
- if (peg$silentFails === 0) { peg$fail(peg$c129); }
2941
- }
2942
- if (s9 !== peg$FAILED) {
2943
- while (s9 !== peg$FAILED) {
2944
- s8.push(s9);
2945
- if (input.charCodeAt(peg$currPos) === 42) {
2946
- s9 = peg$c128;
2947
- peg$currPos++;
2948
- } else {
2949
- s9 = peg$FAILED;
2950
- if (peg$silentFails === 0) { peg$fail(peg$c129); }
2951
- }
2952
- }
2953
- } else {
2954
- s8 = peg$c1;
2955
- }
2956
- if (s8 !== peg$FAILED) {
2957
- s6 = [s6, s7, s8];
2958
- s5 = s6;
2959
- } else {
2960
- peg$currPos = s5;
2961
- s5 = peg$c1;
2962
- }
2963
- } else {
2964
- peg$currPos = s5;
2965
- s5 = peg$c1;
2966
- }
2967
- } else {
2968
- peg$currPos = s5;
2969
- s5 = peg$c1;
2970
- }
2971
- }
2972
- if (s4 !== peg$FAILED) {
2973
- if (input.charCodeAt(peg$currPos) === 47) {
2974
- s5 = peg$c132;
2975
- peg$currPos++;
2976
- } else {
2977
- s5 = peg$FAILED;
2978
- if (peg$silentFails === 0) { peg$fail(peg$c133); }
2979
- }
2980
- if (s5 !== peg$FAILED) {
2981
- s1 = [s1, s2, s3, s4, s5];
2982
- s0 = s1;
2983
- } else {
2984
- peg$currPos = s0;
2985
- s0 = peg$c1;
2986
- }
2987
- } else {
2988
- peg$currPos = s0;
2989
- s0 = peg$c1;
2990
- }
2991
- } else {
2992
- peg$currPos = s0;
2993
- s0 = peg$c1;
2994
- }
2995
- } else {
2996
- peg$currPos = s0;
2997
- s0 = peg$c1;
2998
- }
2999
- } else {
3000
- peg$currPos = s0;
3001
- s0 = peg$c1;
3002
- }
3003
-
3004
- return s0;
3005
- }
3006
-
3007
- function peg$parseident() {
3008
- var s0, s1, s2, s3, s4;
3009
-
3010
- s0 = peg$currPos;
3011
- s1 = peg$currPos;
3012
- if (input.charCodeAt(peg$currPos) === 45) {
3013
- s2 = peg$c134;
3014
- peg$currPos++;
3015
- } else {
3016
- s2 = peg$FAILED;
3017
- if (peg$silentFails === 0) { peg$fail(peg$c135); }
3018
- }
3019
- if (s2 === peg$FAILED) {
3020
- s2 = peg$c43;
3021
- }
3022
- if (s2 !== peg$FAILED) {
3023
- s2 = input.substring(s1, peg$currPos);
3024
- }
3025
- s1 = s2;
3026
- if (s1 !== peg$FAILED) {
3027
- s2 = peg$parsenmstart();
3028
- if (s2 !== peg$FAILED) {
3029
- s3 = [];
3030
- s4 = peg$parsenmchar();
3031
- while (s4 !== peg$FAILED) {
3032
- s3.push(s4);
3033
- s4 = peg$parsenmchar();
3034
- }
3035
- if (s3 !== peg$FAILED) {
3036
- peg$reportedPos = s0;
3037
- s1 = peg$c136(s1, s2, s3);
3038
- s0 = s1;
3039
- } else {
3040
- peg$currPos = s0;
3041
- s0 = peg$c1;
3042
- }
3043
- } else {
3044
- peg$currPos = s0;
3045
- s0 = peg$c1;
3046
- }
3047
- } else {
3048
- peg$currPos = s0;
3049
- s0 = peg$c1;
3050
- }
3051
-
3052
- return s0;
3053
- }
3054
-
3055
- function peg$parsename() {
3056
- var s0, s1, s2;
3057
-
3058
- s0 = peg$currPos;
3059
- s1 = [];
3060
- s2 = peg$parsenmchar();
3061
- if (s2 !== peg$FAILED) {
3062
- while (s2 !== peg$FAILED) {
3063
- s1.push(s2);
3064
- s2 = peg$parsenmchar();
3065
- }
3066
- } else {
3067
- s1 = peg$c1;
3068
- }
3069
- if (s1 !== peg$FAILED) {
3070
- peg$reportedPos = s0;
3071
- s1 = peg$c137(s1);
3072
- }
3073
- s0 = s1;
3074
-
3075
- return s0;
3076
- }
3077
-
3078
- function peg$parsenum() {
3079
- var s0, s1, s2, s3, s4, s5, s6, s7;
3080
-
3081
- s0 = peg$currPos;
3082
- if (peg$c138.test(input.charAt(peg$currPos))) {
3083
- s1 = input.charAt(peg$currPos);
3084
- peg$currPos++;
3085
- } else {
3086
- s1 = peg$FAILED;
3087
- if (peg$silentFails === 0) { peg$fail(peg$c139); }
3088
- }
3089
- if (s1 === peg$FAILED) {
3090
- s1 = peg$c43;
3091
- }
3092
- if (s1 !== peg$FAILED) {
3093
- s2 = [];
3094
- if (peg$c140.test(input.charAt(peg$currPos))) {
3095
- s3 = input.charAt(peg$currPos);
3096
- peg$currPos++;
3097
- } else {
3098
- s3 = peg$FAILED;
3099
- if (peg$silentFails === 0) { peg$fail(peg$c141); }
3100
- }
3101
- if (s3 !== peg$FAILED) {
3102
- while (s3 !== peg$FAILED) {
3103
- s2.push(s3);
3104
- if (peg$c140.test(input.charAt(peg$currPos))) {
3105
- s3 = input.charAt(peg$currPos);
3106
- peg$currPos++;
3107
- } else {
3108
- s3 = peg$FAILED;
3109
- if (peg$silentFails === 0) { peg$fail(peg$c141); }
3110
- }
3111
- }
3112
- } else {
3113
- s2 = peg$c1;
3114
- }
3115
- if (s2 === peg$FAILED) {
3116
- s2 = peg$currPos;
3117
- s3 = [];
3118
- if (peg$c140.test(input.charAt(peg$currPos))) {
3119
- s4 = input.charAt(peg$currPos);
3120
- peg$currPos++;
3121
- } else {
3122
- s4 = peg$FAILED;
3123
- if (peg$silentFails === 0) { peg$fail(peg$c141); }
3124
- }
3125
- while (s4 !== peg$FAILED) {
3126
- s3.push(s4);
3127
- if (peg$c140.test(input.charAt(peg$currPos))) {
3128
- s4 = input.charAt(peg$currPos);
3129
- peg$currPos++;
3130
- } else {
3131
- s4 = peg$FAILED;
3132
- if (peg$silentFails === 0) { peg$fail(peg$c141); }
3133
- }
3134
- }
3135
- if (s3 !== peg$FAILED) {
3136
- if (input.charCodeAt(peg$currPos) === 46) {
3137
- s4 = peg$c142;
3138
- peg$currPos++;
3139
- } else {
3140
- s4 = peg$FAILED;
3141
- if (peg$silentFails === 0) { peg$fail(peg$c143); }
3142
- }
3143
- if (s4 !== peg$FAILED) {
3144
- s5 = [];
3145
- if (peg$c140.test(input.charAt(peg$currPos))) {
3146
- s6 = input.charAt(peg$currPos);
3147
- peg$currPos++;
3148
- } else {
3149
- s6 = peg$FAILED;
3150
- if (peg$silentFails === 0) { peg$fail(peg$c141); }
3151
- }
3152
- if (s6 !== peg$FAILED) {
3153
- while (s6 !== peg$FAILED) {
3154
- s5.push(s6);
3155
- if (peg$c140.test(input.charAt(peg$currPos))) {
3156
- s6 = input.charAt(peg$currPos);
3157
- peg$currPos++;
3158
- } else {
3159
- s6 = peg$FAILED;
3160
- if (peg$silentFails === 0) { peg$fail(peg$c141); }
3161
- }
3162
- }
3163
- } else {
3164
- s5 = peg$c1;
3165
- }
3166
- if (s5 !== peg$FAILED) {
3167
- s3 = [s3, s4, s5];
3168
- s2 = s3;
3169
- } else {
3170
- peg$currPos = s2;
3171
- s2 = peg$c1;
3172
- }
3173
- } else {
3174
- peg$currPos = s2;
3175
- s2 = peg$c1;
3176
- }
3177
- } else {
3178
- peg$currPos = s2;
3179
- s2 = peg$c1;
3180
- }
3181
- }
3182
- if (s2 !== peg$FAILED) {
3183
- s3 = peg$currPos;
3184
- if (input.charCodeAt(peg$currPos) === 101) {
3185
- s4 = peg$c144;
3186
- peg$currPos++;
3187
- } else {
3188
- s4 = peg$FAILED;
3189
- if (peg$silentFails === 0) { peg$fail(peg$c145); }
3190
- }
3191
- if (s4 !== peg$FAILED) {
3192
- if (peg$c138.test(input.charAt(peg$currPos))) {
3193
- s5 = input.charAt(peg$currPos);
3194
- peg$currPos++;
3195
- } else {
3196
- s5 = peg$FAILED;
3197
- if (peg$silentFails === 0) { peg$fail(peg$c139); }
3198
- }
3199
- if (s5 === peg$FAILED) {
3200
- s5 = peg$c43;
3201
- }
3202
- if (s5 !== peg$FAILED) {
3203
- s6 = [];
3204
- if (peg$c140.test(input.charAt(peg$currPos))) {
3205
- s7 = input.charAt(peg$currPos);
3206
- peg$currPos++;
3207
- } else {
3208
- s7 = peg$FAILED;
3209
- if (peg$silentFails === 0) { peg$fail(peg$c141); }
3210
- }
3211
- if (s7 !== peg$FAILED) {
3212
- while (s7 !== peg$FAILED) {
3213
- s6.push(s7);
3214
- if (peg$c140.test(input.charAt(peg$currPos))) {
3215
- s7 = input.charAt(peg$currPos);
3216
- peg$currPos++;
3217
- } else {
3218
- s7 = peg$FAILED;
3219
- if (peg$silentFails === 0) { peg$fail(peg$c141); }
3220
- }
3221
- }
3222
- } else {
3223
- s6 = peg$c1;
3224
- }
3225
- if (s6 !== peg$FAILED) {
3226
- s4 = [s4, s5, s6];
3227
- s3 = s4;
3228
- } else {
3229
- peg$currPos = s3;
3230
- s3 = peg$c1;
3231
- }
3232
- } else {
3233
- peg$currPos = s3;
3234
- s3 = peg$c1;
3235
- }
3236
- } else {
3237
- peg$currPos = s3;
3238
- s3 = peg$c1;
3239
- }
3240
- if (s3 === peg$FAILED) {
3241
- s3 = peg$c43;
3242
- }
3243
- if (s3 !== peg$FAILED) {
3244
- peg$reportedPos = s0;
3245
- s1 = peg$c146();
3246
- s0 = s1;
3247
- } else {
3248
- peg$currPos = s0;
3249
- s0 = peg$c1;
3250
- }
3251
- } else {
3252
- peg$currPos = s0;
3253
- s0 = peg$c1;
3254
- }
3255
- } else {
3256
- peg$currPos = s0;
3257
- s0 = peg$c1;
3258
- }
3259
-
3260
- return s0;
3261
- }
3262
-
3263
- function peg$parseurl() {
3264
- var s0, s1, s2;
3265
-
3266
- s0 = peg$currPos;
3267
- s1 = [];
3268
- if (peg$c147.test(input.charAt(peg$currPos))) {
3269
- s2 = input.charAt(peg$currPos);
3270
- peg$currPos++;
3271
- } else {
3272
- s2 = peg$FAILED;
3273
- if (peg$silentFails === 0) { peg$fail(peg$c148); }
3274
- }
3275
- if (s2 === peg$FAILED) {
3276
- s2 = peg$parsenonascii();
3277
- if (s2 === peg$FAILED) {
3278
- s2 = peg$parseescape();
3279
- }
3280
- }
3281
- while (s2 !== peg$FAILED) {
3282
- s1.push(s2);
3283
- if (peg$c147.test(input.charAt(peg$currPos))) {
3284
- s2 = input.charAt(peg$currPos);
3285
- peg$currPos++;
3286
- } else {
3287
- s2 = peg$FAILED;
3288
- if (peg$silentFails === 0) { peg$fail(peg$c148); }
3289
- }
3290
- if (s2 === peg$FAILED) {
3291
- s2 = peg$parsenonascii();
3292
- if (s2 === peg$FAILED) {
3293
- s2 = peg$parseescape();
3294
- }
3295
- }
3296
- }
3297
- if (s1 !== peg$FAILED) {
3298
- peg$reportedPos = s0;
3299
- s1 = peg$c137(s1);
3300
- }
3301
- s0 = s1;
3302
-
3303
- return s0;
3304
- }
3305
-
3306
- function peg$parses() {
3307
- var s0, s1;
3308
-
3309
- s0 = [];
3310
- if (peg$c101.test(input.charAt(peg$currPos))) {
3311
- s1 = input.charAt(peg$currPos);
3312
- peg$currPos++;
3313
- } else {
3314
- s1 = peg$FAILED;
3315
- if (peg$silentFails === 0) { peg$fail(peg$c102); }
3316
- }
3317
- if (s1 !== peg$FAILED) {
3318
- while (s1 !== peg$FAILED) {
3319
- s0.push(s1);
3320
- if (peg$c101.test(input.charAt(peg$currPos))) {
3321
- s1 = input.charAt(peg$currPos);
3322
- peg$currPos++;
3323
- } else {
3324
- s1 = peg$FAILED;
3325
- if (peg$silentFails === 0) { peg$fail(peg$c102); }
3326
- }
3327
- }
3328
- } else {
3329
- s0 = peg$c1;
3330
- }
3331
-
3332
- return s0;
3333
- }
3334
-
3335
- function peg$parsew() {
3336
- var s0;
3337
-
3338
- s0 = peg$parses();
3339
- if (s0 === peg$FAILED) {
3340
- s0 = peg$c43;
3341
- }
3342
-
3343
- return s0;
3344
- }
3345
-
3346
- function peg$parsenl() {
3347
- var s0;
3348
-
3349
- if (input.charCodeAt(peg$currPos) === 10) {
3350
- s0 = peg$c11;
3351
- peg$currPos++;
3352
- } else {
3353
- s0 = peg$FAILED;
3354
- if (peg$silentFails === 0) { peg$fail(peg$c12); }
3355
- }
3356
- if (s0 === peg$FAILED) {
3357
- if (input.substr(peg$currPos, 2) === peg$c7) {
3358
- s0 = peg$c7;
3359
- peg$currPos += 2;
3360
- } else {
3361
- s0 = peg$FAILED;
3362
- if (peg$silentFails === 0) { peg$fail(peg$c8); }
3363
- }
3364
- if (s0 === peg$FAILED) {
3365
- if (input.charCodeAt(peg$currPos) === 13) {
3366
- s0 = peg$c9;
3367
- peg$currPos++;
3368
- } else {
3369
- s0 = peg$FAILED;
3370
- if (peg$silentFails === 0) { peg$fail(peg$c10); }
3371
- }
3372
- if (s0 === peg$FAILED) {
3373
- if (input.charCodeAt(peg$currPos) === 12) {
3374
- s0 = peg$c149;
3375
- peg$currPos++;
3376
- } else {
3377
- s0 = peg$FAILED;
3378
- if (peg$silentFails === 0) { peg$fail(peg$c150); }
3379
- }
3380
- }
3381
- }
3382
- }
3383
-
3384
- return s0;
3385
- }
3386
-
3387
-
3388
- var others = [];
3389
-
3390
- function extractList(list, index) {
3391
- var headings = [], lists = [], sections= [],
3392
- italics = [], strikethroughs= [], bolds= [],
3393
- lists = [], listsOrdered= [], tasks= [],
3394
- references= [], codes= [], i;
3395
-
3396
- for (i = 0; i < list.length; i++) {
3397
- if (list[i].heading)
3398
- headings.push(list[i].heading);
3399
- if (list[i].lists)
3400
- lists.push(list[i].lists);
3401
- if (list[i].section)
3402
- sections.push(list[i].section);
3403
- if (list[i].bold)
3404
- bolds.push(list[i].bold);
3405
- if (list[i].italic)
3406
- italics.push(list[i].italic);
3407
- if (list[i].strikethrough)
3408
- strikethroughs.push(list[i].strikethrough);
3409
- if (list[i].listsOrdered)
3410
- listsOrdered.push(list[i].listsOrdered);
3411
- if (list[i].tasks)
3412
- tasks.push(list[i].tasks);
3413
- if (list[i].references)
3414
- references.push(list[i].references);
3415
- if (list[i].code) {
3416
- codes.push({
3417
- type: list[i].type,
3418
- code: list[i].code[0]
3419
- });
3420
-
3421
- }
3422
- }
3423
-
3424
- return {
3425
- bolds: bolds,
3426
- codes: codes,
3427
- headings: headings,
3428
- italics: italics,
3429
- italics: italics,
3430
- references: references,
3431
- lists: lists,
3432
- listsOrdered: listsOrdered,
3433
- sections: sections,
3434
- strikethroughs: strikethroughs,
3435
- tasks: tasks
3436
- };
3437
- }
3438
-
3439
- function isImage(link) {
3440
- return link.indexOf(".png") > 0 || link.indexOf(".gif") > 0 || link.indexOf(".jpg") > 0 || link.indexOf(".jpeg") > 0 || link.indexOf(".svg") > 0;
3441
- }
3442
-
3443
-
3444
-
3445
- peg$result = peg$startRuleFunction();
3446
-
3447
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
3448
- return peg$result;
3449
- } else {
3450
- if (peg$result !== peg$FAILED && peg$currPos < input.length) {
3451
- peg$fail({ type: "end", description: "end of input" });
3452
- }
3453
-
3454
- throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
3455
- }
3456
- }
3457
-
3458
- return {
3459
- SyntaxError: SyntaxError,
3460
- parse: parse
3461
- };
3462
- })();