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