markdown-parser 0.0.8 → 0.1.0

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