react-native-notify-kit 10.8.0 → 10.9.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.
Files changed (79) hide show
  1. package/README.md +34 -17
  2. package/android/build.gradle +50 -4
  3. package/android/src/main/AndroidManifest.xml +4 -0
  4. package/android/src/main/java/app/notifee/core/ForegroundService.java +1002 -58
  5. package/android/src/main/java/app/notifee/core/ForegroundServiceRunLimitReceiver.java +15 -0
  6. package/android/src/main/java/app/notifee/core/ForegroundServiceRunLimitScheduler.java +461 -0
  7. package/android/src/main/java/app/notifee/core/NotificationManager.java +6 -0
  8. package/android/src/main/java/app/notifee/core/event/NotificationEvent.java +6 -0
  9. package/android/src/main/java/app/notifee/core/model/NotificationAndroidModel.java +29 -0
  10. package/android/src/main/kotlin/io/invertase/notifee/NotifeeEventSubscriber.kt +3 -0
  11. package/android/src/test/java/app/notifee/core/ForegroundServiceRunLimitTest.java +2357 -0
  12. package/android/src/test/java/app/notifee/core/ForegroundServiceTest.java +3093 -21
  13. package/android/src/test/java/app/notifee/core/ShadowServiceCompatibilityTest.java +170 -0
  14. package/android/src/test/resources/robolectric.properties +4 -0
  15. package/cli/dist/cli.js +0 -1
  16. package/cli/dist/commands/initNse.js +1 -2
  17. package/cli/dist/lib/detectProject.js +1 -2
  18. package/cli/dist/lib/initNseCore.js +0 -1
  19. package/cli/dist/lib/logger.js +0 -1
  20. package/cli/dist/lib/patchPodfile.js +0 -1
  21. package/cli/dist/lib/patchXcodeProject.js +22 -3
  22. package/cli/dist/lib/writeTemplates.js +0 -1
  23. package/cli/dist/lib/xcode.js +6 -0
  24. package/cli/dist/templates/NotificationService.swift.tmpl +74 -6
  25. package/cli/package.json +1 -0
  26. package/cli/vendor/xcode/AUTHORS +6 -0
  27. package/cli/vendor/xcode/LICENSE +202 -0
  28. package/cli/vendor/xcode/NOTICE +5 -0
  29. package/cli/vendor/xcode/README.md +32 -0
  30. package/cli/vendor/xcode/UPSTREAM-SHA256.json +12 -0
  31. package/cli/vendor/xcode/index.js +18 -0
  32. package/cli/vendor/xcode/lib/parseJob.js +32 -0
  33. package/cli/vendor/xcode/lib/parser/pbxproj.js +1904 -0
  34. package/cli/vendor/xcode/lib/parser/pbxproj.pegjs +280 -0
  35. package/cli/vendor/xcode/lib/pbxFile.js +233 -0
  36. package/cli/vendor/xcode/lib/pbxProject.js +2205 -0
  37. package/cli/vendor/xcode/lib/pbxWriter.js +309 -0
  38. package/dist/NotifeeNativeModule.web.d.ts +2 -2
  39. package/dist/types/Notification.d.ts +36 -1
  40. package/dist/types/Notification.js +13 -0
  41. package/dist/types/Notification.js.map +1 -1
  42. package/dist/types/NotificationAndroid.d.ts +9 -0
  43. package/dist/types/NotificationAndroid.js.map +1 -1
  44. package/dist/validators/validateAndroidNotification.js +26 -1
  45. package/dist/validators/validateAndroidNotification.js.map +1 -1
  46. package/dist/validators/validateAndroidStyle.js +6 -0
  47. package/dist/validators/validateAndroidStyle.js.map +1 -1
  48. package/dist/validators/validateIOSAttachment.js +3 -1
  49. package/dist/validators/validateIOSAttachment.js.map +1 -1
  50. package/dist/version.d.ts +1 -1
  51. package/dist/version.js +1 -1
  52. package/package.json +8 -5
  53. package/src/NotifeeNativeModule.web.ts +2 -2
  54. package/src/types/Notification.ts +40 -0
  55. package/src/types/NotificationAndroid.ts +10 -0
  56. package/src/validators/validateAndroidNotification.ts +31 -1
  57. package/src/validators/validateAndroidStyle.ts +10 -2
  58. package/src/validators/validateIOSAttachment.ts +5 -1
  59. package/src/version.ts +1 -1
  60. package/cli/dist/cli.bundle.js +0 -20834
  61. package/cli/dist/cli.d.ts +0 -2
  62. package/cli/dist/cli.js.map +0 -1
  63. package/cli/dist/commands/initNse.d.ts +0 -12
  64. package/cli/dist/commands/initNse.js.map +0 -1
  65. package/cli/dist/lib/detectProject.d.ts +0 -12
  66. package/cli/dist/lib/detectProject.js.map +0 -1
  67. package/cli/dist/lib/initNseCore.d.ts +0 -8
  68. package/cli/dist/lib/initNseCore.js.map +0 -1
  69. package/cli/dist/lib/logger.d.ts +0 -4
  70. package/cli/dist/lib/logger.js.map +0 -1
  71. package/cli/dist/lib/patchPodfile.d.ts +0 -23
  72. package/cli/dist/lib/patchPodfile.js.map +0 -1
  73. package/cli/dist/lib/patchXcodeProject.d.ts +0 -41
  74. package/cli/dist/lib/patchXcodeProject.js.map +0 -1
  75. package/cli/dist/lib/writeTemplates.d.ts +0 -11
  76. package/cli/dist/lib/writeTemplates.js.map +0 -1
  77. package/cli/dist/templates/templates/Info.plist.tmpl +0 -29
  78. package/cli/dist/templates/templates/NotificationService.swift.tmpl +0 -100
  79. package/cli/dist/templates/templates/NotifyKitNSE.entitlements.tmpl +0 -6
