@garrix82/reactgenie-dsl 1.0.1 → 1.0.2

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 (104) hide show
  1. package/.env +10 -0
  2. package/.env.example +17 -0
  3. package/.github/workflows/publish.yml +20 -0
  4. package/package.json +1 -5
  5. package/dist/__test__/dsl-descriptor.test.d.ts +0 -1
  6. package/dist/__test__/dsl-descriptor.test.js +0 -27
  7. package/dist/__test__/dsl-descriptor.test.js.map +0 -1
  8. package/dist/__test__/example_descriptor.d.ts +0 -125
  9. package/dist/__test__/example_descriptor.js +0 -607
  10. package/dist/__test__/example_descriptor.js.map +0 -1
  11. package/dist/__test__/food_descriptor.state.json +0 -1
  12. package/dist/__test__/food_descriptor.test.d.ts +0 -74
  13. package/dist/__test__/food_descriptor.test.js +0 -205
  14. package/dist/__test__/food_descriptor.test.js.map +0 -1
  15. package/dist/__test__/nl-interpreter-provider-selection.test.d.ts +0 -1
  16. package/dist/__test__/nl-interpreter-provider-selection.test.js +0 -73
  17. package/dist/__test__/nl-interpreter-provider-selection.test.js.map +0 -1
  18. package/dist/__test__/nl-interpreter.test.d.ts +0 -1
  19. package/dist/__test__/nl-interpreter.test.js +0 -86
  20. package/dist/__test__/nl-interpreter.test.js.map +0 -1
  21. package/dist/decorators/__test__/decorators.test.d.ts +0 -1
  22. package/dist/decorators/__test__/decorators.test.js +0 -182
  23. package/dist/decorators/__test__/decorators.test.js.map +0 -1
  24. package/dist/decorators/__test__/inheritance-descriptor.test.d.ts +0 -1
  25. package/dist/decorators/__test__/inheritance-descriptor.test.js +0 -107
  26. package/dist/decorators/__test__/inheritance-descriptor.test.js.map +0 -1
  27. package/dist/dsl/__test__/dsl-interpreter.test.d.ts +0 -1
  28. package/dist/dsl/__test__/dsl-interpreter.test.js +0 -334
  29. package/dist/dsl/__test__/dsl-interpreter.test.js.map +0 -1
  30. package/dist/dsl/__test__/parser.gen.test.d.ts +0 -1
  31. package/dist/dsl/__test__/parser.gen.test.js +0 -283
  32. package/dist/dsl/__test__/parser.gen.test.js.map +0 -1
  33. package/dist/nl/__test__/context-aware-prompt.test.d.ts +0 -1
  34. package/dist/nl/__test__/context-aware-prompt.test.js +0 -247
  35. package/dist/nl/__test__/context-aware-prompt.test.js.map +0 -1
  36. package/dist/nl/__test__/context-selector.test.d.ts +0 -1
  37. package/dist/nl/__test__/context-selector.test.js +0 -20
  38. package/dist/nl/__test__/context-selector.test.js.map +0 -1
  39. package/dist/nl/__test__/nl-parser-groq-transport.test.d.ts +0 -1
  40. package/dist/nl/__test__/nl-parser-groq-transport.test.js +0 -87
  41. package/dist/nl/__test__/nl-parser-groq-transport.test.js.map +0 -1
  42. package/dist/nl/__test__/nl-parser-openai-parity.test.d.ts +0 -1
  43. package/dist/nl/__test__/nl-parser-openai-parity.test.js +0 -206
  44. package/dist/nl/__test__/nl-parser-openai-parity.test.js.map +0 -1
  45. package/dist/nl/__test__/nl-parser-openai-sampling.test.d.ts +0 -1
  46. package/dist/nl/__test__/nl-parser-openai-sampling.test.js +0 -44
  47. package/dist/nl/__test__/nl-parser-openai-sampling.test.js.map +0 -1
  48. package/dist/nl/__test__/nl-parser-openai-transport.test.d.ts +0 -1
  49. package/dist/nl/__test__/nl-parser-openai-transport.test.js +0 -55
  50. package/dist/nl/__test__/nl-parser-openai-transport.test.js.map +0 -1
  51. package/dist/nl/__test__/nl-parser-utils.test.d.ts +0 -1
  52. package/dist/nl/__test__/nl-parser-utils.test.js +0 -70
  53. package/dist/nl/__test__/nl-parser-utils.test.js.map +0 -1
  54. package/dist/nl/__test__/nl-parser.test.d.ts +0 -1
  55. package/dist/nl/__test__/nl-parser.test.js +0 -64
  56. package/dist/nl/__test__/nl-parser.test.js.map +0 -1
  57. package/dist/nl/__test__/parameter-tuning.test.d.ts +0 -1
  58. package/dist/nl/__test__/parameter-tuning.test.js +0 -95
  59. package/dist/nl/__test__/parameter-tuning.test.js.map +0 -1
  60. package/dist/nl/__test__/semantic-parsing-experiment.test.d.ts +0 -1
  61. package/dist/nl/__test__/semantic-parsing-experiment.test.js +0 -178
  62. package/dist/nl/__test__/semantic-parsing-experiment.test.js.map +0 -1
  63. package/dist/nl/llm-monitoring.test.d.ts +0 -5
  64. package/dist/nl/llm-monitoring.test.js +0 -101
  65. package/dist/nl/llm-monitoring.test.js.map +0 -1
  66. package/lib/__test__/dsl-descriptor.test.ts +0 -27
  67. package/lib/__test__/example_descriptor.ts +0 -762
  68. package/lib/__test__/food_descriptor.state.json +0 -1
  69. package/lib/__test__/food_descriptor.test.ts +0 -331
  70. package/lib/__test__/nl-interpreter-provider-selection.test.ts +0 -126
  71. package/lib/__test__/nl-interpreter.test.ts +0 -129
  72. package/lib/decorators/__test__/decorators.test.ts +0 -177
  73. package/lib/decorators/__test__/inheritance-descriptor.test.ts +0 -92
  74. package/lib/decorators/decorators.ts +0 -754
  75. package/lib/decorators/index.ts +0 -2
  76. package/lib/decorators/store.ts +0 -47
  77. package/lib/dsl/__test__/dsl-interpreter.test.ts +0 -453
  78. package/lib/dsl/__test__/parser.gen.test.ts +0 -296
  79. package/lib/dsl/dsl-interpreter.ts +0 -974
  80. package/lib/dsl/index.ts +0 -1
  81. package/lib/dsl/parser.gen.js +0 -1479
  82. package/lib/dsl/parser.pegjs +0 -130
  83. package/lib/dsl-descriptor.ts +0 -241
  84. package/lib/index.ts +0 -5
  85. package/lib/nl/__test__/context-aware-prompt.test.ts +0 -372
  86. package/lib/nl/__test__/context-selector.test.ts +0 -27
  87. package/lib/nl/__test__/nl-parser-groq-transport.test.ts +0 -139
  88. package/lib/nl/__test__/nl-parser-openai-parity.test.ts +0 -381
  89. package/lib/nl/__test__/nl-parser-openai-sampling.test.ts +0 -73
  90. package/lib/nl/__test__/nl-parser-openai-transport.test.ts +0 -79
  91. package/lib/nl/__test__/nl-parser-utils.test.ts +0 -98
  92. package/lib/nl/__test__/nl-parser.test.ts +0 -119
  93. package/lib/nl/__test__/parameter-tuning.test.ts +0 -137
  94. package/lib/nl/__test__/semantic-parsing-experiment.test.ts +0 -260
  95. package/lib/nl/context-selector.ts +0 -123
  96. package/lib/nl/index.ts +0 -19
  97. package/lib/nl/llm-monitoring.test.ts +0 -136
  98. package/lib/nl/llm-monitoring.ts +0 -339
  99. package/lib/nl/nl-parser-groq.ts +0 -510
  100. package/lib/nl/nl-parser-utils.ts +0 -310
  101. package/lib/nl/nl-parser.ts +0 -616
  102. package/lib/nl/prompt-gen.ts +0 -607
  103. package/lib/nl/prompt-res.ts +0 -207
  104. package/lib/nl-interpreter.ts +0 -262
@@ -1,1479 +0,0 @@
1
- // Generated by Peggy 3.0.2.
2
- //
3
- // https://peggyjs.org/
4
-
5
- "use strict";
6
-
7
- function peg$subclass(child, parent) {
8
- function C() { this.constructor = child; }
9
- C.prototype = parent.prototype;
10
- child.prototype = new C();
11
- }
12
-
13
- function peg$SyntaxError(message, expected, found, location) {
14
- var self = Error.call(this, message);
15
- // istanbul ignore next Check is a necessary evil to support older environments
16
- if (Object.setPrototypeOf) {
17
- Object.setPrototypeOf(self, peg$SyntaxError.prototype);
18
- }
19
- self.expected = expected;
20
- self.found = found;
21
- self.location = location;
22
- self.name = "SyntaxError";
23
- return self;
24
- }
25
-
26
- peg$subclass(peg$SyntaxError, Error);
27
-
28
- function peg$padEnd(str, targetLength, padString) {
29
- padString = padString || " ";
30
- if (str.length > targetLength) { return str; }
31
- targetLength -= str.length;
32
- padString += padString.repeat(targetLength);
33
- return str + padString.slice(0, targetLength);
34
- }
35
-
36
- peg$SyntaxError.prototype.format = function(sources) {
37
- var str = "Error: " + this.message;
38
- if (this.location) {
39
- var src = null;
40
- var k;
41
- for (k = 0; k < sources.length; k++) {
42
- if (sources[k].source === this.location.source) {
43
- src = sources[k].text.split(/\r\n|\n|\r/g);
44
- break;
45
- }
46
- }
47
- var s = this.location.start;
48
- var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
49
- ? this.location.source.offset(s)
50
- : s;
51
- var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
52
- if (src) {
53
- var e = this.location.end;
54
- var filler = peg$padEnd("", offset_s.line.toString().length, ' ');
55
- var line = src[s.line - 1];
56
- var last = s.line === e.line ? e.column : line.length + 1;
57
- var hatLen = (last - s.column) || 1;
58
- str += "\n --> " + loc + "\n"
59
- + filler + " |\n"
60
- + offset_s.line + " | " + line + "\n"
61
- + filler + " | " + peg$padEnd("", s.column - 1, ' ')
62
- + peg$padEnd("", hatLen, "^");
63
- } else {
64
- str += "\n at " + loc;
65
- }
66
- }
67
- return str;
68
- };
69
-
70
- peg$SyntaxError.buildMessage = function(expected, found) {
71
- var DESCRIBE_EXPECTATION_FNS = {
72
- literal: function(expectation) {
73
- return "\"" + literalEscape(expectation.text) + "\"";
74
- },
75
-
76
- class: function(expectation) {
77
- var escapedParts = expectation.parts.map(function(part) {
78
- return Array.isArray(part)
79
- ? classEscape(part[0]) + "-" + classEscape(part[1])
80
- : classEscape(part);
81
- });
82
-
83
- return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
84
- },
85
-
86
- any: function() {
87
- return "any character";
88
- },
89
-
90
- end: function() {
91
- return "end of input";
92
- },
93
-
94
- other: function(expectation) {
95
- return expectation.description;
96
- }
97
- };
98
-
99
- function hex(ch) {
100
- return ch.charCodeAt(0).toString(16).toUpperCase();
101
- }
102
-
103
- function literalEscape(s) {
104
- return s
105
- .replace(/\\/g, "\\\\")
106
- .replace(/"/g, "\\\"")
107
- .replace(/\0/g, "\\0")
108
- .replace(/\t/g, "\\t")
109
- .replace(/\n/g, "\\n")
110
- .replace(/\r/g, "\\r")
111
- .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
112
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
113
- }
114
-
115
- function classEscape(s) {
116
- return s
117
- .replace(/\\/g, "\\\\")
118
- .replace(/\]/g, "\\]")
119
- .replace(/\^/g, "\\^")
120
- .replace(/-/g, "\\-")
121
- .replace(/\0/g, "\\0")
122
- .replace(/\t/g, "\\t")
123
- .replace(/\n/g, "\\n")
124
- .replace(/\r/g, "\\r")
125
- .replace(/[\x00-\x0F]/g, function(ch) { return "\\x0" + hex(ch); })
126
- .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); });
127
- }
128
-
129
- function describeExpectation(expectation) {
130
- return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
131
- }
132
-
133
- function describeExpected(expected) {
134
- var descriptions = expected.map(describeExpectation);
135
- var i, j;
136
-
137
- descriptions.sort();
138
-
139
- if (descriptions.length > 0) {
140
- for (i = 1, j = 1; i < descriptions.length; i++) {
141
- if (descriptions[i - 1] !== descriptions[i]) {
142
- descriptions[j] = descriptions[i];
143
- j++;
144
- }
145
- }
146
- descriptions.length = j;
147
- }
148
-
149
- switch (descriptions.length) {
150
- case 1:
151
- return descriptions[0];
152
-
153
- case 2:
154
- return descriptions[0] + " or " + descriptions[1];
155
-
156
- default:
157
- return descriptions.slice(0, -1).join(", ")
158
- + ", or "
159
- + descriptions[descriptions.length - 1];
160
- }
161
- }
162
-
163
- function describeFound(found) {
164
- return found ? "\"" + literalEscape(found) + "\"" : "end of input";
165
- }
166
-
167
- return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
168
- };
169
-
170
- function peg$parse(input, options) {
171
- options = options !== undefined ? options : {};
172
-
173
- var peg$FAILED = {};
174
- var peg$source = options.grammarSource;
175
-
176
- var peg$startRuleFunctions = { top: peg$parsetop };
177
- var peg$startRuleFunction = peg$parsetop;
178
-
179
- var peg$c0 = ";";
180
- var peg$c1 = ".";
181
- var peg$c2 = "[";
182
- var peg$c3 = "]";
183
- var peg$c4 = "(";
184
- var peg$c5 = ")";
185
- var peg$c6 = ",";
186
- var peg$c7 = ":";
187
- var peg$c8 = "true";
188
- var peg$c9 = "false";
189
- var peg$c10 = "\"";
190
- var peg$c11 = "+";
191
- var peg$c12 = "-";
192
-
193
- var peg$r0 = /^[^"]/;
194
- var peg$r1 = /^[0-9]/;
195
- var peg$r2 = /^[a-zA-Z_]/;
196
- var peg$r3 = /^[a-zA-Z0-9_]/;
197
- var peg$r4 = /^[1-9]/;
198
- var peg$r5 = /^[ \t\r\n]/;
199
-
200
- var peg$e0 = peg$literalExpectation(";", false);
201
- var peg$e1 = peg$literalExpectation(".", false);
202
- var peg$e2 = peg$literalExpectation("[", false);
203
- var peg$e3 = peg$literalExpectation("]", false);
204
- var peg$e4 = peg$literalExpectation("(", false);
205
- var peg$e5 = peg$literalExpectation(")", false);
206
- var peg$e6 = peg$literalExpectation(",", false);
207
- var peg$e7 = peg$literalExpectation(":", false);
208
- var peg$e8 = peg$literalExpectation("true", false);
209
- var peg$e9 = peg$literalExpectation("false", false);
210
- var peg$e10 = peg$literalExpectation("\"", false);
211
- var peg$e11 = peg$classExpectation(["\""], true, false);
212
- var peg$e12 = peg$literalExpectation("+", false);
213
- var peg$e13 = peg$literalExpectation("-", false);
214
- var peg$e14 = peg$classExpectation([["0", "9"]], false, false);
215
- var peg$e15 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false);
216
- var peg$e16 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false);
217
- var peg$e17 = peg$classExpectation([["1", "9"]], false, false);
218
- var peg$e18 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false);
219
-
220
- var peg$f0 = function(s, sl) {
221
- return [s].concat(
222
- sl.map((e) => {
223
- return e[3];
224
- }).reduce((acc, cur) => {
225
- if (cur !== null) {
226
- acc.push(cur);
227
- }
228
- return acc;
229
- }, [])
230
- );
231
- };
232
- var peg$f1 = function(s) {
233
- return s
234
- };
235
- var peg$f2 = function(s, l) {
236
- if (l !== null) {
237
- var last_l_parent = null;
238
- l = l[1];
239
- var l_parent = l;
240
- while (l_parent.parent !== undefined) {
241
- last_l_parent = l_parent;
242
- l_parent = l_parent.parent;
243
- }
244
- if (last_l_parent !== null) {
245
- last_l_parent.parent = {
246
- type: "access",
247
- parent: s,
248
- access: l_parent
249
- };
250
- } else {
251
- l = {
252
- type: "access",
253
- parent: s,
254
- access: l_parent
255
- }
256
- }
257
- return l;
258
- } else {
259
- return s;
260
- }
261
- };
262
- var peg$f3 = function(p, i) {
263
- var return_value = p;
264
- for (var index_element of i) {
265
- return_value = {
266
- type: "index",
267
- parent: return_value,
268
- index: index_element[1]
269
- };
270
- }
271
- return return_value;
272
- };
273
- var peg$f4 = function(func_name, pl) {
274
- debug('function_call', func_name, pl);
275
- return {
276
- type: 'function_call',
277
- func_name: func_name,
278
- parameters: pl !== null ? pl.parameters : null
279
- };
280
- };
281
- var peg$f5 = function(pp, pl) {
282
- debug('parameter_list', pp, pl);
283
- return {"parameters": pl.reduce((acc, cur) => {
284
- acc.push(cur[3]);
285
- return acc;
286
- }, [pp])};
287
- };
288
- var peg$f6 = function(sy, v) {
289
- return {"parameter": sy, "value": v};
290
- };
291
- var peg$f7 = function() {
292
- return { type: "boolean", value: true };
293
- };
294
- var peg$f8 = function() {
295
- return { type: "boolean", value: false };
296
- };
297
- var peg$f9 = function(fl) {
298
- return {"type": "float", "value": fl};
299
- };
300
- var peg$f10 = function(il) {
301
- return {"type": "int", "value": il};
302
- };
303
- var peg$f11 = function(s) {
304
- return s;
305
- };
306
- var peg$f12 = function(s) {
307
- return { type: "string", value: s.join("") };
308
- };
309
- var peg$f13 = function(s) {
310
- return { type: "array", value: s };
311
- };
312
- var peg$f14 = function(s) {
313
- return {"type": "accessor", "field": s};
314
- };
315
- var peg$f15 = function(s, i, f) {
316
- return parseFloat((s === "-" ? "-" : "") + i.join("") + "." + f.join(""));
317
- };
318
- var peg$f16 = function(vi, iv) {
319
- return iv.reduce((acc, cur) => {
320
- acc.push(cur[3]);
321
- return acc;
322
- }, [vi]);
323
- };
324
- var peg$f17 = function() {
325
- return text();
326
- };
327
- var peg$f18 = function(s, i) {
328
- return parseInt((s === "-" ? "-" : "") + i.join(""));
329
- };
330
- var peg$currPos = 0;
331
- var peg$savedPos = 0;
332
- var peg$posDetailsCache = [{ line: 1, column: 1 }];
333
- var peg$maxFailPos = 0;
334
- var peg$maxFailExpected = [];
335
- var peg$silentFails = 0;
336
-
337
- var peg$result;
338
-
339
- if ("startRule" in options) {
340
- if (!(options.startRule in peg$startRuleFunctions)) {
341
- throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
342
- }
343
-
344
- peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
345
- }
346
-
347
- function text() {
348
- return input.substring(peg$savedPos, peg$currPos);
349
- }
350
-
351
- function offset() {
352
- return peg$savedPos;
353
- }
354
-
355
- function range() {
356
- return {
357
- source: peg$source,
358
- start: peg$savedPos,
359
- end: peg$currPos
360
- };
361
- }
362
-
363
- function location() {
364
- return peg$computeLocation(peg$savedPos, peg$currPos);
365
- }
366
-
367
- function expected(description, location) {
368
- location = location !== undefined
369
- ? location
370
- : peg$computeLocation(peg$savedPos, peg$currPos);
371
-
372
- throw peg$buildStructuredError(
373
- [peg$otherExpectation(description)],
374
- input.substring(peg$savedPos, peg$currPos),
375
- location
376
- );
377
- }
378
-
379
- function error(message, location) {
380
- location = location !== undefined
381
- ? location
382
- : peg$computeLocation(peg$savedPos, peg$currPos);
383
-
384
- throw peg$buildSimpleError(message, location);
385
- }
386
-
387
- function peg$literalExpectation(text, ignoreCase) {
388
- return { type: "literal", text: text, ignoreCase: ignoreCase };
389
- }
390
-
391
- function peg$classExpectation(parts, inverted, ignoreCase) {
392
- return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
393
- }
394
-
395
- function peg$anyExpectation() {
396
- return { type: "any" };
397
- }
398
-
399
- function peg$endExpectation() {
400
- return { type: "end" };
401
- }
402
-
403
- function peg$otherExpectation(description) {
404
- return { type: "other", description: description };
405
- }
406
-
407
- function peg$computePosDetails(pos) {
408
- var details = peg$posDetailsCache[pos];
409
- var p;
410
-
411
- if (details) {
412
- return details;
413
- } else {
414
- p = pos - 1;
415
- while (!peg$posDetailsCache[p]) {
416
- p--;
417
- }
418
-
419
- details = peg$posDetailsCache[p];
420
- details = {
421
- line: details.line,
422
- column: details.column
423
- };
424
-
425
- while (p < pos) {
426
- if (input.charCodeAt(p) === 10) {
427
- details.line++;
428
- details.column = 1;
429
- } else {
430
- details.column++;
431
- }
432
-
433
- p++;
434
- }
435
-
436
- peg$posDetailsCache[pos] = details;
437
-
438
- return details;
439
- }
440
- }
441
-
442
- function peg$computeLocation(startPos, endPos, offset) {
443
- var startPosDetails = peg$computePosDetails(startPos);
444
- var endPosDetails = peg$computePosDetails(endPos);
445
-
446
- var res = {
447
- source: peg$source,
448
- start: {
449
- offset: startPos,
450
- line: startPosDetails.line,
451
- column: startPosDetails.column
452
- },
453
- end: {
454
- offset: endPos,
455
- line: endPosDetails.line,
456
- column: endPosDetails.column
457
- }
458
- };
459
- if (offset && peg$source && (typeof peg$source.offset === "function")) {
460
- res.start = peg$source.offset(res.start);
461
- res.end = peg$source.offset(res.end);
462
- }
463
- return res;
464
- }
465
-
466
- function peg$fail(expected) {
467
- if (peg$currPos < peg$maxFailPos) { return; }
468
-
469
- if (peg$currPos > peg$maxFailPos) {
470
- peg$maxFailPos = peg$currPos;
471
- peg$maxFailExpected = [];
472
- }
473
-
474
- peg$maxFailExpected.push(expected);
475
- }
476
-
477
- function peg$buildSimpleError(message, location) {
478
- return new peg$SyntaxError(message, null, null, location);
479
- }
480
-
481
- function peg$buildStructuredError(expected, found, location) {
482
- return new peg$SyntaxError(
483
- peg$SyntaxError.buildMessage(expected, found),
484
- expected,
485
- found,
486
- location
487
- );
488
- }
489
-
490
- function peg$parsetop() {
491
- var s0, s1, s2, s3, s4, s5, s6, s7;
492
-
493
- s0 = peg$currPos;
494
- s1 = peg$parsestatement();
495
- if (s1 !== peg$FAILED) {
496
- s2 = [];
497
- s3 = peg$currPos;
498
- s4 = [];
499
- s5 = peg$parseSP();
500
- while (s5 !== peg$FAILED) {
501
- s4.push(s5);
502
- s5 = peg$parseSP();
503
- }
504
- if (input.charCodeAt(peg$currPos) === 59) {
505
- s5 = peg$c0;
506
- peg$currPos++;
507
- } else {
508
- s5 = peg$FAILED;
509
- if (peg$silentFails === 0) { peg$fail(peg$e0); }
510
- }
511
- if (s5 !== peg$FAILED) {
512
- s6 = [];
513
- s7 = peg$parseSP();
514
- while (s7 !== peg$FAILED) {
515
- s6.push(s7);
516
- s7 = peg$parseSP();
517
- }
518
- s7 = peg$parsestatement();
519
- if (s7 === peg$FAILED) {
520
- s7 = null;
521
- }
522
- s4 = [s4, s5, s6, s7];
523
- s3 = s4;
524
- } else {
525
- peg$currPos = s3;
526
- s3 = peg$FAILED;
527
- }
528
- while (s3 !== peg$FAILED) {
529
- s2.push(s3);
530
- s3 = peg$currPos;
531
- s4 = [];
532
- s5 = peg$parseSP();
533
- while (s5 !== peg$FAILED) {
534
- s4.push(s5);
535
- s5 = peg$parseSP();
536
- }
537
- if (input.charCodeAt(peg$currPos) === 59) {
538
- s5 = peg$c0;
539
- peg$currPos++;
540
- } else {
541
- s5 = peg$FAILED;
542
- if (peg$silentFails === 0) { peg$fail(peg$e0); }
543
- }
544
- if (s5 !== peg$FAILED) {
545
- s6 = [];
546
- s7 = peg$parseSP();
547
- while (s7 !== peg$FAILED) {
548
- s6.push(s7);
549
- s7 = peg$parseSP();
550
- }
551
- s7 = peg$parsestatement();
552
- if (s7 === peg$FAILED) {
553
- s7 = null;
554
- }
555
- s4 = [s4, s5, s6, s7];
556
- s3 = s4;
557
- } else {
558
- peg$currPos = s3;
559
- s3 = peg$FAILED;
560
- }
561
- }
562
- peg$savedPos = s0;
563
- s0 = peg$f0(s1, s2);
564
- } else {
565
- peg$currPos = s0;
566
- s0 = peg$FAILED;
567
- }
568
-
569
- return s0;
570
- }
571
-
572
- function peg$parsestatement() {
573
- var s0, s1, s2, s3;
574
-
575
- s0 = peg$currPos;
576
- s1 = peg$parsevalue();
577
- if (s1 === peg$FAILED) {
578
- s1 = peg$parseall_symbol();
579
- }
580
- if (s1 !== peg$FAILED) {
581
- s2 = [];
582
- s3 = peg$parseSP();
583
- while (s3 !== peg$FAILED) {
584
- s2.push(s3);
585
- s3 = peg$parseSP();
586
- }
587
- peg$savedPos = s0;
588
- s0 = peg$f1(s1);
589
- } else {
590
- peg$currPos = s0;
591
- s0 = peg$FAILED;
592
- }
593
-
594
- return s0;
595
- }
596
-
597
- function peg$parseall_symbol() {
598
- var s0, s1, s2, s3, s4;
599
-
600
- s0 = peg$currPos;
601
- s1 = peg$parseindex_symbol();
602
- if (s1 !== peg$FAILED) {
603
- s2 = peg$currPos;
604
- if (input.charCodeAt(peg$currPos) === 46) {
605
- s3 = peg$c1;
606
- peg$currPos++;
607
- } else {
608
- s3 = peg$FAILED;
609
- if (peg$silentFails === 0) { peg$fail(peg$e1); }
610
- }
611
- if (s3 !== peg$FAILED) {
612
- s4 = peg$parseall_symbol();
613
- if (s4 !== peg$FAILED) {
614
- s3 = [s3, s4];
615
- s2 = s3;
616
- } else {
617
- peg$currPos = s2;
618
- s2 = peg$FAILED;
619
- }
620
- } else {
621
- peg$currPos = s2;
622
- s2 = peg$FAILED;
623
- }
624
- if (s2 === peg$FAILED) {
625
- s2 = null;
626
- }
627
- peg$savedPos = s0;
628
- s0 = peg$f2(s1, s2);
629
- } else {
630
- peg$currPos = s0;
631
- s0 = peg$FAILED;
632
- }
633
-
634
- return s0;
635
- }
636
-
637
- function peg$parseindex_symbol() {
638
- var s0, s1, s2, s3, s4, s5, s6;
639
-
640
- s0 = peg$currPos;
641
- s1 = peg$parsefunction_call();
642
- if (s1 === peg$FAILED) {
643
- s1 = peg$parsesymbol();
644
- }
645
- if (s1 !== peg$FAILED) {
646
- s2 = [];
647
- s3 = peg$currPos;
648
- if (input.charCodeAt(peg$currPos) === 91) {
649
- s4 = peg$c2;
650
- peg$currPos++;
651
- } else {
652
- s4 = peg$FAILED;
653
- if (peg$silentFails === 0) { peg$fail(peg$e2); }
654
- }
655
- if (s4 !== peg$FAILED) {
656
- s5 = peg$parseint_literal();
657
- if (s5 !== peg$FAILED) {
658
- if (input.charCodeAt(peg$currPos) === 93) {
659
- s6 = peg$c3;
660
- peg$currPos++;
661
- } else {
662
- s6 = peg$FAILED;
663
- if (peg$silentFails === 0) { peg$fail(peg$e3); }
664
- }
665
- if (s6 !== peg$FAILED) {
666
- s4 = [s4, s5, s6];
667
- s3 = s4;
668
- } else {
669
- peg$currPos = s3;
670
- s3 = peg$FAILED;
671
- }
672
- } else {
673
- peg$currPos = s3;
674
- s3 = peg$FAILED;
675
- }
676
- } else {
677
- peg$currPos = s3;
678
- s3 = peg$FAILED;
679
- }
680
- while (s3 !== peg$FAILED) {
681
- s2.push(s3);
682
- s3 = peg$currPos;
683
- if (input.charCodeAt(peg$currPos) === 91) {
684
- s4 = peg$c2;
685
- peg$currPos++;
686
- } else {
687
- s4 = peg$FAILED;
688
- if (peg$silentFails === 0) { peg$fail(peg$e2); }
689
- }
690
- if (s4 !== peg$FAILED) {
691
- s5 = peg$parseint_literal();
692
- if (s5 !== peg$FAILED) {
693
- if (input.charCodeAt(peg$currPos) === 93) {
694
- s6 = peg$c3;
695
- peg$currPos++;
696
- } else {
697
- s6 = peg$FAILED;
698
- if (peg$silentFails === 0) { peg$fail(peg$e3); }
699
- }
700
- if (s6 !== peg$FAILED) {
701
- s4 = [s4, s5, s6];
702
- s3 = s4;
703
- } else {
704
- peg$currPos = s3;
705
- s3 = peg$FAILED;
706
- }
707
- } else {
708
- peg$currPos = s3;
709
- s3 = peg$FAILED;
710
- }
711
- } else {
712
- peg$currPos = s3;
713
- s3 = peg$FAILED;
714
- }
715
- }
716
- peg$savedPos = s0;
717
- s0 = peg$f3(s1, s2);
718
- } else {
719
- peg$currPos = s0;
720
- s0 = peg$FAILED;
721
- }
722
-
723
- return s0;
724
- }
725
-
726
- function peg$parsefunction_call() {
727
- var s0, s1, s2, s3, s4, s5, s6, s7;
728
-
729
- s0 = peg$currPos;
730
- s1 = peg$parsesymbol();
731
- if (s1 !== peg$FAILED) {
732
- s2 = [];
733
- s3 = peg$parseSP();
734
- while (s3 !== peg$FAILED) {
735
- s2.push(s3);
736
- s3 = peg$parseSP();
737
- }
738
- if (input.charCodeAt(peg$currPos) === 40) {
739
- s3 = peg$c4;
740
- peg$currPos++;
741
- } else {
742
- s3 = peg$FAILED;
743
- if (peg$silentFails === 0) { peg$fail(peg$e4); }
744
- }
745
- if (s3 !== peg$FAILED) {
746
- s4 = [];
747
- s5 = peg$parseSP();
748
- while (s5 !== peg$FAILED) {
749
- s4.push(s5);
750
- s5 = peg$parseSP();
751
- }
752
- s5 = peg$parseparameter_list();
753
- if (s5 === peg$FAILED) {
754
- s5 = null;
755
- }
756
- s6 = [];
757
- s7 = peg$parseSP();
758
- while (s7 !== peg$FAILED) {
759
- s6.push(s7);
760
- s7 = peg$parseSP();
761
- }
762
- if (input.charCodeAt(peg$currPos) === 41) {
763
- s7 = peg$c5;
764
- peg$currPos++;
765
- } else {
766
- s7 = peg$FAILED;
767
- if (peg$silentFails === 0) { peg$fail(peg$e5); }
768
- }
769
- if (s7 !== peg$FAILED) {
770
- peg$savedPos = s0;
771
- s0 = peg$f4(s1, s5);
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
-
785
- return s0;
786
- }
787
-
788
- function peg$parseparameter_list() {
789
- var s0, s1, s2, s3, s4, s5, s6, s7;
790
-
791
- s0 = peg$currPos;
792
- s1 = peg$parseparameter_pair();
793
- if (s1 !== peg$FAILED) {
794
- s2 = [];
795
- s3 = peg$currPos;
796
- s4 = [];
797
- s5 = peg$parseSP();
798
- while (s5 !== peg$FAILED) {
799
- s4.push(s5);
800
- s5 = peg$parseSP();
801
- }
802
- if (input.charCodeAt(peg$currPos) === 44) {
803
- s5 = peg$c6;
804
- peg$currPos++;
805
- } else {
806
- s5 = peg$FAILED;
807
- if (peg$silentFails === 0) { peg$fail(peg$e6); }
808
- }
809
- if (s5 !== peg$FAILED) {
810
- s6 = [];
811
- s7 = peg$parseSP();
812
- while (s7 !== peg$FAILED) {
813
- s6.push(s7);
814
- s7 = peg$parseSP();
815
- }
816
- s7 = peg$parseparameter_pair();
817
- if (s7 !== peg$FAILED) {
818
- s4 = [s4, s5, s6, s7];
819
- s3 = s4;
820
- } else {
821
- peg$currPos = s3;
822
- s3 = peg$FAILED;
823
- }
824
- } else {
825
- peg$currPos = s3;
826
- s3 = peg$FAILED;
827
- }
828
- while (s3 !== peg$FAILED) {
829
- s2.push(s3);
830
- s3 = peg$currPos;
831
- s4 = [];
832
- s5 = peg$parseSP();
833
- while (s5 !== peg$FAILED) {
834
- s4.push(s5);
835
- s5 = peg$parseSP();
836
- }
837
- if (input.charCodeAt(peg$currPos) === 44) {
838
- s5 = peg$c6;
839
- peg$currPos++;
840
- } else {
841
- s5 = peg$FAILED;
842
- if (peg$silentFails === 0) { peg$fail(peg$e6); }
843
- }
844
- if (s5 !== peg$FAILED) {
845
- s6 = [];
846
- s7 = peg$parseSP();
847
- while (s7 !== peg$FAILED) {
848
- s6.push(s7);
849
- s7 = peg$parseSP();
850
- }
851
- s7 = peg$parseparameter_pair();
852
- if (s7 !== peg$FAILED) {
853
- s4 = [s4, s5, s6, s7];
854
- s3 = s4;
855
- } else {
856
- peg$currPos = s3;
857
- s3 = peg$FAILED;
858
- }
859
- } else {
860
- peg$currPos = s3;
861
- s3 = peg$FAILED;
862
- }
863
- }
864
- peg$savedPos = s0;
865
- s0 = peg$f5(s1, s2);
866
- } else {
867
- peg$currPos = s0;
868
- s0 = peg$FAILED;
869
- }
870
-
871
- return s0;
872
- }
873
-
874
- function peg$parseparameter_pair() {
875
- var s0, s1, s2, s3, s4, s5;
876
-
877
- s0 = peg$currPos;
878
- s1 = peg$parsesymbol();
879
- if (s1 !== peg$FAILED) {
880
- s2 = [];
881
- s3 = peg$parseSP();
882
- while (s3 !== peg$FAILED) {
883
- s2.push(s3);
884
- s3 = peg$parseSP();
885
- }
886
- if (input.charCodeAt(peg$currPos) === 58) {
887
- s3 = peg$c7;
888
- peg$currPos++;
889
- } else {
890
- s3 = peg$FAILED;
891
- if (peg$silentFails === 0) { peg$fail(peg$e7); }
892
- }
893
- if (s3 !== peg$FAILED) {
894
- s4 = [];
895
- s5 = peg$parseSP();
896
- while (s5 !== peg$FAILED) {
897
- s4.push(s5);
898
- s5 = peg$parseSP();
899
- }
900
- s5 = peg$parsevalue();
901
- if (s5 === peg$FAILED) {
902
- s5 = peg$parseaccessor();
903
- }
904
- if (s5 !== peg$FAILED) {
905
- peg$savedPos = s0;
906
- s0 = peg$f6(s1, s5);
907
- } else {
908
- peg$currPos = s0;
909
- s0 = peg$FAILED;
910
- }
911
- } else {
912
- peg$currPos = s0;
913
- s0 = peg$FAILED;
914
- }
915
- } else {
916
- peg$currPos = s0;
917
- s0 = peg$FAILED;
918
- }
919
-
920
- return s0;
921
- }
922
-
923
- function peg$parsevalue() {
924
- var s0, s1, s2, s3, s4, s5;
925
-
926
- s0 = peg$currPos;
927
- if (input.substr(peg$currPos, 4) === peg$c8) {
928
- s1 = peg$c8;
929
- peg$currPos += 4;
930
- } else {
931
- s1 = peg$FAILED;
932
- if (peg$silentFails === 0) { peg$fail(peg$e8); }
933
- }
934
- if (s1 !== peg$FAILED) {
935
- peg$savedPos = s0;
936
- s1 = peg$f7();
937
- }
938
- s0 = s1;
939
- if (s0 === peg$FAILED) {
940
- s0 = peg$currPos;
941
- if (input.substr(peg$currPos, 5) === peg$c9) {
942
- s1 = peg$c9;
943
- peg$currPos += 5;
944
- } else {
945
- s1 = peg$FAILED;
946
- if (peg$silentFails === 0) { peg$fail(peg$e9); }
947
- }
948
- if (s1 !== peg$FAILED) {
949
- peg$savedPos = s0;
950
- s1 = peg$f8();
951
- }
952
- s0 = s1;
953
- if (s0 === peg$FAILED) {
954
- s0 = peg$currPos;
955
- s1 = peg$parsefloat_literal();
956
- if (s1 !== peg$FAILED) {
957
- peg$savedPos = s0;
958
- s1 = peg$f9(s1);
959
- }
960
- s0 = s1;
961
- if (s0 === peg$FAILED) {
962
- s0 = peg$currPos;
963
- s1 = peg$parseint_literal();
964
- if (s1 !== peg$FAILED) {
965
- peg$savedPos = s0;
966
- s1 = peg$f10(s1);
967
- }
968
- s0 = s1;
969
- if (s0 === peg$FAILED) {
970
- s0 = peg$currPos;
971
- s1 = peg$parseall_symbol();
972
- if (s1 !== peg$FAILED) {
973
- peg$savedPos = s0;
974
- s1 = peg$f11(s1);
975
- }
976
- s0 = s1;
977
- if (s0 === peg$FAILED) {
978
- s0 = peg$currPos;
979
- if (input.charCodeAt(peg$currPos) === 34) {
980
- s1 = peg$c10;
981
- peg$currPos++;
982
- } else {
983
- s1 = peg$FAILED;
984
- if (peg$silentFails === 0) { peg$fail(peg$e10); }
985
- }
986
- if (s1 !== peg$FAILED) {
987
- s2 = [];
988
- if (peg$r0.test(input.charAt(peg$currPos))) {
989
- s3 = input.charAt(peg$currPos);
990
- peg$currPos++;
991
- } else {
992
- s3 = peg$FAILED;
993
- if (peg$silentFails === 0) { peg$fail(peg$e11); }
994
- }
995
- while (s3 !== peg$FAILED) {
996
- s2.push(s3);
997
- if (peg$r0.test(input.charAt(peg$currPos))) {
998
- s3 = input.charAt(peg$currPos);
999
- peg$currPos++;
1000
- } else {
1001
- s3 = peg$FAILED;
1002
- if (peg$silentFails === 0) { peg$fail(peg$e11); }
1003
- }
1004
- }
1005
- if (input.charCodeAt(peg$currPos) === 34) {
1006
- s3 = peg$c10;
1007
- peg$currPos++;
1008
- } else {
1009
- s3 = peg$FAILED;
1010
- if (peg$silentFails === 0) { peg$fail(peg$e10); }
1011
- }
1012
- if (s3 !== peg$FAILED) {
1013
- peg$savedPos = s0;
1014
- s0 = peg$f12(s2);
1015
- } else {
1016
- peg$currPos = s0;
1017
- s0 = peg$FAILED;
1018
- }
1019
- } else {
1020
- peg$currPos = s0;
1021
- s0 = peg$FAILED;
1022
- }
1023
- if (s0 === peg$FAILED) {
1024
- s0 = peg$currPos;
1025
- if (input.charCodeAt(peg$currPos) === 91) {
1026
- s1 = peg$c2;
1027
- peg$currPos++;
1028
- } else {
1029
- s1 = peg$FAILED;
1030
- if (peg$silentFails === 0) { peg$fail(peg$e2); }
1031
- }
1032
- if (s1 !== peg$FAILED) {
1033
- s2 = [];
1034
- s3 = peg$parseSP();
1035
- while (s3 !== peg$FAILED) {
1036
- s2.push(s3);
1037
- s3 = peg$parseSP();
1038
- }
1039
- s3 = peg$parsearray_value();
1040
- if (s3 !== peg$FAILED) {
1041
- s4 = [];
1042
- s5 = peg$parseSP();
1043
- while (s5 !== peg$FAILED) {
1044
- s4.push(s5);
1045
- s5 = peg$parseSP();
1046
- }
1047
- if (input.charCodeAt(peg$currPos) === 93) {
1048
- s5 = peg$c3;
1049
- peg$currPos++;
1050
- } else {
1051
- s5 = peg$FAILED;
1052
- if (peg$silentFails === 0) { peg$fail(peg$e3); }
1053
- }
1054
- if (s5 !== peg$FAILED) {
1055
- peg$savedPos = s0;
1056
- s0 = peg$f13(s3);
1057
- } else {
1058
- peg$currPos = s0;
1059
- s0 = peg$FAILED;
1060
- }
1061
- } else {
1062
- peg$currPos = s0;
1063
- s0 = peg$FAILED;
1064
- }
1065
- } else {
1066
- peg$currPos = s0;
1067
- s0 = peg$FAILED;
1068
- }
1069
- }
1070
- }
1071
- }
1072
- }
1073
- }
1074
- }
1075
-
1076
- return s0;
1077
- }
1078
-
1079
- function peg$parseaccessor() {
1080
- var s0, s1, s2;
1081
-
1082
- s0 = peg$currPos;
1083
- if (input.charCodeAt(peg$currPos) === 46) {
1084
- s1 = peg$c1;
1085
- peg$currPos++;
1086
- } else {
1087
- s1 = peg$FAILED;
1088
- if (peg$silentFails === 0) { peg$fail(peg$e1); }
1089
- }
1090
- if (s1 !== peg$FAILED) {
1091
- s2 = peg$parseall_symbol();
1092
- if (s2 !== peg$FAILED) {
1093
- peg$savedPos = s0;
1094
- s0 = peg$f14(s2);
1095
- } else {
1096
- peg$currPos = s0;
1097
- s0 = peg$FAILED;
1098
- }
1099
- } else {
1100
- peg$currPos = s0;
1101
- s0 = peg$FAILED;
1102
- }
1103
-
1104
- return s0;
1105
- }
1106
-
1107
- function peg$parsefloat_literal() {
1108
- var s0, s1, s2, s3, s4, s5;
1109
-
1110
- s0 = peg$currPos;
1111
- if (input.charCodeAt(peg$currPos) === 43) {
1112
- s1 = peg$c11;
1113
- peg$currPos++;
1114
- } else {
1115
- s1 = peg$FAILED;
1116
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
1117
- }
1118
- if (s1 === peg$FAILED) {
1119
- if (input.charCodeAt(peg$currPos) === 45) {
1120
- s1 = peg$c12;
1121
- peg$currPos++;
1122
- } else {
1123
- s1 = peg$FAILED;
1124
- if (peg$silentFails === 0) { peg$fail(peg$e13); }
1125
- }
1126
- }
1127
- if (s1 === peg$FAILED) {
1128
- s1 = null;
1129
- }
1130
- s2 = [];
1131
- if (peg$r1.test(input.charAt(peg$currPos))) {
1132
- s3 = input.charAt(peg$currPos);
1133
- peg$currPos++;
1134
- } else {
1135
- s3 = peg$FAILED;
1136
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1137
- }
1138
- if (s3 !== peg$FAILED) {
1139
- while (s3 !== peg$FAILED) {
1140
- s2.push(s3);
1141
- if (peg$r1.test(input.charAt(peg$currPos))) {
1142
- s3 = input.charAt(peg$currPos);
1143
- peg$currPos++;
1144
- } else {
1145
- s3 = peg$FAILED;
1146
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1147
- }
1148
- }
1149
- } else {
1150
- s2 = peg$FAILED;
1151
- }
1152
- if (s2 !== peg$FAILED) {
1153
- if (input.charCodeAt(peg$currPos) === 46) {
1154
- s3 = peg$c1;
1155
- peg$currPos++;
1156
- } else {
1157
- s3 = peg$FAILED;
1158
- if (peg$silentFails === 0) { peg$fail(peg$e1); }
1159
- }
1160
- if (s3 !== peg$FAILED) {
1161
- s4 = [];
1162
- if (peg$r1.test(input.charAt(peg$currPos))) {
1163
- s5 = input.charAt(peg$currPos);
1164
- peg$currPos++;
1165
- } else {
1166
- s5 = peg$FAILED;
1167
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1168
- }
1169
- if (s5 !== peg$FAILED) {
1170
- while (s5 !== peg$FAILED) {
1171
- s4.push(s5);
1172
- if (peg$r1.test(input.charAt(peg$currPos))) {
1173
- s5 = input.charAt(peg$currPos);
1174
- peg$currPos++;
1175
- } else {
1176
- s5 = peg$FAILED;
1177
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1178
- }
1179
- }
1180
- } else {
1181
- s4 = peg$FAILED;
1182
- }
1183
- if (s4 !== peg$FAILED) {
1184
- peg$savedPos = s0;
1185
- s0 = peg$f15(s1, s2, s4);
1186
- } else {
1187
- peg$currPos = s0;
1188
- s0 = peg$FAILED;
1189
- }
1190
- } else {
1191
- peg$currPos = s0;
1192
- s0 = peg$FAILED;
1193
- }
1194
- } else {
1195
- peg$currPos = s0;
1196
- s0 = peg$FAILED;
1197
- }
1198
-
1199
- return s0;
1200
- }
1201
-
1202
- function peg$parsearray_value() {
1203
- var s0, s1, s2, s3, s4, s5, s6, s7;
1204
-
1205
- s0 = peg$currPos;
1206
- s1 = peg$parsevalue();
1207
- if (s1 !== peg$FAILED) {
1208
- s2 = [];
1209
- s3 = peg$currPos;
1210
- s4 = [];
1211
- s5 = peg$parseSP();
1212
- while (s5 !== peg$FAILED) {
1213
- s4.push(s5);
1214
- s5 = peg$parseSP();
1215
- }
1216
- if (input.charCodeAt(peg$currPos) === 44) {
1217
- s5 = peg$c6;
1218
- peg$currPos++;
1219
- } else {
1220
- s5 = peg$FAILED;
1221
- if (peg$silentFails === 0) { peg$fail(peg$e6); }
1222
- }
1223
- if (s5 !== peg$FAILED) {
1224
- s6 = [];
1225
- s7 = peg$parseSP();
1226
- while (s7 !== peg$FAILED) {
1227
- s6.push(s7);
1228
- s7 = peg$parseSP();
1229
- }
1230
- s7 = peg$parsevalue();
1231
- if (s7 !== peg$FAILED) {
1232
- s4 = [s4, s5, s6, s7];
1233
- s3 = s4;
1234
- } else {
1235
- peg$currPos = s3;
1236
- s3 = peg$FAILED;
1237
- }
1238
- } else {
1239
- peg$currPos = s3;
1240
- s3 = peg$FAILED;
1241
- }
1242
- while (s3 !== peg$FAILED) {
1243
- s2.push(s3);
1244
- s3 = peg$currPos;
1245
- s4 = [];
1246
- s5 = peg$parseSP();
1247
- while (s5 !== peg$FAILED) {
1248
- s4.push(s5);
1249
- s5 = peg$parseSP();
1250
- }
1251
- if (input.charCodeAt(peg$currPos) === 44) {
1252
- s5 = peg$c6;
1253
- peg$currPos++;
1254
- } else {
1255
- s5 = peg$FAILED;
1256
- if (peg$silentFails === 0) { peg$fail(peg$e6); }
1257
- }
1258
- if (s5 !== peg$FAILED) {
1259
- s6 = [];
1260
- s7 = peg$parseSP();
1261
- while (s7 !== peg$FAILED) {
1262
- s6.push(s7);
1263
- s7 = peg$parseSP();
1264
- }
1265
- s7 = peg$parsevalue();
1266
- if (s7 !== peg$FAILED) {
1267
- s4 = [s4, s5, s6, s7];
1268
- s3 = s4;
1269
- } else {
1270
- peg$currPos = s3;
1271
- s3 = peg$FAILED;
1272
- }
1273
- } else {
1274
- peg$currPos = s3;
1275
- s3 = peg$FAILED;
1276
- }
1277
- }
1278
- peg$savedPos = s0;
1279
- s0 = peg$f16(s1, s2);
1280
- } else {
1281
- peg$currPos = s0;
1282
- s0 = peg$FAILED;
1283
- }
1284
-
1285
- return s0;
1286
- }
1287
-
1288
- function peg$parsesymbol() {
1289
- var s0, s1, s2, s3;
1290
-
1291
- s0 = peg$currPos;
1292
- if (peg$r2.test(input.charAt(peg$currPos))) {
1293
- s1 = input.charAt(peg$currPos);
1294
- peg$currPos++;
1295
- } else {
1296
- s1 = peg$FAILED;
1297
- if (peg$silentFails === 0) { peg$fail(peg$e15); }
1298
- }
1299
- if (s1 !== peg$FAILED) {
1300
- s2 = [];
1301
- if (peg$r3.test(input.charAt(peg$currPos))) {
1302
- s3 = input.charAt(peg$currPos);
1303
- peg$currPos++;
1304
- } else {
1305
- s3 = peg$FAILED;
1306
- if (peg$silentFails === 0) { peg$fail(peg$e16); }
1307
- }
1308
- while (s3 !== peg$FAILED) {
1309
- s2.push(s3);
1310
- if (peg$r3.test(input.charAt(peg$currPos))) {
1311
- s3 = input.charAt(peg$currPos);
1312
- peg$currPos++;
1313
- } else {
1314
- s3 = peg$FAILED;
1315
- if (peg$silentFails === 0) { peg$fail(peg$e16); }
1316
- }
1317
- }
1318
- peg$savedPos = s0;
1319
- s0 = peg$f17();
1320
- } else {
1321
- peg$currPos = s0;
1322
- s0 = peg$FAILED;
1323
- }
1324
-
1325
- return s0;
1326
- }
1327
-
1328
- function peg$parseint_literal() {
1329
- var s0, s1, s2, s3;
1330
-
1331
- s0 = peg$currPos;
1332
- if (input.charCodeAt(peg$currPos) === 43) {
1333
- s1 = peg$c11;
1334
- peg$currPos++;
1335
- } else {
1336
- s1 = peg$FAILED;
1337
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
1338
- }
1339
- if (s1 === peg$FAILED) {
1340
- if (input.charCodeAt(peg$currPos) === 45) {
1341
- s1 = peg$c12;
1342
- peg$currPos++;
1343
- } else {
1344
- s1 = peg$FAILED;
1345
- if (peg$silentFails === 0) { peg$fail(peg$e13); }
1346
- }
1347
- }
1348
- if (s1 === peg$FAILED) {
1349
- s1 = null;
1350
- }
1351
- s2 = [];
1352
- if (peg$r1.test(input.charAt(peg$currPos))) {
1353
- s3 = input.charAt(peg$currPos);
1354
- peg$currPos++;
1355
- } else {
1356
- s3 = peg$FAILED;
1357
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1358
- }
1359
- if (s3 !== peg$FAILED) {
1360
- while (s3 !== peg$FAILED) {
1361
- s2.push(s3);
1362
- if (peg$r1.test(input.charAt(peg$currPos))) {
1363
- s3 = input.charAt(peg$currPos);
1364
- peg$currPos++;
1365
- } else {
1366
- s3 = peg$FAILED;
1367
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1368
- }
1369
- }
1370
- } else {
1371
- s2 = peg$FAILED;
1372
- }
1373
- if (s2 !== peg$FAILED) {
1374
- peg$savedPos = s0;
1375
- s0 = peg$f18(s1, s2);
1376
- } else {
1377
- peg$currPos = s0;
1378
- s0 = peg$FAILED;
1379
- }
1380
-
1381
- return s0;
1382
- }
1383
-
1384
- function peg$parseINTDIGIT() {
1385
- var s0;
1386
-
1387
- if (peg$r4.test(input.charAt(peg$currPos))) {
1388
- s0 = input.charAt(peg$currPos);
1389
- peg$currPos++;
1390
- } else {
1391
- s0 = peg$FAILED;
1392
- if (peg$silentFails === 0) { peg$fail(peg$e17); }
1393
- }
1394
-
1395
- return s0;
1396
- }
1397
-
1398
- function peg$parseSIGN() {
1399
- var s0;
1400
-
1401
- if (input.charCodeAt(peg$currPos) === 43) {
1402
- s0 = peg$c11;
1403
- peg$currPos++;
1404
- } else {
1405
- s0 = peg$FAILED;
1406
- if (peg$silentFails === 0) { peg$fail(peg$e12); }
1407
- }
1408
- if (s0 === peg$FAILED) {
1409
- if (input.charCodeAt(peg$currPos) === 45) {
1410
- s0 = peg$c12;
1411
- peg$currPos++;
1412
- } else {
1413
- s0 = peg$FAILED;
1414
- if (peg$silentFails === 0) { peg$fail(peg$e13); }
1415
- }
1416
- }
1417
-
1418
- return s0;
1419
- }
1420
-
1421
- function peg$parseDIGIT() {
1422
- var s0;
1423
-
1424
- if (peg$r1.test(input.charAt(peg$currPos))) {
1425
- s0 = input.charAt(peg$currPos);
1426
- peg$currPos++;
1427
- } else {
1428
- s0 = peg$FAILED;
1429
- if (peg$silentFails === 0) { peg$fail(peg$e14); }
1430
- }
1431
-
1432
- return s0;
1433
- }
1434
-
1435
- function peg$parseSP() {
1436
- var s0;
1437
-
1438
- if (peg$r5.test(input.charAt(peg$currPos))) {
1439
- s0 = input.charAt(peg$currPos);
1440
- peg$currPos++;
1441
- } else {
1442
- s0 = peg$FAILED;
1443
- if (peg$silentFails === 0) { peg$fail(peg$e18); }
1444
- }
1445
-
1446
- return s0;
1447
- }
1448
-
1449
-
1450
- const DEBUGGING = false;
1451
- const debug = (...args) => {
1452
- if (DEBUGGING) {
1453
- console.log('DEBUG: ' + args)
1454
- }
1455
- }
1456
-
1457
- peg$result = peg$startRuleFunction();
1458
-
1459
- if (peg$result !== peg$FAILED && peg$currPos === input.length) {
1460
- return peg$result;
1461
- } else {
1462
- if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1463
- peg$fail(peg$endExpectation());
1464
- }
1465
-
1466
- throw peg$buildStructuredError(
1467
- peg$maxFailExpected,
1468
- peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
1469
- peg$maxFailPos < input.length
1470
- ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1471
- : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1472
- );
1473
- }
1474
- }
1475
-
1476
- module.exports = {
1477
- SyntaxError: peg$SyntaxError,
1478
- parse: peg$parse
1479
- };