@@ -0,0 +1,1904 @@
1
+ /**
2
+ Licensed to the Apache Software Foundation (ASF) under one
3
+ or more contributor license agreements. See the NOTICE file
4
+ distributed with this work for additional information
5
+ regarding copyright ownership. The ASF licenses this file
6
+ to you under the Apache License, Version 2.0 (the
7
+ 'License'); you may not use this file except in compliance
8
+ with the License. You may obtain a copy of the License at
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+ Unless required by applicable law or agreed to in writing,
11
+ software distributed under the License is distributed on an
12
+ 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13
+ KIND, either express or implied. See the License for the
14
+ specific language governing permissions and limitations
15
+ under the License.
16
+ */
17
+
18
+ /*
19
+ * Generated by PEG.js 0.10.0.
20
+ *
21
+ * http://pegjs.org/
22
+ */
23
+
24
+ "use strict";
25
+
26
+ function peg$subclass(child, parent) {
27
+ function ctor() { this.constructor = child; }
28
+ ctor.prototype = parent.prototype;
29
+ child.prototype = new ctor();
30
+ }
31
+
32
+ function peg$SyntaxError(message, expected, found, location) {
33
+ this.message = message;
34
+ this.expected = expected;
35
+ this.found = found;
36
+ this.location = location;
37
+ this.name = "SyntaxError";
38
+
39
+ if (typeof Error.captureStackTrace === "function") {
40
+ Error.captureStackTrace(this, peg$SyntaxError);
41
+ }
42
+ }
43
+
44
+ peg$subclass(peg$SyntaxError, Error);
45
+
46
+ peg$SyntaxError.buildMessage = function(expected, found) {
47
+ var DESCRIBE_EXPECTATION_FNS = {
48
+ literal: function(expectation) {
49
+ return "\"" + literalEscape(expectation.text) + "\"";
50
+ },
51
+
52
+ "class": function(expectation) {
53
+ var escapedParts = "",
54
+ i;
55
+
56
+ for (i = 0; i < expectation.parts.length; i++) {
57
+ escapedParts += expectation.parts[i] instanceof Array
58
+ ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
59
+ : classEscape(expectation.parts[i]);
60
+ }
61
+
62
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
63
+ },
64
+
65
+ any: function(expectation) {
66
+ return "any character";
67
+ },
68
+
69
+ end: function(expectation) {
70
+ return "end of input";
71
+ },
72
+
73
+ other: function(expectation) {
74
+ return expectation.description;
75
+ }
76
+ };
77
+
78
+ function hex(ch) {
79
+ return ch.charCodeAt(0).toString(16).toUpperCase();
80
+ }
81
+
82
+ function literalEscape(s) {
83
+ return s
84
+ .replace(/\\/g, '\\\\')
85
+ .replace(/"/g, '\\"')
86
+ .replace(/\0/g, '\\0')
87
+ .replace(/\t/g, '\\t')
88
+ .replace(/\n/g, '\\n')
89
+ .replace(/\r/g, '\\r')
90
+ .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
91
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
92
+ }
93
+
94
+ function classEscape(s) {
95
+ return s
96
+ .replace(/\\/g, '\\\\')
97
+ .replace(/\]/g, '\\]')
98
+ .replace(/\^/g, '\\^')
99
+ .replace(/-/g, '\\-')
100
+ .replace(/\0/g, '\\0')
101
+ .replace(/\t/g, '\\t')
102
+ .replace(/\n/g, '\\n')
103
+ .replace(/\r/g, '\\r')
104
+ .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
105
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
106
+ }
107
+
108
+ function describeExpectation(expectation) {
109
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
110
+ }
111
+
112
+ function describeExpected(expected) {
113
+ var descriptions = new Array(expected.length),
114
+ i, j;
115
+
116
+ for (i = 0; i < expected.length; i++) {
117
+ descriptions[i] = describeExpectation(expected[i]);
118
+ }
119
+
120
+ descriptions.sort();
121
+
122
+ if (descriptions.length > 0) {
123
+ for (i = 1, j = 1; i < descriptions.length; i++) {
124
+ if (descriptions[i - 1] !== descriptions[i]) {
125
+ descriptions[j] = descriptions[i];
126
+ j++;
127
+ }
128
+ }
129
+ descriptions.length = j;
130
+ }
131
+
132
+ switch (descriptions.length) {
133
+ case 1:
134
+ return descriptions[0];
135
+
136
+ case 2:
137
+ return descriptions[0] + " or " + descriptions[1];
138
+
139
+ default:
140
+ return descriptions.slice(0, -1).join(", ")
141
+ + ", or "
142
+ + descriptions[descriptions.length - 1];
143
+ }
144
+ }
145
+
146
+ function describeFound(found) {
147
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
148
+ }
149
+
150
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
151
+ };
152
+
153
+ function peg$parse(input, options) {
154
+ options = options !== void 0 ? options : {};
155
+
156
+ var peg$FAILED = {},
157
+
158
+ peg$startRuleFunctions = { Project: peg$parseProject },
159
+ peg$startRuleFunction = peg$parseProject,
160
+
161
+ peg$c0 = function(headComment, obj) {
162
+ var proj = Object.create(null)
163
+ proj.project = obj
164
+
165
+ if (headComment) {
166
+ proj.headComment = headComment
167
+ }
168
+
169
+ return proj;
170
+ },
171
+ peg$c1 = "{",
172
+ peg$c2 = peg$literalExpectation("{", false),
173
+ peg$c3 = "}",
174
+ peg$c4 = peg$literalExpectation("}", false),
175
+ peg$c5 = function(obj) { return obj },
176
+ peg$c6 = function() { return Object.create(null) },
177
+ peg$c7 = function(list) {
178
+ var returnObject = list[0][0];
179
+ for(var i = 1; i < list.length; i++){
180
+ var another = list[i][0];
181
+ returnObject = Object.assign(returnObject, another);
182
+ }
183
+ return returnObject;
184
+ },
185
+ peg$c8 = "=",
186
+ peg$c9 = peg$literalExpectation("=", false),
187
+ peg$c10 = ";",
188
+ peg$c11 = peg$literalExpectation(";", false),
189
+ peg$c12 = function(id, val) {
190
+ var result = Object.create(null);
191
+ result[id] = val
192
+ return result
193
+ },
194
+ peg$c13 = function(commentedId, val) {
195
+ var result = Object.create(null),
196
+ commentKey = commentedId.id + '_comment';
197
+
198
+ result[commentedId.id] = val;
199
+ result[commentKey] = commentedId[commentKey];
200
+ return result;
201
+
202
+ },
203
+ peg$c14 = function(id, commentedVal) {
204
+ var result = Object.create(null);
205
+ result[id] = commentedVal.value;
206
+ result[id + "_comment"] = commentedVal.comment;
207
+ return result;
208
+ },
209
+ peg$c15 = function(id, comment) {
210
+ var result = Object.create(null);
211
+ result.id = id;
212
+ result[id + "_comment"] = comment.trim();
213
+ return result
214
+ },
215
+ peg$c16 = function(literal, comment) {
216
+ var result = Object.create(null)
217
+ result.comment = comment.trim();
218
+ result.value = literal.trim();
219
+ return result;
220
+ },
221
+ peg$c17 = /^[^*]/,
222
+ peg$c18 = peg$classExpectation(["*"], true, false),
223
+ peg$c19 = function(body) { return body.join('') },
224
+ peg$c20 = "/*",
225
+ peg$c21 = peg$literalExpectation("/*", false),
226
+ peg$c22 = "*/",
227
+ peg$c23 = peg$literalExpectation("*/", false),
228
+ peg$c24 = function(begin, fields) {
229
+ var section = Object.create(null);
230
+ section[begin.name] = fields
231
+
232
+ return section
233
+ },
234
+ peg$c25 = "/* Begin ",
235
+ peg$c26 = peg$literalExpectation("/* Begin ", false),
236
+ peg$c27 = " section */",
237
+ peg$c28 = peg$literalExpectation(" section */", false),
238
+ peg$c29 = function(sectionName) { return { name: sectionName } },
239
+ peg$c30 = "/* End ",
240
+ peg$c31 = peg$literalExpectation("/* End ", false),
241
+ peg$c32 = "(",
242
+ peg$c33 = peg$literalExpectation("(", false),
243
+ peg$c34 = ")",
244
+ peg$c35 = peg$literalExpectation(")", false),
245
+ peg$c36 = function(arr) { return arr },
246
+ peg$c37 = function() { return [] },
247
+ peg$c38 = function(head, tail) {
248
+ if (tail) {
249
+ tail.unshift(head);
250
+ return tail;
251
+ } else {
252
+ return [head];
253
+ }
254
+ },
255
+ peg$c39 = function(val) { return val },
256
+ peg$c40 = function(val, comment) {
257
+ var result = Object.create(null);
258
+ result.value = val.trim();
259
+ result.comment = comment.trim();
260
+ return result;
261
+ },
262
+ peg$c41 = ",",
263
+ peg$c42 = peg$literalExpectation(",", false),
264
+ peg$c43 = /^[A-Za-z0-9_.]/,
265
+ peg$c44 = peg$classExpectation([["A", "Z"], ["a", "z"], ["0", "9"], "_", "."], false, false),
266
+ peg$c45 = function(id) { return id.join('') },
267
+ peg$c46 = ".",
268
+ peg$c47 = peg$literalExpectation(".", false),
269
+ peg$c48 = function(decimal) {
270
+ // store decimals as strings
271
+ // as JS doesn't differentiate bw strings and numbers
272
+ return decimal.join('')
273
+ },
274
+ peg$c49 = function(number) { return parseInt(number.join(''), 10) },
275
+ peg$c50 = function(str) { return '"' + str + '"' },
276
+ peg$c51 = function(str) { return str.join('') },
277
+ peg$c52 = peg$anyExpectation(),
278
+ peg$c53 = function(char) { return char },
279
+ peg$c54 = "\\",
280
+ peg$c55 = peg$literalExpectation("\\", false),
281
+ peg$c56 = function() { return '\\"' },
282
+ peg$c57 = function(literal) { return literal.join('') },
283
+ peg$c58 = /^[^;,\n]/,
284
+ peg$c59 = peg$classExpectation([";", ",", "\n"], true, false),
285
+ peg$c60 = "//",
286
+ peg$c61 = peg$literalExpectation("//", false),
287
+ peg$c62 = function(contents) { return contents },
288
+ peg$c63 = function(contents) { return contents.join('') },
289
+ peg$c64 = /^[0-9]/,
290
+ peg$c65 = peg$classExpectation([["0", "9"]], false, false),
291
+ peg$c66 = /^[A-Za-z]/,
292
+ peg$c67 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false),
293
+ peg$c68 = "\"",
294
+ peg$c69 = peg$literalExpectation("\"", false),
295
+ peg$c70 = peg$otherExpectation("whitespace"),
296
+ peg$c71 = /^[\t ]/,
297
+ peg$c72 = peg$classExpectation(["\t", " "], false, false),
298
+ peg$c73 = /^[\n\r]/,
299
+ peg$c74 = peg$classExpectation(["\n", "\r"], false, false),
300
+
301
+ peg$currPos = 0,
302
+ peg$savedPos = 0,
303
+ peg$posDetailsCache = [{ line: 1, column: 1 }],
304
+ peg$maxFailPos = 0,
305
+ peg$maxFailExpected = [],
306
+ peg$silentFails = 0,
307
+
308
+ peg$result;
309
+
310
+ if ("startRule" in options) {
311
+ if (!(options.startRule in peg$startRuleFunctions)) {
312
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
313
+ }
314
+
315
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
316
+ }
317
+
318
+ function text() {
319
+ return input.substring(peg$savedPos, peg$currPos);
320
+ }
321
+
322
+ function location() {
323
+ return peg$computeLocation(peg$savedPos, peg$currPos);
324
+ }
325
+
326
+ function expected(description, location) {
327
+ location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
328
+
329
+ throw peg$buildStructuredError(
330
+ [peg$otherExpectation(description)],
331
+ input.substring(peg$savedPos, peg$currPos),
332
+ location
333
+ );
334
+ }
335
+
336
+ function error(message, location) {
337
+ location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
338
+
339
+ throw peg$buildSimpleError(message, location);
340
+ }
341
+
342
+ function peg$literalExpectation(text, ignoreCase) {
343
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
344
+ }
345
+
346
+ function peg$classExpectation(parts, inverted, ignoreCase) {
347
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
348
+ }
349
+
350
+ function peg$anyExpectation() {
351
+ return { type: "any" };
352
+ }
353
+
354
+ function peg$endExpectation() {
355
+ return { type: "end" };
356
+ }
357
+
358
+ function peg$otherExpectation(description) {
359
+ return { type: "other", description: description };
360
+ }
361
+
362
+ function peg$computePosDetails(pos) {
363
+ var details = peg$posDetailsCache[pos], p;
364
+
365
+ if (details) {
366
+ return details;
367
+ } else {
368
+ p = pos - 1;
369
+ while (!peg$posDetailsCache[p]) {
370
+ p--;
371
+ }
372
+
373
+ details = peg$posDetailsCache[p];
374
+ details = {
375
+ line: details.line,
376
+ column: details.column
377
+ };
378
+
379
+ while (p < pos) {
380
+ if (input.charCodeAt(p) === 10) {
381
+ details.line++;
382
+ details.column = 1;
383
+ } else {
384
+ details.column++;
385
+ }
386
+
387
+ p++;
388
+ }
389
+
390
+ peg$posDetailsCache[pos] = details;
391
+ return details;
392
+ }
393
+ }
394
+
395
+ function peg$computeLocation(startPos, endPos) {
396
+ var startPosDetails = peg$computePosDetails(startPos),
397
+ endPosDetails = peg$computePosDetails(endPos);
398
+
399
+ return {
400
+ start: {
401
+ offset: startPos,
402
+ line: startPosDetails.line,
403
+ column: startPosDetails.column
404
+ },
405
+ end: {
406
+ offset: endPos,
407
+ line: endPosDetails.line,
408
+ column: endPosDetails.column
409
+ }
410
+ };
411
+ }
412
+
413
+ function peg$fail(expected) {
414
+ if (peg$currPos < peg$maxFailPos) { return; }
415
+
416
+ if (peg$currPos > peg$maxFailPos) {
417
+ peg$maxFailPos = peg$currPos;
418
+ peg$maxFailExpected = [];
419
+ }
420
+
421
+ peg$maxFailExpected.push(expected);
422
+ }
423
+
424
+ function peg$buildSimpleError(message, location) {
425
+ return new peg$SyntaxError(message, null, null, location);
426
+ }
427
+
428
+ function peg$buildStructuredError(expected, found, location) {
429
+ return new peg$SyntaxError(
430
+ peg$SyntaxError.buildMessage(expected, found),
431
+ expected,
432
+ found,
433
+ location
434
+ );
435
+ }
436
+
437
+ function peg$parseProject() {
438
+ var s0, s1, s2, s3, s4, s5, s6;
439
+
440
+ s0 = peg$currPos;
441
+ s1 = peg$parseSingleLineComment();
442
+ if (s1 === peg$FAILED) {
443
+ s1 = null;
444
+ }
445
+ if (s1 !== peg$FAILED) {
446
+ s2 = peg$parseInlineComment();
447
+ if (s2 === peg$FAILED) {
448
+ s2 = null;
449
+ }
450
+ if (s2 !== peg$FAILED) {
451
+ s3 = peg$parse_();
452
+ if (s3 !== peg$FAILED) {
453
+ s4 = peg$parseObject();
454
+ if (s4 !== peg$FAILED) {
455
+ s5 = peg$parseNewLine();
456
+ if (s5 !== peg$FAILED) {
457
+ s6 = peg$parse_();
458
+ if (s6 !== peg$FAILED) {
459
+ peg$savedPos = s0;
460
+ s1 = peg$c0(s1, s4);
461
+ s0 = s1;
462
+ } else {
463
+ peg$currPos = s0;
464
+ s0 = peg$FAILED;
465
+ }
466
+ } else {
467
+ peg$currPos = s0;
468
+ s0 = peg$FAILED;
469
+ }
470
+ } else {
471
+ peg$currPos = s0;
472
+ s0 = peg$FAILED;
473
+ }
474
+ } else {
475
+ peg$currPos = s0;
476
+ s0 = peg$FAILED;
477
+ }
478
+ } else {
479
+ peg$currPos = s0;
480
+ s0 = peg$FAILED;
481
+ }
482
+ } else {
483
+ peg$currPos = s0;
484
+ s0 = peg$FAILED;
485
+ }
486
+
487
+ return s0;
488
+ }
489
+
490
+ function peg$parseObject() {
491
+ var s0, s1, s2, s3;
492
+
493
+ s0 = peg$currPos;
494
+ if (input.charCodeAt(peg$currPos) === 123) {
495
+ s1 = peg$c1;
496
+ peg$currPos++;
497
+ } else {
498
+ s1 = peg$FAILED;
499
+ if (peg$silentFails === 0) { peg$fail(peg$c2); }
500
+ }
501
+ if (s1 !== peg$FAILED) {
502
+ s2 = peg$parseAssignmentList();
503
+ if (s2 === peg$FAILED) {
504
+ s2 = peg$parseEmptyBody();
505
+ }
506
+ if (s2 !== peg$FAILED) {
507
+ if (input.charCodeAt(peg$currPos) === 125) {
508
+ s3 = peg$c3;
509
+ peg$currPos++;
510
+ } else {
511
+ s3 = peg$FAILED;
512
+ if (peg$silentFails === 0) { peg$fail(peg$c4); }
513
+ }
514
+ if (s3 !== peg$FAILED) {
515
+ peg$savedPos = s0;
516
+ s1 = peg$c5(s2);
517
+ s0 = s1;
518
+ } else {
519
+ peg$currPos = s0;
520
+ s0 = peg$FAILED;
521
+ }
522
+ } else {
523
+ peg$currPos = s0;
524
+ s0 = peg$FAILED;
525
+ }
526
+ } else {
527
+ peg$currPos = s0;
528
+ s0 = peg$FAILED;
529
+ }
530
+
531
+ return s0;
532
+ }
533
+
534
+ function peg$parseEmptyBody() {
535
+ var s0, s1;
536
+
537
+ s0 = peg$currPos;
538
+ s1 = peg$parse_();
539
+ if (s1 !== peg$FAILED) {
540
+ peg$savedPos = s0;
541
+ s1 = peg$c6();
542
+ }
543
+ s0 = s1;
544
+
545
+ return s0;
546
+ }
547
+
548
+ function peg$parseAssignmentList() {
549
+ var s0, s1, s2, s3, s4, s5;
550
+
551
+ s0 = peg$currPos;
552
+ s1 = peg$parse_();
553
+ if (s1 !== peg$FAILED) {
554
+ s2 = [];
555
+ s3 = peg$currPos;
556
+ s4 = peg$parseAssignment();
557
+ if (s4 === peg$FAILED) {
558
+ s4 = peg$parseDelimitedSection();
559
+ }
560
+ if (s4 !== peg$FAILED) {
561
+ s5 = peg$parse_();
562
+ if (s5 !== peg$FAILED) {
563
+ s4 = [s4, s5];
564
+ s3 = s4;
565
+ } else {
566
+ peg$currPos = s3;
567
+ s3 = peg$FAILED;
568
+ }
569
+ } else {
570
+ peg$currPos = s3;
571
+ s3 = peg$FAILED;
572
+ }
573
+ if (s3 !== peg$FAILED) {
574
+ while (s3 !== peg$FAILED) {
575
+ s2.push(s3);
576
+ s3 = peg$currPos;
577
+ s4 = peg$parseAssignment();
578
+ if (s4 === peg$FAILED) {
579
+ s4 = peg$parseDelimitedSection();
580
+ }
581
+ if (s4 !== peg$FAILED) {
582
+ s5 = peg$parse_();
583
+ if (s5 !== peg$FAILED) {
584
+ s4 = [s4, s5];
585
+ s3 = s4;
586
+ } else {
587
+ peg$currPos = s3;
588
+ s3 = peg$FAILED;
589
+ }
590
+ } else {
591
+ peg$currPos = s3;
592
+ s3 = peg$FAILED;
593
+ }
594
+ }
595
+ } else {
596
+ s2 = peg$FAILED;
597
+ }
598
+ if (s2 !== peg$FAILED) {
599
+ peg$savedPos = s0;
600
+ s1 = peg$c7(s2);
601
+ s0 = s1;
602
+ } else {
603
+ peg$currPos = s0;
604
+ s0 = peg$FAILED;
605
+ }
606
+ } else {
607
+ peg$currPos = s0;
608
+ s0 = peg$FAILED;
609
+ }
610
+
611
+ return s0;
612
+ }
613
+
614
+ function peg$parseAssignment() {
615
+ var s0;
616
+
617
+ s0 = peg$parseSimpleAssignment();
618
+ if (s0 === peg$FAILED) {
619
+ s0 = peg$parseCommentedAssignment();
620
+ }
621
+
622
+ return s0;
623
+ }
624
+
625
+ function peg$parseSimpleAssignment() {
626
+ var s0, s1, s2, s3, s4, s5, s6;
627
+
628
+ s0 = peg$currPos;
629
+ s1 = peg$parseIdentifier();
630
+ if (s1 !== peg$FAILED) {
631
+ s2 = peg$parse_();
632
+ if (s2 !== peg$FAILED) {
633
+ if (input.charCodeAt(peg$currPos) === 61) {
634
+ s3 = peg$c8;
635
+ peg$currPos++;
636
+ } else {
637
+ s3 = peg$FAILED;
638
+ if (peg$silentFails === 0) { peg$fail(peg$c9); }
639
+ }
640
+ if (s3 !== peg$FAILED) {
641
+ s4 = peg$parse_();
642
+ if (s4 !== peg$FAILED) {
643
+ s5 = peg$parseValue();
644
+ if (s5 !== peg$FAILED) {
645
+ if (input.charCodeAt(peg$currPos) === 59) {
646
+ s6 = peg$c10;
647
+ peg$currPos++;
648
+ } else {
649
+ s6 = peg$FAILED;
650
+ if (peg$silentFails === 0) { peg$fail(peg$c11); }
651
+ }
652
+ if (s6 !== peg$FAILED) {
653
+ peg$savedPos = s0;
654
+ s1 = peg$c12(s1, s5);
655
+ s0 = s1;
656
+ } else {
657
+ peg$currPos = s0;
658
+ s0 = peg$FAILED;
659
+ }
660
+ } else {
661
+ peg$currPos = s0;
662
+ s0 = peg$FAILED;
663
+ }
664
+ } else {
665
+ peg$currPos = s0;
666
+ s0 = peg$FAILED;
667
+ }
668
+ } else {
669
+ peg$currPos = s0;
670
+ s0 = peg$FAILED;
671
+ }
672
+ } else {
673
+ peg$currPos = s0;
674
+ s0 = peg$FAILED;
675
+ }
676
+ } else {
677
+ peg$currPos = s0;
678
+ s0 = peg$FAILED;
679
+ }
680
+
681
+ return s0;
682
+ }
683
+
684
+ function peg$parseCommentedAssignment() {
685
+ var s0, s1, s2, s3, s4, s5, s6;
686
+
687
+ s0 = peg$currPos;
688
+ s1 = peg$parseCommentedIdentifier();
689
+ if (s1 !== peg$FAILED) {
690
+ s2 = peg$parse_();
691
+ if (s2 !== peg$FAILED) {
692
+ if (input.charCodeAt(peg$currPos) === 61) {
693
+ s3 = peg$c8;
694
+ peg$currPos++;
695
+ } else {
696
+ s3 = peg$FAILED;
697
+ if (peg$silentFails === 0) { peg$fail(peg$c9); }
698
+ }
699
+ if (s3 !== peg$FAILED) {
700
+ s4 = peg$parse_();
701
+ if (s4 !== peg$FAILED) {
702
+ s5 = peg$parseValue();
703
+ if (s5 !== peg$FAILED) {
704
+ if (input.charCodeAt(peg$currPos) === 59) {
705
+ s6 = peg$c10;
706
+ peg$currPos++;
707
+ } else {
708
+ s6 = peg$FAILED;
709
+ if (peg$silentFails === 0) { peg$fail(peg$c11); }
710
+ }
711
+ if (s6 !== peg$FAILED) {
712
+ peg$savedPos = s0;
713
+ s1 = peg$c13(s1, s5);
714
+ s0 = s1;
715
+ } else {
716
+ peg$currPos = s0;
717
+ s0 = peg$FAILED;
718
+ }
719
+ } else {
720
+ peg$currPos = s0;
721
+ s0 = peg$FAILED;
722
+ }
723
+ } else {
724
+ peg$currPos = s0;
725
+ s0 = peg$FAILED;
726
+ }
727
+ } else {
728
+ peg$currPos = s0;
729
+ s0 = peg$FAILED;
730
+ }
731
+ } else {
732
+ peg$currPos = s0;
733
+ s0 = peg$FAILED;
734
+ }
735
+ } else {
736
+ peg$currPos = s0;
737
+ s0 = peg$FAILED;
738
+ }
739
+ if (s0 === peg$FAILED) {
740
+ s0 = peg$currPos;
741
+ s1 = peg$parseIdentifier();
742
+ if (s1 !== peg$FAILED) {
743
+ s2 = peg$parse_();
744
+ if (s2 !== peg$FAILED) {
745
+ if (input.charCodeAt(peg$currPos) === 61) {
746
+ s3 = peg$c8;
747
+ peg$currPos++;
748
+ } else {
749
+ s3 = peg$FAILED;
750
+ if (peg$silentFails === 0) { peg$fail(peg$c9); }
751
+ }
752
+ if (s3 !== peg$FAILED) {
753
+ s4 = peg$parse_();
754
+ if (s4 !== peg$FAILED) {
755
+ s5 = peg$parseCommentedValue();
756
+ if (s5 !== peg$FAILED) {
757
+ if (input.charCodeAt(peg$currPos) === 59) {
758
+ s6 = peg$c10;
759
+ peg$currPos++;
760
+ } else {
761
+ s6 = peg$FAILED;
762
+ if (peg$silentFails === 0) { peg$fail(peg$c11); }
763
+ }
764
+ if (s6 !== peg$FAILED) {
765
+ peg$savedPos = s0;
766
+ s1 = peg$c14(s1, s5);
767
+ s0 = s1;
768
+ } else {
769
+ peg$currPos = s0;
770
+ s0 = peg$FAILED;
771
+ }
772
+ } else {
773
+ peg$currPos = s0;
774
+ s0 = peg$FAILED;
775
+ }
776
+ } else {
777
+ peg$currPos = s0;
778
+ s0 = peg$FAILED;
779
+ }
780
+ } else {
781
+ peg$currPos = s0;
782
+ s0 = peg$FAILED;
783
+ }
784
+ } else {
785
+ peg$currPos = s0;
786
+ s0 = peg$FAILED;
787
+ }
788
+ } else {
789
+ peg$currPos = s0;
790
+ s0 = peg$FAILED;
791
+ }
792
+ }
793
+
794
+ return s0;
795
+ }
796
+
797
+ function peg$parseCommentedIdentifier() {
798
+ var s0, s1, s2, s3;
799
+
800
+ s0 = peg$currPos;
801
+ s1 = peg$parseIdentifier();
802
+ if (s1 !== peg$FAILED) {
803
+ s2 = peg$parse_();
804
+ if (s2 !== peg$FAILED) {
805
+ s3 = peg$parseInlineComment();
806
+ if (s3 !== peg$FAILED) {
807
+ peg$savedPos = s0;
808
+ s1 = peg$c15(s1, s3);
809
+ s0 = s1;
810
+ } else {
811
+ peg$currPos = s0;
812
+ s0 = peg$FAILED;
813
+ }
814
+ } else {
815
+ peg$currPos = s0;
816
+ s0 = peg$FAILED;
817
+ }
818
+ } else {
819
+ peg$currPos = s0;
820
+ s0 = peg$FAILED;
821
+ }
822
+
823
+ return s0;
824
+ }
825
+
826
+ function peg$parseCommentedValue() {
827
+ var s0, s1, s2, s3;
828
+
829
+ s0 = peg$currPos;
830
+ s1 = peg$parseValue();
831
+ if (s1 !== peg$FAILED) {
832
+ s2 = peg$parse_();
833
+ if (s2 !== peg$FAILED) {
834
+ s3 = peg$parseInlineComment();
835
+ if (s3 !== peg$FAILED) {
836
+ peg$savedPos = s0;
837
+ s1 = peg$c16(s1, s3);
838
+ s0 = s1;
839
+ } else {
840
+ peg$currPos = s0;
841
+ s0 = peg$FAILED;
842
+ }
843
+ } else {
844
+ peg$currPos = s0;
845
+ s0 = peg$FAILED;
846
+ }
847
+ } else {
848
+ peg$currPos = s0;
849
+ s0 = peg$FAILED;
850
+ }
851
+
852
+ return s0;
853
+ }
854
+
855
+ function peg$parseInlineComment() {
856
+ var s0, s1, s2, s3;
857
+
858
+ s0 = peg$currPos;
859
+ s1 = peg$parseInlineCommentOpen();
860
+ if (s1 !== peg$FAILED) {
861
+ s2 = [];
862
+ if (peg$c17.test(input.charAt(peg$currPos))) {
863
+ s3 = input.charAt(peg$currPos);
864
+ peg$currPos++;
865
+ } else {
866
+ s3 = peg$FAILED;
867
+ if (peg$silentFails === 0) { peg$fail(peg$c18); }
868
+ }
869
+ if (s3 !== peg$FAILED) {
870
+ while (s3 !== peg$FAILED) {
871
+ s2.push(s3);
872
+ if (peg$c17.test(input.charAt(peg$currPos))) {
873
+ s3 = input.charAt(peg$currPos);
874
+ peg$currPos++;
875
+ } else {
876
+ s3 = peg$FAILED;
877
+ if (peg$silentFails === 0) { peg$fail(peg$c18); }
878
+ }
879
+ }
880
+ } else {
881
+ s2 = peg$FAILED;
882
+ }
883
+ if (s2 !== peg$FAILED) {
884
+ s3 = peg$parseInlineCommentClose();
885
+ if (s3 !== peg$FAILED) {
886
+ peg$savedPos = s0;
887
+ s1 = peg$c19(s2);
888
+ s0 = s1;
889
+ } else {
890
+ peg$currPos = s0;
891
+ s0 = peg$FAILED;
892
+ }
893
+ } else {
894
+ peg$currPos = s0;
895
+ s0 = peg$FAILED;
896
+ }
897
+ } else {
898
+ peg$currPos = s0;
899
+ s0 = peg$FAILED;
900
+ }
901
+
902
+ return s0;
903
+ }
904
+
905
+ function peg$parseInlineCommentOpen() {
906
+ var s0;
907
+
908
+ if (input.substr(peg$currPos, 2) === peg$c20) {
909
+ s0 = peg$c20;
910
+ peg$currPos += 2;
911
+ } else {
912
+ s0 = peg$FAILED;
913
+ if (peg$silentFails === 0) { peg$fail(peg$c21); }
914
+ }
915
+
916
+ return s0;
917
+ }
918
+
919
+ function peg$parseInlineCommentClose() {
920
+ var s0;
921
+
922
+ if (input.substr(peg$currPos, 2) === peg$c22) {
923
+ s0 = peg$c22;
924
+ peg$currPos += 2;
925
+ } else {
926
+ s0 = peg$FAILED;
927
+ if (peg$silentFails === 0) { peg$fail(peg$c23); }
928
+ }
929
+
930
+ return s0;
931
+ }
932
+
933
+ function peg$parseDelimitedSection() {
934
+ var s0, s1, s2, s3, s4, s5;
935
+
936
+ s0 = peg$currPos;
937
+ s1 = peg$parseDelimitedSectionBegin();
938
+ if (s1 !== peg$FAILED) {
939
+ s2 = peg$parse_();
940
+ if (s2 !== peg$FAILED) {
941
+ s3 = peg$parseAssignmentList();
942
+ if (s3 === peg$FAILED) {
943
+ s3 = peg$parseEmptyBody();
944
+ }
945
+ if (s3 !== peg$FAILED) {
946
+ s4 = peg$parse_();
947
+ if (s4 !== peg$FAILED) {
948
+ s5 = peg$parseDelimitedSectionEnd();
949
+ if (s5 !== peg$FAILED) {
950
+ peg$savedPos = s0;
951
+ s1 = peg$c24(s1, s3);
952
+ s0 = s1;
953
+ } else {
954
+ peg$currPos = s0;
955
+ s0 = peg$FAILED;
956
+ }
957
+ } else {
958
+ peg$currPos = s0;
959
+ s0 = peg$FAILED;
960
+ }
961
+ } else {
962
+ peg$currPos = s0;
963
+ s0 = peg$FAILED;
964
+ }
965
+ } else {
966
+ peg$currPos = s0;
967
+ s0 = peg$FAILED;
968
+ }
969
+ } else {
970
+ peg$currPos = s0;
971
+ s0 = peg$FAILED;
972
+ }
973
+
974
+ return s0;
975
+ }
976
+
977
+ function peg$parseDelimitedSectionBegin() {
978
+ var s0, s1, s2, s3, s4;
979
+
980
+ s0 = peg$currPos;
981
+ if (input.substr(peg$currPos, 9) === peg$c25) {
982
+ s1 = peg$c25;
983
+ peg$currPos += 9;
984
+ } else {
985
+ s1 = peg$FAILED;
986
+ if (peg$silentFails === 0) { peg$fail(peg$c26); }
987
+ }
988
+ if (s1 !== peg$FAILED) {
989
+ s2 = peg$parseIdentifier();
990
+ if (s2 !== peg$FAILED) {
991
+ if (input.substr(peg$currPos, 11) === peg$c27) {
992
+ s3 = peg$c27;
993
+ peg$currPos += 11;
994
+ } else {
995
+ s3 = peg$FAILED;
996
+ if (peg$silentFails === 0) { peg$fail(peg$c28); }
997
+ }
998
+ if (s3 !== peg$FAILED) {
999
+ s4 = peg$parseNewLine();
1000
+ if (s4 !== peg$FAILED) {
1001
+ peg$savedPos = s0;
1002
+ s1 = peg$c29(s2);
1003
+ s0 = s1;
1004
+ } else {
1005
+ peg$currPos = s0;
1006
+ s0 = peg$FAILED;
1007
+ }
1008
+ } else {
1009
+ peg$currPos = s0;
1010
+ s0 = peg$FAILED;
1011
+ }
1012
+ } else {
1013
+ peg$currPos = s0;
1014
+ s0 = peg$FAILED;
1015
+ }
1016
+ } else {
1017
+ peg$currPos = s0;
1018
+ s0 = peg$FAILED;
1019
+ }
1020
+
1021
+ return s0;
1022
+ }
1023
+
1024
+ function peg$parseDelimitedSectionEnd() {
1025
+ var s0, s1, s2, s3, s4;
1026
+
1027
+ s0 = peg$currPos;
1028
+ if (input.substr(peg$currPos, 7) === peg$c30) {
1029
+ s1 = peg$c30;
1030
+ peg$currPos += 7;
1031
+ } else {
1032
+ s1 = peg$FAILED;
1033
+ if (peg$silentFails === 0) { peg$fail(peg$c31); }
1034
+ }
1035
+ if (s1 !== peg$FAILED) {
1036
+ s2 = peg$parseIdentifier();
1037
+ if (s2 !== peg$FAILED) {
1038
+ if (input.substr(peg$currPos, 11) === peg$c27) {
1039
+ s3 = peg$c27;
1040
+ peg$currPos += 11;
1041
+ } else {
1042
+ s3 = peg$FAILED;
1043
+ if (peg$silentFails === 0) { peg$fail(peg$c28); }
1044
+ }
1045
+ if (s3 !== peg$FAILED) {
1046
+ s4 = peg$parseNewLine();
1047
+ if (s4 !== peg$FAILED) {
1048
+ peg$savedPos = s0;
1049
+ s1 = peg$c29(s2);
1050
+ s0 = s1;
1051
+ } else {
1052
+ peg$currPos = s0;
1053
+ s0 = peg$FAILED;
1054
+ }
1055
+ } else {
1056
+ peg$currPos = s0;
1057
+ s0 = peg$FAILED;
1058
+ }
1059
+ } else {
1060
+ peg$currPos = s0;
1061
+ s0 = peg$FAILED;
1062
+ }
1063
+ } else {
1064
+ peg$currPos = s0;
1065
+ s0 = peg$FAILED;
1066
+ }
1067
+
1068
+ return s0;
1069
+ }
1070
+
1071
+ function peg$parseArray() {
1072
+ var s0, s1, s2, s3;
1073
+
1074
+ s0 = peg$currPos;
1075
+ if (input.charCodeAt(peg$currPos) === 40) {
1076
+ s1 = peg$c32;
1077
+ peg$currPos++;
1078
+ } else {
1079
+ s1 = peg$FAILED;
1080
+ if (peg$silentFails === 0) { peg$fail(peg$c33); }
1081
+ }
1082
+ if (s1 !== peg$FAILED) {
1083
+ s2 = peg$parseArrayBody();
1084
+ if (s2 === peg$FAILED) {
1085
+ s2 = peg$parseEmptyArray();
1086
+ }
1087
+ if (s2 !== peg$FAILED) {
1088
+ if (input.charCodeAt(peg$currPos) === 41) {
1089
+ s3 = peg$c34;
1090
+ peg$currPos++;
1091
+ } else {
1092
+ s3 = peg$FAILED;
1093
+ if (peg$silentFails === 0) { peg$fail(peg$c35); }
1094
+ }
1095
+ if (s3 !== peg$FAILED) {
1096
+ peg$savedPos = s0;
1097
+ s1 = peg$c36(s2);
1098
+ s0 = s1;
1099
+ } else {
1100
+ peg$currPos = s0;
1101
+ s0 = peg$FAILED;
1102
+ }
1103
+ } else {
1104
+ peg$currPos = s0;
1105
+ s0 = peg$FAILED;
1106
+ }
1107
+ } else {
1108
+ peg$currPos = s0;
1109
+ s0 = peg$FAILED;
1110
+ }
1111
+
1112
+ return s0;
1113
+ }
1114
+
1115
+ function peg$parseEmptyArray() {
1116
+ var s0, s1;
1117
+
1118
+ s0 = peg$currPos;
1119
+ s1 = peg$parse_();
1120
+ if (s1 !== peg$FAILED) {
1121
+ peg$savedPos = s0;
1122
+ s1 = peg$c37();
1123
+ }
1124
+ s0 = s1;
1125
+
1126
+ return s0;
1127
+ }
1128
+
1129
+ function peg$parseArrayBody() {
1130
+ var s0, s1, s2, s3, s4, s5;
1131
+
1132
+ s0 = peg$currPos;
1133
+ s1 = peg$parse_();
1134
+ if (s1 !== peg$FAILED) {
1135
+ s2 = peg$parseArrayEntry();
1136
+ if (s2 !== peg$FAILED) {
1137
+ s3 = peg$parse_();
1138
+ if (s3 !== peg$FAILED) {
1139
+ s4 = peg$parseArrayBody();
1140
+ if (s4 === peg$FAILED) {
1141
+ s4 = null;
1142
+ }
1143
+ if (s4 !== peg$FAILED) {
1144
+ s5 = peg$parse_();
1145
+ if (s5 !== peg$FAILED) {
1146
+ peg$savedPos = s0;
1147
+ s1 = peg$c38(s2, s4);
1148
+ s0 = s1;
1149
+ } else {
1150
+ peg$currPos = s0;
1151
+ s0 = peg$FAILED;
1152
+ }
1153
+ } else {
1154
+ peg$currPos = s0;
1155
+ s0 = peg$FAILED;
1156
+ }
1157
+ } else {
1158
+ peg$currPos = s0;
1159
+ s0 = peg$FAILED;
1160
+ }
1161
+ } else {
1162
+ peg$currPos = s0;
1163
+ s0 = peg$FAILED;
1164
+ }
1165
+ } else {
1166
+ peg$currPos = s0;
1167
+ s0 = peg$FAILED;
1168
+ }
1169
+
1170
+ return s0;
1171
+ }
1172
+
1173
+ function peg$parseArrayEntry() {
1174
+ var s0;
1175
+
1176
+ s0 = peg$parseSimpleArrayEntry();
1177
+ if (s0 === peg$FAILED) {
1178
+ s0 = peg$parseCommentedArrayEntry();
1179
+ }
1180
+
1181
+ return s0;
1182
+ }
1183
+
1184
+ function peg$parseSimpleArrayEntry() {
1185
+ var s0, s1, s2;
1186
+
1187
+ s0 = peg$currPos;
1188
+ s1 = peg$parseValue();
1189
+ if (s1 !== peg$FAILED) {
1190
+ s2 = peg$parseEndArrayEntry();
1191
+ if (s2 !== peg$FAILED) {
1192
+ peg$savedPos = s0;
1193
+ s1 = peg$c39(s1);
1194
+ s0 = s1;
1195
+ } else {
1196
+ peg$currPos = s0;
1197
+ s0 = peg$FAILED;
1198
+ }
1199
+ } else {
1200
+ peg$currPos = s0;
1201
+ s0 = peg$FAILED;
1202
+ }
1203
+
1204
+ return s0;
1205
+ }
1206
+
1207
+ function peg$parseCommentedArrayEntry() {
1208
+ var s0, s1, s2, s3, s4;
1209
+
1210
+ s0 = peg$currPos;
1211
+ s1 = peg$parseValue();
1212
+ if (s1 !== peg$FAILED) {
1213
+ s2 = peg$parse_();
1214
+ if (s2 !== peg$FAILED) {
1215
+ s3 = peg$parseInlineComment();
1216
+ if (s3 !== peg$FAILED) {
1217
+ s4 = peg$parseEndArrayEntry();
1218
+ if (s4 !== peg$FAILED) {
1219
+ peg$savedPos = s0;
1220
+ s1 = peg$c40(s1, s3);
1221
+ s0 = s1;
1222
+ } else {
1223
+ peg$currPos = s0;
1224
+ s0 = peg$FAILED;
1225
+ }
1226
+ } else {
1227
+ peg$currPos = s0;
1228
+ s0 = peg$FAILED;
1229
+ }
1230
+ } else {
1231
+ peg$currPos = s0;
1232
+ s0 = peg$FAILED;
1233
+ }
1234
+ } else {
1235
+ peg$currPos = s0;
1236
+ s0 = peg$FAILED;
1237
+ }
1238
+
1239
+ return s0;
1240
+ }
1241
+
1242
+ function peg$parseEndArrayEntry() {
1243
+ var s0, s1, s2, s3;
1244
+
1245
+ if (input.charCodeAt(peg$currPos) === 44) {
1246
+ s0 = peg$c41;
1247
+ peg$currPos++;
1248
+ } else {
1249
+ s0 = peg$FAILED;
1250
+ if (peg$silentFails === 0) { peg$fail(peg$c42); }
1251
+ }
1252
+ if (s0 === peg$FAILED) {
1253
+ s0 = peg$currPos;
1254
+ s1 = peg$parse_();
1255
+ if (s1 !== peg$FAILED) {
1256
+ s2 = peg$currPos;
1257
+ peg$silentFails++;
1258
+ if (input.charCodeAt(peg$currPos) === 41) {
1259
+ s3 = peg$c34;
1260
+ peg$currPos++;
1261
+ } else {
1262
+ s3 = peg$FAILED;
1263
+ if (peg$silentFails === 0) { peg$fail(peg$c35); }
1264
+ }
1265
+ peg$silentFails--;
1266
+ if (s3 !== peg$FAILED) {
1267
+ peg$currPos = s2;
1268
+ s2 = void 0;
1269
+ } else {
1270
+ s2 = peg$FAILED;
1271
+ }
1272
+ if (s2 !== peg$FAILED) {
1273
+ s1 = [s1, s2];
1274
+ s0 = s1;
1275
+ } else {
1276
+ peg$currPos = s0;
1277
+ s0 = peg$FAILED;
1278
+ }
1279
+ } else {
1280
+ peg$currPos = s0;
1281
+ s0 = peg$FAILED;
1282
+ }
1283
+ }
1284
+
1285
+ return s0;
1286
+ }
1287
+
1288
+ function peg$parseIdentifier() {
1289
+ var s0, s1, s2;
1290
+
1291
+ s0 = peg$currPos;
1292
+ s1 = [];
1293
+ if (peg$c43.test(input.charAt(peg$currPos))) {
1294
+ s2 = input.charAt(peg$currPos);
1295
+ peg$currPos++;
1296
+ } else {
1297
+ s2 = peg$FAILED;
1298
+ if (peg$silentFails === 0) { peg$fail(peg$c44); }
1299
+ }
1300
+ if (s2 !== peg$FAILED) {
1301
+ while (s2 !== peg$FAILED) {
1302
+ s1.push(s2);
1303
+ if (peg$c43.test(input.charAt(peg$currPos))) {
1304
+ s2 = input.charAt(peg$currPos);
1305
+ peg$currPos++;
1306
+ } else {
1307
+ s2 = peg$FAILED;
1308
+ if (peg$silentFails === 0) { peg$fail(peg$c44); }
1309
+ }
1310
+ }
1311
+ } else {
1312
+ s1 = peg$FAILED;
1313
+ }
1314
+ if (s1 !== peg$FAILED) {
1315
+ peg$savedPos = s0;
1316
+ s1 = peg$c45(s1);
1317
+ }
1318
+ s0 = s1;
1319
+ if (s0 === peg$FAILED) {
1320
+ s0 = peg$parseQuotedString();
1321
+ }
1322
+
1323
+ return s0;
1324
+ }
1325
+
1326
+ function peg$parseValue() {
1327
+ var s0;
1328
+
1329
+ s0 = peg$parseObject();
1330
+ if (s0 === peg$FAILED) {
1331
+ s0 = peg$parseArray();
1332
+ if (s0 === peg$FAILED) {
1333
+ s0 = peg$parseNumberValue();
1334
+ if (s0 === peg$FAILED) {
1335
+ s0 = peg$parseStringValue();
1336
+ }
1337
+ }
1338
+ }
1339
+
1340
+ return s0;
1341
+ }
1342
+
1343
+ function peg$parseNumberValue() {
1344
+ var s0;
1345
+
1346
+ s0 = peg$parseDecimalValue();
1347
+ if (s0 === peg$FAILED) {
1348
+ s0 = peg$parseIntegerValue();
1349
+ }
1350
+
1351
+ return s0;
1352
+ }
1353
+
1354
+ function peg$parseDecimalValue() {
1355
+ var s0, s1, s2, s3, s4;
1356
+
1357
+ s0 = peg$currPos;
1358
+ s1 = peg$currPos;
1359
+ s2 = peg$parseIntegerValue();
1360
+ if (s2 !== peg$FAILED) {
1361
+ if (input.charCodeAt(peg$currPos) === 46) {
1362
+ s3 = peg$c46;
1363
+ peg$currPos++;
1364
+ } else {
1365
+ s3 = peg$FAILED;
1366
+ if (peg$silentFails === 0) { peg$fail(peg$c47); }
1367
+ }
1368
+ if (s3 !== peg$FAILED) {
1369
+ s4 = peg$parseIntegerValue();
1370
+ if (s4 !== peg$FAILED) {
1371
+ s2 = [s2, s3, s4];
1372
+ s1 = s2;
1373
+ } else {
1374
+ peg$currPos = s1;
1375
+ s1 = peg$FAILED;
1376
+ }
1377
+ } else {
1378
+ peg$currPos = s1;
1379
+ s1 = peg$FAILED;
1380
+ }
1381
+ } else {
1382
+ peg$currPos = s1;
1383
+ s1 = peg$FAILED;
1384
+ }
1385
+ if (s1 !== peg$FAILED) {
1386
+ peg$savedPos = s0;
1387
+ s1 = peg$c48(s1);
1388
+ }
1389
+ s0 = s1;
1390
+
1391
+ return s0;
1392
+ }
1393
+
1394
+ function peg$parseIntegerValue() {
1395
+ var s0, s1, s2, s3, s4;
1396
+
1397
+ s0 = peg$currPos;
1398
+ s1 = peg$currPos;
1399
+ peg$silentFails++;
1400
+ s2 = peg$parseAlpha();
1401
+ peg$silentFails--;
1402
+ if (s2 === peg$FAILED) {
1403
+ s1 = void 0;
1404
+ } else {
1405
+ peg$currPos = s1;
1406
+ s1 = peg$FAILED;
1407
+ }
1408
+ if (s1 !== peg$FAILED) {
1409
+ s2 = [];
1410
+ s3 = peg$parseDigit();
1411
+ if (s3 !== peg$FAILED) {
1412
+ while (s3 !== peg$FAILED) {
1413
+ s2.push(s3);
1414
+ s3 = peg$parseDigit();
1415
+ }
1416
+ } else {
1417
+ s2 = peg$FAILED;
1418
+ }
1419
+ if (s2 !== peg$FAILED) {
1420
+ s3 = peg$currPos;
1421
+ peg$silentFails++;
1422
+ s4 = peg$parseNonTerminator();
1423
+ peg$silentFails--;
1424
+ if (s4 === peg$FAILED) {
1425
+ s3 = void 0;
1426
+ } else {
1427
+ peg$currPos = s3;
1428
+ s3 = peg$FAILED;
1429
+ }
1430
+ if (s3 !== peg$FAILED) {
1431
+ peg$savedPos = s0;
1432
+ s1 = peg$c49(s2);
1433
+ s0 = s1;
1434
+ } else {
1435
+ peg$currPos = s0;
1436
+ s0 = peg$FAILED;
1437
+ }
1438
+ } else {
1439
+ peg$currPos = s0;
1440
+ s0 = peg$FAILED;
1441
+ }
1442
+ } else {
1443
+ peg$currPos = s0;
1444
+ s0 = peg$FAILED;
1445
+ }
1446
+
1447
+ return s0;
1448
+ }
1449
+
1450
+ function peg$parseStringValue() {
1451
+ var s0;
1452
+
1453
+ s0 = peg$parseQuotedString();
1454
+ if (s0 === peg$FAILED) {
1455
+ s0 = peg$parseLiteralString();
1456
+ }
1457
+
1458
+ return s0;
1459
+ }
1460
+
1461
+ function peg$parseQuotedString() {
1462
+ var s0, s1, s2, s3;
1463
+
1464
+ s0 = peg$currPos;
1465
+ s1 = peg$parseDoubleQuote();
1466
+ if (s1 !== peg$FAILED) {
1467
+ s2 = peg$parseQuotedBody();
1468
+ if (s2 !== peg$FAILED) {
1469
+ s3 = peg$parseDoubleQuote();
1470
+ if (s3 !== peg$FAILED) {
1471
+ peg$savedPos = s0;
1472
+ s1 = peg$c50(s2);
1473
+ s0 = s1;
1474
+ } else {
1475
+ peg$currPos = s0;
1476
+ s0 = peg$FAILED;
1477
+ }
1478
+ } else {
1479
+ peg$currPos = s0;
1480
+ s0 = peg$FAILED;
1481
+ }
1482
+ } else {
1483
+ peg$currPos = s0;
1484
+ s0 = peg$FAILED;
1485
+ }
1486
+
1487
+ return s0;
1488
+ }
1489
+
1490
+ function peg$parseQuotedBody() {
1491
+ var s0, s1, s2;
1492
+
1493
+ s0 = peg$currPos;
1494
+ s1 = [];
1495
+ s2 = peg$parseNonQuote();
1496
+ if (s2 !== peg$FAILED) {
1497
+ while (s2 !== peg$FAILED) {
1498
+ s1.push(s2);
1499
+ s2 = peg$parseNonQuote();
1500
+ }
1501
+ } else {
1502
+ s1 = peg$FAILED;
1503
+ }
1504
+ if (s1 !== peg$FAILED) {
1505
+ peg$savedPos = s0;
1506
+ s1 = peg$c51(s1);
1507
+ }
1508
+ s0 = s1;
1509
+
1510
+ return s0;
1511
+ }
1512
+
1513
+ function peg$parseNonQuote() {
1514
+ var s0, s1, s2;
1515
+
1516
+ s0 = peg$parseEscapedQuote();
1517
+ if (s0 === peg$FAILED) {
1518
+ s0 = peg$currPos;
1519
+ s1 = peg$currPos;
1520
+ peg$silentFails++;
1521
+ s2 = peg$parseDoubleQuote();
1522
+ peg$silentFails--;
1523
+ if (s2 === peg$FAILED) {
1524
+ s1 = void 0;
1525
+ } else {
1526
+ peg$currPos = s1;
1527
+ s1 = peg$FAILED;
1528
+ }
1529
+ if (s1 !== peg$FAILED) {
1530
+ if (input.length > peg$currPos) {
1531
+ s2 = input.charAt(peg$currPos);
1532
+ peg$currPos++;
1533
+ } else {
1534
+ s2 = peg$FAILED;
1535
+ if (peg$silentFails === 0) { peg$fail(peg$c52); }
1536
+ }
1537
+ if (s2 !== peg$FAILED) {
1538
+ peg$savedPos = s0;
1539
+ s1 = peg$c53(s2);
1540
+ s0 = s1;
1541
+ } else {
1542
+ peg$currPos = s0;
1543
+ s0 = peg$FAILED;
1544
+ }
1545
+ } else {
1546
+ peg$currPos = s0;
1547
+ s0 = peg$FAILED;
1548
+ }
1549
+ }
1550
+
1551
+ return s0;
1552
+ }
1553
+
1554
+ function peg$parseEscapedQuote() {
1555
+ var s0, s1, s2;
1556
+
1557
+ s0 = peg$currPos;
1558
+ if (input.charCodeAt(peg$currPos) === 92) {
1559
+ s1 = peg$c54;
1560
+ peg$currPos++;
1561
+ } else {
1562
+ s1 = peg$FAILED;
1563
+ if (peg$silentFails === 0) { peg$fail(peg$c55); }
1564
+ }
1565
+ if (s1 !== peg$FAILED) {
1566
+ s2 = peg$parseDoubleQuote();
1567
+ if (s2 !== peg$FAILED) {
1568
+ peg$savedPos = s0;
1569
+ s1 = peg$c56();
1570
+ s0 = s1;
1571
+ } else {
1572
+ peg$currPos = s0;
1573
+ s0 = peg$FAILED;
1574
+ }
1575
+ } else {
1576
+ peg$currPos = s0;
1577
+ s0 = peg$FAILED;
1578
+ }
1579
+
1580
+ return s0;
1581
+ }
1582
+
1583
+ function peg$parseLiteralString() {
1584
+ var s0, s1, s2;
1585
+
1586
+ s0 = peg$currPos;
1587
+ s1 = [];
1588
+ s2 = peg$parseLiteralChar();
1589
+ if (s2 !== peg$FAILED) {
1590
+ while (s2 !== peg$FAILED) {
1591
+ s1.push(s2);
1592
+ s2 = peg$parseLiteralChar();
1593
+ }
1594
+ } else {
1595
+ s1 = peg$FAILED;
1596
+ }
1597
+ if (s1 !== peg$FAILED) {
1598
+ peg$savedPos = s0;
1599
+ s1 = peg$c57(s1);
1600
+ }
1601
+ s0 = s1;
1602
+
1603
+ return s0;
1604
+ }
1605
+
1606
+ function peg$parseLiteralChar() {
1607
+ var s0, s1, s2, s3;
1608
+
1609
+ s0 = peg$currPos;
1610
+ s1 = peg$currPos;
1611
+ peg$silentFails++;
1612
+ s2 = peg$parseInlineCommentOpen();
1613
+ peg$silentFails--;
1614
+ if (s2 === peg$FAILED) {
1615
+ s1 = void 0;
1616
+ } else {
1617
+ peg$currPos = s1;
1618
+ s1 = peg$FAILED;
1619
+ }
1620
+ if (s1 !== peg$FAILED) {
1621
+ s2 = peg$currPos;
1622
+ peg$silentFails++;
1623
+ s3 = peg$parseLineTerminator();
1624
+ peg$silentFails--;
1625
+ if (s3 === peg$FAILED) {
1626
+ s2 = void 0;
1627
+ } else {
1628
+ peg$currPos = s2;
1629
+ s2 = peg$FAILED;
1630
+ }
1631
+ if (s2 !== peg$FAILED) {
1632
+ s3 = peg$parseNonTerminator();
1633
+ if (s3 !== peg$FAILED) {
1634
+ peg$savedPos = s0;
1635
+ s1 = peg$c53(s3);
1636
+ s0 = s1;
1637
+ } else {
1638
+ peg$currPos = s0;
1639
+ s0 = peg$FAILED;
1640
+ }
1641
+ } else {
1642
+ peg$currPos = s0;
1643
+ s0 = peg$FAILED;
1644
+ }
1645
+ } else {
1646
+ peg$currPos = s0;
1647
+ s0 = peg$FAILED;
1648
+ }
1649
+
1650
+ return s0;
1651
+ }
1652
+
1653
+ function peg$parseNonTerminator() {
1654
+ var s0;
1655
+
1656
+ if (peg$c58.test(input.charAt(peg$currPos))) {
1657
+ s0 = input.charAt(peg$currPos);
1658
+ peg$currPos++;
1659
+ } else {
1660
+ s0 = peg$FAILED;
1661
+ if (peg$silentFails === 0) { peg$fail(peg$c59); }
1662
+ }
1663
+
1664
+ return s0;
1665
+ }
1666
+
1667
+ function peg$parseSingleLineComment() {
1668
+ var s0, s1, s2, s3, s4;
1669
+
1670
+ s0 = peg$currPos;
1671
+ if (input.substr(peg$currPos, 2) === peg$c60) {
1672
+ s1 = peg$c60;
1673
+ peg$currPos += 2;
1674
+ } else {
1675
+ s1 = peg$FAILED;
1676
+ if (peg$silentFails === 0) { peg$fail(peg$c61); }
1677
+ }
1678
+ if (s1 !== peg$FAILED) {
1679
+ s2 = peg$parse_();
1680
+ if (s2 !== peg$FAILED) {
1681
+ s3 = peg$parseOneLineString();
1682
+ if (s3 !== peg$FAILED) {
1683
+ s4 = peg$parseNewLine();
1684
+ if (s4 !== peg$FAILED) {
1685
+ peg$savedPos = s0;
1686
+ s1 = peg$c62(s3);
1687
+ s0 = s1;
1688
+ } else {
1689
+ peg$currPos = s0;
1690
+ s0 = peg$FAILED;
1691
+ }
1692
+ } else {
1693
+ peg$currPos = s0;
1694
+ s0 = peg$FAILED;
1695
+ }
1696
+ } else {
1697
+ peg$currPos = s0;
1698
+ s0 = peg$FAILED;
1699
+ }
1700
+ } else {
1701
+ peg$currPos = s0;
1702
+ s0 = peg$FAILED;
1703
+ }
1704
+
1705
+ return s0;
1706
+ }
1707
+
1708
+ function peg$parseOneLineString() {
1709
+ var s0, s1, s2;
1710
+
1711
+ s0 = peg$currPos;
1712
+ s1 = [];
1713
+ s2 = peg$parseNonLine();
1714
+ while (s2 !== peg$FAILED) {
1715
+ s1.push(s2);
1716
+ s2 = peg$parseNonLine();
1717
+ }
1718
+ if (s1 !== peg$FAILED) {
1719
+ peg$savedPos = s0;
1720
+ s1 = peg$c63(s1);
1721
+ }
1722
+ s0 = s1;
1723
+
1724
+ return s0;
1725
+ }
1726
+
1727
+ function peg$parseDigit() {
1728
+ var s0;
1729
+
1730
+ if (peg$c64.test(input.charAt(peg$currPos))) {
1731
+ s0 = input.charAt(peg$currPos);
1732
+ peg$currPos++;
1733
+ } else {
1734
+ s0 = peg$FAILED;
1735
+ if (peg$silentFails === 0) { peg$fail(peg$c65); }
1736
+ }
1737
+
1738
+ return s0;
1739
+ }
1740
+
1741
+ function peg$parseAlpha() {
1742
+ var s0;
1743
+
1744
+ if (peg$c66.test(input.charAt(peg$currPos))) {
1745
+ s0 = input.charAt(peg$currPos);
1746
+ peg$currPos++;
1747
+ } else {
1748
+ s0 = peg$FAILED;
1749
+ if (peg$silentFails === 0) { peg$fail(peg$c67); }
1750
+ }
1751
+
1752
+ return s0;
1753
+ }
1754
+
1755
+ function peg$parseDoubleQuote() {
1756
+ var s0;
1757
+
1758
+ if (input.charCodeAt(peg$currPos) === 34) {
1759
+ s0 = peg$c68;
1760
+ peg$currPos++;
1761
+ } else {
1762
+ s0 = peg$FAILED;
1763
+ if (peg$silentFails === 0) { peg$fail(peg$c69); }
1764
+ }
1765
+
1766
+ return s0;
1767
+ }
1768
+
1769
+ function peg$parse_() {
1770
+ var s0, s1;
1771
+
1772
+ peg$silentFails++;
1773
+ s0 = [];
1774
+ s1 = peg$parsewhitespace();
1775
+ while (s1 !== peg$FAILED) {
1776
+ s0.push(s1);
1777
+ s1 = peg$parsewhitespace();
1778
+ }
1779
+ peg$silentFails--;
1780
+ if (s0 === peg$FAILED) {
1781
+ s1 = peg$FAILED;
1782
+ if (peg$silentFails === 0) { peg$fail(peg$c70); }
1783
+ }
1784
+
1785
+ return s0;
1786
+ }
1787
+
1788
+ function peg$parsewhitespace() {
1789
+ var s0;
1790
+
1791
+ s0 = peg$parseNewLine();
1792
+ if (s0 === peg$FAILED) {
1793
+ if (peg$c71.test(input.charAt(peg$currPos))) {
1794
+ s0 = input.charAt(peg$currPos);
1795
+ peg$currPos++;
1796
+ } else {
1797
+ s0 = peg$FAILED;
1798
+ if (peg$silentFails === 0) { peg$fail(peg$c72); }
1799
+ }
1800
+ }
1801
+
1802
+ return s0;
1803
+ }
1804
+
1805
+ function peg$parseNonLine() {
1806
+ var s0, s1, s2;
1807
+
1808
+ s0 = peg$currPos;
1809
+ s1 = peg$currPos;
1810
+ peg$silentFails++;
1811
+ s2 = peg$parseNewLine();
1812
+ peg$silentFails--;
1813
+ if (s2 === peg$FAILED) {
1814
+ s1 = void 0;
1815
+ } else {
1816
+ peg$currPos = s1;
1817
+ s1 = peg$FAILED;
1818
+ }
1819
+ if (s1 !== peg$FAILED) {
1820
+ s2 = peg$parseChar();
1821
+ if (s2 !== peg$FAILED) {
1822
+ peg$savedPos = s0;
1823
+ s1 = peg$c53(s2);
1824
+ s0 = s1;
1825
+ } else {
1826
+ peg$currPos = s0;
1827
+ s0 = peg$FAILED;
1828
+ }
1829
+ } else {
1830
+ peg$currPos = s0;
1831
+ s0 = peg$FAILED;
1832
+ }
1833
+
1834
+ return s0;
1835
+ }
1836
+
1837
+ function peg$parseLineTerminator() {
1838
+ var s0;
1839
+
1840
+ s0 = peg$parseNewLine();
1841
+ if (s0 === peg$FAILED) {
1842
+ if (input.charCodeAt(peg$currPos) === 59) {
1843
+ s0 = peg$c10;
1844
+ peg$currPos++;
1845
+ } else {
1846
+ s0 = peg$FAILED;
1847
+ if (peg$silentFails === 0) { peg$fail(peg$c11); }
1848
+ }
1849
+ }
1850
+
1851
+ return s0;
1852
+ }
1853
+
1854
+ function peg$parseNewLine() {
1855
+ var s0;
1856
+
1857
+ if (peg$c73.test(input.charAt(peg$currPos))) {
1858
+ s0 = input.charAt(peg$currPos);
1859
+ peg$currPos++;
1860
+ } else {
1861
+ s0 = peg$FAILED;
1862
+ if (peg$silentFails === 0) { peg$fail(peg$c74); }
1863
+ }
1864
+
1865
+ return s0;
1866
+ }
1867
+
1868
+ function peg$parseChar() {
1869
+ var s0;
1870
+
1871
+ if (input.length > peg$currPos) {
1872
+ s0 = input.charAt(peg$currPos);
1873
+ peg$currPos++;
1874
+ } else {
1875
+ s0 = peg$FAILED;
1876
+ if (peg$silentFails === 0) { peg$fail(peg$c52); }
1877
+ }
1878
+
1879
+ return s0;
1880
+ }
1881
+
1882
+ peg$result = peg$startRuleFunction();
1883
+
1884
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
1885
+ return peg$result;
1886
+ } else {
1887
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1888
+ peg$fail(peg$endExpectation());
1889
+ }
1890
+
1891
+ throw peg$buildStructuredError(
1892
+ peg$maxFailExpected,
1893
+ peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
1894
+ peg$maxFailPos < input.length
1895
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1896
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1897
+ );
1898
+ }
1899
+ }
1900
+
1901
+ module.exports = {
1902
+ SyntaxError: peg$SyntaxError,
1903
+ parse: peg$parse
1904
+ };