state-machine-cat 10.1.6 → 10.1.7

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/bin/smcat.mjs +5 -4
  2. package/dist/commonjs/bundle.js +67 -67
  3. package/{src → dist/esm}/cli/actions.mjs +24 -40
  4. package/dist/esm/cli/attributes-parser.mjs +981 -0
  5. package/dist/esm/cli/file-name-to-stream.mjs +13 -0
  6. package/dist/esm/cli/make-description.mjs +21 -0
  7. package/dist/esm/cli/normalize.mjs +95 -0
  8. package/dist/esm/cli/validations.mjs +70 -0
  9. package/dist/esm/index-node.mjs +16 -0
  10. package/dist/esm/index.mjs +19 -0
  11. package/dist/esm/options.mjs +61 -0
  12. package/dist/esm/parse/index.mjs +27 -0
  13. package/dist/esm/parse/parser-helpers.mjs +175 -0
  14. package/dist/esm/parse/scxml/index.mjs +136 -0
  15. package/dist/esm/parse/scxml/normalize-machine.mjs +44 -0
  16. package/dist/esm/parse/smcat/smcat-parser.mjs +2924 -0
  17. package/dist/esm/parse/smcat-ast.schema.mjs +170 -0
  18. package/dist/esm/render/dot/attributebuilder.mjs +51 -0
  19. package/dist/esm/render/dot/counter.mjs +16 -0
  20. package/dist/esm/render/dot/dot.states.template.js +26 -0
  21. package/dist/esm/render/dot/dot.template.js +14 -0
  22. package/dist/esm/render/dot/index.mjs +106 -0
  23. package/dist/esm/render/dot/render-dot-from-ast.js +29 -0
  24. package/dist/esm/render/dot/state-transformers.mjs +113 -0
  25. package/dist/esm/render/dot/transition-transformers.mjs +49 -0
  26. package/dist/esm/render/dot/utl.mjs +29 -0
  27. package/dist/esm/render/index-node.mjs +28 -0
  28. package/dist/esm/render/index.mjs +20 -0
  29. package/dist/esm/render/scjson/index.mjs +121 -0
  30. package/dist/esm/render/scjson/make-valid-event-names.mjs +27 -0
  31. package/dist/esm/render/scjson/make-valid-xml-name.mjs +19 -0
  32. package/dist/esm/render/scxml/index.mjs +4 -0
  33. package/dist/esm/render/scxml/render-from-scjson.js +9 -0
  34. package/dist/esm/render/scxml/scxml.states.template.js +14 -0
  35. package/dist/esm/render/scxml/scxml.template.js +6 -0
  36. package/dist/esm/render/smcat/index.js +63 -0
  37. package/dist/esm/render/smcat/smcat.template.js +13 -0
  38. package/dist/esm/render/vector/dot-to-vector-native.mjs +35 -0
  39. package/dist/esm/render/vector/vector-native-dot-with-fallback.mjs +37 -0
  40. package/dist/esm/render/vector/vector-with-viz-js.mjs +13 -0
  41. package/dist/esm/state-machine-model.mjs +58 -0
  42. package/dist/esm/transform/desugar.mjs +77 -0
  43. package/dist/esm/transform/utl.mjs +16 -0
  44. package/dist/esm/version.mjs +1 -0
  45. package/package.json +32 -41
  46. package/src/render/dot/dot.states.template.js +1 -1
  47. package/src/render/dot/index.mjs +14 -14
  48. package/types/state-machine-cat.d.ts +4 -4
  49. package/src/cli/file-name-to-stream.mjs +0 -25
  50. package/src/cli/make-description.mjs +0 -45
  51. package/src/cli/normalize.mjs +0 -204
  52. package/src/cli/validations.mjs +0 -140
  53. package/src/index-node.mjs +0 -55
  54. package/src/index.mjs +0 -58
  55. package/src/options.mjs +0 -78
  56. package/src/parse/index.mjs +0 -47
  57. package/src/parse/parser-helpers.mjs +0 -297
  58. package/src/parse/scxml/normalize-machine.mjs +0 -73
  59. package/src/parse/smcat-ast.schema.mjs +0 -187
  60. package/src/render/dot/attributebuilder.mjs +0 -68
  61. package/src/render/dot/counter.mjs +0 -33
  62. package/src/render/dot/render-dot-from-ast.js +0 -70
  63. package/src/render/dot/state-transformers.mjs +0 -128
  64. package/src/render/dot/transition-transformers.mjs +0 -52
  65. package/src/render/dot/utl.mjs +0 -56
  66. package/src/render/index-node.mjs +0 -36
  67. package/src/render/index.mjs +0 -22
  68. package/src/render/scjson/index.mjs +0 -175
  69. package/src/render/scjson/make-valid-event-names.mjs +0 -71
  70. package/src/render/scjson/make-valid-xml-name.mjs +0 -70
  71. package/src/render/scxml/index.mjs +0 -8
  72. package/src/render/smcat/index.js +0 -129
  73. package/src/render/vector/dot-to-vector-native.mjs +0 -60
  74. package/src/render/vector/vector-native-dot-with-fallback.mjs +0 -55
  75. package/src/render/vector/vector-with-viz-js.mjs +0 -18
  76. package/src/state-machine-model.mjs +0 -124
  77. package/src/transform/desugar.mjs +0 -222
  78. package/src/transform/utl.mjs +0 -26
  79. package/src/version.mjs +0 -2
@@ -0,0 +1,2924 @@
1
+ import parserHelpers from "../parser-helpers.mjs";
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 loc = this.location.source + ":" + s.line + ":" + s.column;
41
+ if (src) {
42
+ var e = this.location.end;
43
+ var filler = peg$padEnd("", s.line.toString().length, ' ');
44
+ var line = src[s.line - 1];
45
+ var last = s.line === e.line ? e.column : line.length + 1;
46
+ var hatLen = (last - s.column) || 1;
47
+ str += "\n --> " + loc + "\n"
48
+ + filler + " |\n"
49
+ + s.line + " | " + line + "\n"
50
+ + filler + " | " + peg$padEnd("", s.column - 1, ' ')
51
+ + peg$padEnd("", hatLen, "^");
52
+ }
53
+ else {
54
+ str += "\n at " + loc;
55
+ }
56
+ }
57
+ return str;
58
+ };
59
+ peg$SyntaxError.buildMessage = function (expected, found) {
60
+ var DESCRIBE_EXPECTATION_FNS = {
61
+ literal: function (expectation) {
62
+ return "\"" + literalEscape(expectation.text) + "\"";
63
+ },
64
+ class: function (expectation) {
65
+ var escapedParts = expectation.parts.map(function (part) {
66
+ return Array.isArray(part)
67
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
68
+ : classEscape(part);
69
+ });
70
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
71
+ },
72
+ any: function () {
73
+ return "any character";
74
+ },
75
+ end: function () {
76
+ return "end of input";
77
+ },
78
+ other: function (expectation) {
79
+ return expectation.description;
80
+ }
81
+ };
82
+ function hex(ch) {
83
+ return ch.charCodeAt(0).toString(16).toUpperCase();
84
+ }
85
+ function literalEscape(s) {
86
+ return s
87
+ .replace(/\\/g, "\\\\")
88
+ .replace(/"/g, "\\\"")
89
+ .replace(/\0/g, "\\0")
90
+ .replace(/\t/g, "\\t")
91
+ .replace(/\n/g, "\\n")
92
+ .replace(/\r/g, "\\r")
93
+ .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
94
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
95
+ }
96
+ function classEscape(s) {
97
+ return s
98
+ .replace(/\\/g, "\\\\")
99
+ .replace(/\]/g, "\\]")
100
+ .replace(/\^/g, "\\^")
101
+ .replace(/-/g, "\\-")
102
+ .replace(/\0/g, "\\0")
103
+ .replace(/\t/g, "\\t")
104
+ .replace(/\n/g, "\\n")
105
+ .replace(/\r/g, "\\r")
106
+ .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); })
107
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); });
108
+ }
109
+ function describeExpectation(expectation) {
110
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
111
+ }
112
+ function describeExpected(expected) {
113
+ var descriptions = expected.map(describeExpectation);
114
+ var i, j;
115
+ descriptions.sort();
116
+ if (descriptions.length > 0) {
117
+ for (i = 1, j = 1; i < descriptions.length; i++) {
118
+ if (descriptions[i - 1] !== descriptions[i]) {
119
+ descriptions[j] = descriptions[i];
120
+ j++;
121
+ }
122
+ }
123
+ descriptions.length = j;
124
+ }
125
+ switch (descriptions.length) {
126
+ case 1:
127
+ return descriptions[0];
128
+ case 2:
129
+ return descriptions[0] + " or " + descriptions[1];
130
+ default:
131
+ return descriptions.slice(0, -1).join(", ")
132
+ + ", or "
133
+ + descriptions[descriptions.length - 1];
134
+ }
135
+ }
136
+ function describeFound(found) {
137
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
138
+ }
139
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
140
+ };
141
+ function peg$parse(input, options) {
142
+ options = options !== undefined ? options : {};
143
+ var peg$FAILED = {};
144
+ var peg$source = options.grammarSource;
145
+ var peg$startRuleFunctions = { program: peg$parseprogram };
146
+ var peg$startRuleFunction = peg$parseprogram;
147
+ var peg$c0 = ",";
148
+ var peg$c1 = ";";
149
+ var peg$c2 = "[";
150
+ var peg$c3 = "]";
151
+ var peg$c4 = ":";
152
+ var peg$c5 = "{";
153
+ var peg$c6 = "}";
154
+ var peg$c7 = "=";
155
+ var peg$c8 = "label";
156
+ var peg$c9 = "color";
157
+ var peg$c10 = "class";
158
+ var peg$c11 = "active";
159
+ var peg$c12 = "type";
160
+ var peg$c13 = "regular";
161
+ var peg$c14 = "initial";
162
+ var peg$c15 = "terminate";
163
+ var peg$c16 = "final";
164
+ var peg$c17 = "parallel";
165
+ var peg$c18 = "history";
166
+ var peg$c19 = "deephistory";
167
+ var peg$c20 = "choice";
168
+ var peg$c21 = "forkjoin";
169
+ var peg$c22 = "fork";
170
+ var peg$c23 = "join";
171
+ var peg$c24 = "junction";
172
+ var peg$c25 = "width";
173
+ var peg$c26 = "external";
174
+ var peg$c27 = "internal";
175
+ var peg$c28 = "->";
176
+ var peg$c29 = "=>>";
177
+ var peg$c30 = "=>";
178
+ var peg$c31 = ">>";
179
+ var peg$c32 = ":>";
180
+ var peg$c33 = "--";
181
+ var peg$c34 = "==";
182
+ var peg$c35 = "<-";
183
+ var peg$c36 = "<<=";
184
+ var peg$c37 = "<=";
185
+ var peg$c38 = "<<";
186
+ var peg$c39 = "<:";
187
+ var peg$c40 = "#";
188
+ var peg$c41 = ".";
189
+ var peg$c42 = "\"";
190
+ var peg$c43 = "\\\"";
191
+ var peg$c44 = "/*";
192
+ var peg$c45 = "*/";
193
+ var peg$c46 = "//";
194
+ var peg$r0 = /^[0-9]/;
195
+ var peg$r1 = /^[a-zA-Z0-9_\- ]/;
196
+ var peg$r2 = /^[^;, "\t\n\r=\-><:{[]/;
197
+ var peg$r3 = /^[ \t]/;
198
+ var peg$r4 = /^[\r\n]/;
199
+ var peg$r5 = /^[^\r\n]/;
200
+ var peg$e0 = peg$otherExpectation("statemachine");
201
+ var peg$e1 = peg$literalExpectation(",", false);
202
+ var peg$e2 = peg$literalExpectation(";", false);
203
+ var peg$e3 = peg$otherExpectation("state");
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("}", false);
209
+ var peg$e9 = peg$otherExpectation("extended state attributes");
210
+ var peg$e10 = peg$otherExpectation("extended state attribute");
211
+ var peg$e11 = peg$literalExpectation("=", false);
212
+ var peg$e12 = peg$otherExpectation("state attribute name");
213
+ var peg$e13 = peg$literalExpectation("label", true);
214
+ var peg$e14 = peg$literalExpectation("color", true);
215
+ var peg$e15 = peg$otherExpectation("class attribute");
216
+ var peg$e16 = peg$literalExpectation("class", true);
217
+ var peg$e17 = peg$otherExpectation("state flag");
218
+ var peg$e18 = peg$literalExpectation("active", true);
219
+ var peg$e19 = peg$otherExpectation("state type");
220
+ var peg$e20 = peg$literalExpectation("type", true);
221
+ var peg$e21 = peg$otherExpectation("state type type");
222
+ var peg$e22 = peg$literalExpectation("regular", false);
223
+ var peg$e23 = peg$literalExpectation("initial", false);
224
+ var peg$e24 = peg$literalExpectation("terminate", false);
225
+ var peg$e25 = peg$literalExpectation("final", false);
226
+ var peg$e26 = peg$literalExpectation("parallel", false);
227
+ var peg$e27 = peg$literalExpectation("history", false);
228
+ var peg$e28 = peg$literalExpectation("deephistory", false);
229
+ var peg$e29 = peg$literalExpectation("choice", false);
230
+ var peg$e30 = peg$literalExpectation("forkjoin", false);
231
+ var peg$e31 = peg$literalExpectation("fork", false);
232
+ var peg$e32 = peg$literalExpectation("join", false);
233
+ var peg$e33 = peg$literalExpectation("junction", false);
234
+ var peg$e34 = peg$otherExpectation("transition");
235
+ var peg$e35 = peg$otherExpectation("extended transition attributes");
236
+ var peg$e36 = peg$otherExpectation("extended transition attribute");
237
+ var peg$e37 = peg$otherExpectation("transition attribute name");
238
+ var peg$e38 = peg$otherExpectation("transition type name");
239
+ var peg$e39 = peg$otherExpectation("numeric transition attribute name");
240
+ var peg$e40 = peg$literalExpectation("width", true);
241
+ var peg$e41 = peg$otherExpectation("transition type value");
242
+ var peg$e42 = peg$literalExpectation("external", false);
243
+ var peg$e43 = peg$literalExpectation("internal", false);
244
+ var peg$e44 = peg$otherExpectation("left to right arrow");
245
+ var peg$e45 = peg$literalExpectation("->", false);
246
+ var peg$e46 = peg$literalExpectation("=>>", false);
247
+ var peg$e47 = peg$literalExpectation("=>", false);
248
+ var peg$e48 = peg$literalExpectation(">>", false);
249
+ var peg$e49 = peg$literalExpectation(":>", false);
250
+ var peg$e50 = peg$literalExpectation("--", false);
251
+ var peg$e51 = peg$literalExpectation("==", false);
252
+ var peg$e52 = peg$otherExpectation("right to left arrow");
253
+ var peg$e53 = peg$literalExpectation("<-", false);
254
+ var peg$e54 = peg$literalExpectation("<<=", false);
255
+ var peg$e55 = peg$literalExpectation("<=", false);
256
+ var peg$e56 = peg$literalExpectation("<<", false);
257
+ var peg$e57 = peg$literalExpectation("<:", false);
258
+ var peg$e58 = peg$literalExpectation("#", false);
259
+ var peg$e59 = peg$literalExpectation(".", false);
260
+ var peg$e60 = peg$classExpectation([["0", "9"]], false, false);
261
+ var peg$e61 = peg$otherExpectation("double quoted string");
262
+ var peg$e62 = peg$literalExpectation("\"", false);
263
+ var peg$e63 = peg$literalExpectation("\\\"", false);
264
+ var peg$e64 = peg$anyExpectation();
265
+ var peg$e65 = peg$otherExpectation("valid class string");
266
+ var peg$e66 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-", " "], false, false);
267
+ var peg$e67 = peg$otherExpectation("identifier");
268
+ var peg$e68 = peg$classExpectation([";", ",", " ", "\"", "\t", "\n", "\r", "=", "-", ">", "<", ":", "{", "["], true, false);
269
+ var peg$e69 = peg$otherExpectation("whitespace");
270
+ var peg$e70 = peg$classExpectation([" ", "\t"], false, false);
271
+ var peg$e71 = peg$otherExpectation("line end");
272
+ var peg$e72 = peg$classExpectation(["\r", "\n"], false, false);
273
+ var peg$e73 = peg$literalExpectation("/*", false);
274
+ var peg$e74 = peg$literalExpectation("*/", false);
275
+ var peg$e75 = peg$literalExpectation("//", false);
276
+ var peg$e76 = peg$classExpectation(["\r", "\n"], true, false);
277
+ var peg$e77 = peg$otherExpectation("comment");
278
+ var peg$f0 = function (statemachine) {
279
+ statemachine.states = parserHelpers.extractUndeclaredStates(statemachine);
280
+ return parserHelpers.classifyForkJoins(statemachine);
281
+ };
282
+ var peg$f1 = function (states, transitions) {
283
+ let lStateMachine = {};
284
+ parserHelpers.setIf(lStateMachine, 'states', states);
285
+ parserHelpers.setIfNotEmpty(lStateMachine, 'transitions', transitions);
286
+ return lStateMachine;
287
+ };
288
+ var peg$f2 = function (state) { return state; };
289
+ var peg$f3 = function (state) { return state; };
290
+ var peg$f4 = function (states) {
291
+ return parserHelpers.uniq(states[0].concat(states[1]), parserHelpers.stateEqual);
292
+ };
293
+ var peg$f5 = function (notes, id, attrs) { return attrs; };
294
+ var peg$f6 = function (notes, id, extended_state_attributes, act) { return act; };
295
+ var peg$f7 = function (notes, id, extended_state_attributes, actions, sm) { return sm; };
296
+ var peg$f8 = function (notes, id, extended_state_attributes, actions, statemachine) {
297
+ let lState = parserHelpers.initState(id);
298
+ (extended_state_attributes || []).forEach(pExtendedAttribute => parserHelpers.setIf(lState, pExtendedAttribute.name, pExtendedAttribute.value));
299
+ parserHelpers.setIf(lState, 'typeExplicitlySet', (extended_state_attributes || []).some(pExtendedAttribute => pExtendedAttribute.typeExplicitlySet));
300
+ parserHelpers.setIf(lState, 'statemachine', statemachine);
301
+ parserHelpers.setIfNotEmpty(lState, 'note', notes);
302
+ if (Boolean(actions)) {
303
+ parserHelpers.setIfNotEmpty(lState, 'actions', parserHelpers.extractActions(actions));
304
+ }
305
+ return lState;
306
+ };
307
+ var peg$f9 = function (name, value) {
308
+ return { name, value };
309
+ };
310
+ var peg$f10 = function (name, value) {
311
+ return { name, value };
312
+ };
313
+ var peg$f11 = function (name) {
314
+ return { name, value: true };
315
+ };
316
+ var peg$f12 = function (name, value) {
317
+ return { name, value, typeExplicitlySet: true };
318
+ };
319
+ var peg$f13 = function (name) {
320
+ return name.toLowerCase();
321
+ };
322
+ var peg$f14 = function (name) {
323
+ return name.toLowerCase();
324
+ };
325
+ var peg$f15 = function (name) {
326
+ return name.toLowerCase();
327
+ };
328
+ var peg$f16 = function (name) {
329
+ return name.toLowerCase();
330
+ };
331
+ var peg$f17 = function (notes, trans, attrs) { return attrs; };
332
+ var peg$f18 = function (notes, trans, extended_attributes, lbl) { return lbl; };
333
+ var peg$f19 = function (notes, trans, extended_attributes, label) {
334
+ if (label) {
335
+ trans.label = label;
336
+ trans = Object.assign(trans, parserHelpers.parseTransitionExpression(label));
337
+ }
338
+ (extended_attributes || []).forEach(pExtendedAttribute => parserHelpers.setIf(trans, pExtendedAttribute.name, pExtendedAttribute.value));
339
+ parserHelpers.setIfNotEmpty(trans, 'note', notes);
340
+ return trans;
341
+ };
342
+ var peg$f20 = function (from, to) {
343
+ return {
344
+ from: from,
345
+ to: to
346
+ };
347
+ };
348
+ var peg$f21 = function (to, from) {
349
+ return {
350
+ from: from,
351
+ to: to
352
+ };
353
+ };
354
+ var peg$f22 = function (name, value) {
355
+ return { name, value };
356
+ };
357
+ var peg$f23 = function (name, value) {
358
+ return { name, value };
359
+ };
360
+ var peg$f24 = function (name, value) {
361
+ return { name, value };
362
+ };
363
+ var peg$f25 = function (name, value) {
364
+ return { name, value };
365
+ };
366
+ var peg$f26 = function (name) {
367
+ return name.toLowerCase();
368
+ };
369
+ var peg$f27 = function (name) {
370
+ return name.toLowerCase();
371
+ };
372
+ var peg$f28 = function (name) {
373
+ return name;
374
+ };
375
+ var peg$f29 = function (com) {
376
+ return com.join("").trim();
377
+ };
378
+ var peg$f30 = function (digits) { return parseFloat(digits.join("")); };
379
+ var peg$f31 = function (digits) { return parseInt(digits.join(""), 10); };
380
+ var peg$f32 = function (s) { return s.join("").replace(/\\\"/g, "\""); };
381
+ var peg$f33 = function (c) { return c; };
382
+ var peg$f34 = function (s) { return s.join(""); };
383
+ var peg$f35 = function (c) { return c; };
384
+ var peg$f36 = function (s) { return s.join("").trim(); };
385
+ var peg$f37 = function (s) { return s.join("").trim(); };
386
+ var peg$f38 = function (c) { return c; };
387
+ var peg$f39 = function (c) { return c; };
388
+ var peg$f40 = function (chars) { return chars.join(""); };
389
+ var peg$f41 = function (c) { return c; };
390
+ var peg$f42 = function (c) { return c; };
391
+ var peg$f43 = function (c) { return c; };
392
+ var peg$f44 = function (start, com, end) {
393
+ return start + com.join("") + end;
394
+ };
395
+ var peg$f45 = function (start, com) {
396
+ return start + com.join("");
397
+ };
398
+ var peg$currPos = 0;
399
+ var peg$savedPos = 0;
400
+ var peg$posDetailsCache = [{ line: 1, column: 1 }];
401
+ var peg$maxFailPos = 0;
402
+ var peg$maxFailExpected = [];
403
+ var peg$silentFails = 0;
404
+ var peg$result;
405
+ if ("startRule" in options) {
406
+ if (!(options.startRule in peg$startRuleFunctions)) {
407
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
408
+ }
409
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
410
+ }
411
+ function text() {
412
+ return input.substring(peg$savedPos, peg$currPos);
413
+ }
414
+ function offset() {
415
+ return peg$savedPos;
416
+ }
417
+ function range() {
418
+ return {
419
+ source: peg$source,
420
+ start: peg$savedPos,
421
+ end: peg$currPos
422
+ };
423
+ }
424
+ function location() {
425
+ return peg$computeLocation(peg$savedPos, peg$currPos);
426
+ }
427
+ function expected(description, location) {
428
+ location = location !== undefined
429
+ ? location
430
+ : peg$computeLocation(peg$savedPos, peg$currPos);
431
+ throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
432
+ }
433
+ function error(message, location) {
434
+ location = location !== undefined
435
+ ? location
436
+ : peg$computeLocation(peg$savedPos, peg$currPos);
437
+ throw peg$buildSimpleError(message, location);
438
+ }
439
+ function peg$literalExpectation(text, ignoreCase) {
440
+ return { type: "literal", text: text, ignoreCase: ignoreCase };
441
+ }
442
+ function peg$classExpectation(parts, inverted, ignoreCase) {
443
+ return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
444
+ }
445
+ function peg$anyExpectation() {
446
+ return { type: "any" };
447
+ }
448
+ function peg$endExpectation() {
449
+ return { type: "end" };
450
+ }
451
+ function peg$otherExpectation(description) {
452
+ return { type: "other", description: description };
453
+ }
454
+ function peg$computePosDetails(pos) {
455
+ var details = peg$posDetailsCache[pos];
456
+ var p;
457
+ if (details) {
458
+ return details;
459
+ }
460
+ else {
461
+ p = pos - 1;
462
+ while (!peg$posDetailsCache[p]) {
463
+ p--;
464
+ }
465
+ details = peg$posDetailsCache[p];
466
+ details = {
467
+ line: details.line,
468
+ column: details.column
469
+ };
470
+ while (p < pos) {
471
+ if (input.charCodeAt(p) === 10) {
472
+ details.line++;
473
+ details.column = 1;
474
+ }
475
+ else {
476
+ details.column++;
477
+ }
478
+ p++;
479
+ }
480
+ peg$posDetailsCache[pos] = details;
481
+ return details;
482
+ }
483
+ }
484
+ function peg$computeLocation(startPos, endPos) {
485
+ var startPosDetails = peg$computePosDetails(startPos);
486
+ var endPosDetails = peg$computePosDetails(endPos);
487
+ return {
488
+ source: peg$source,
489
+ start: {
490
+ offset: startPos,
491
+ line: startPosDetails.line,
492
+ column: startPosDetails.column
493
+ },
494
+ end: {
495
+ offset: endPos,
496
+ line: endPosDetails.line,
497
+ column: endPosDetails.column
498
+ }
499
+ };
500
+ }
501
+ function peg$fail(expected) {
502
+ if (peg$currPos < peg$maxFailPos) {
503
+ return;
504
+ }
505
+ if (peg$currPos > peg$maxFailPos) {
506
+ peg$maxFailPos = peg$currPos;
507
+ peg$maxFailExpected = [];
508
+ }
509
+ peg$maxFailExpected.push(expected);
510
+ }
511
+ function peg$buildSimpleError(message, location) {
512
+ return new peg$SyntaxError(message, null, null, location);
513
+ }
514
+ function peg$buildStructuredError(expected, found, location) {
515
+ return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
516
+ }
517
+ function peg$parseprogram() {
518
+ var s0, s1, s2, s3;
519
+ s0 = peg$currPos;
520
+ s1 = peg$parse_();
521
+ s2 = peg$parsestatemachine();
522
+ s3 = peg$parse_();
523
+ peg$savedPos = s0;
524
+ s0 = peg$f0(s2);
525
+ return s0;
526
+ }
527
+ function peg$parsestatemachine() {
528
+ var s0, s1, s2, s3;
529
+ peg$silentFails++;
530
+ s0 = peg$currPos;
531
+ s1 = peg$parsestates();
532
+ if (s1 === peg$FAILED) {
533
+ s1 = null;
534
+ }
535
+ s2 = [];
536
+ s3 = peg$parsetransition();
537
+ while (s3 !== peg$FAILED) {
538
+ s2.push(s3);
539
+ s3 = peg$parsetransition();
540
+ }
541
+ peg$savedPos = s0;
542
+ s0 = peg$f1(s1, s2);
543
+ peg$silentFails--;
544
+ s1 = peg$FAILED;
545
+ if (peg$silentFails === 0) {
546
+ peg$fail(peg$e0);
547
+ }
548
+ return s0;
549
+ }
550
+ function peg$parsestates() {
551
+ var s0, s1, s2, s3, s4, s5;
552
+ s0 = peg$currPos;
553
+ s1 = peg$currPos;
554
+ s2 = [];
555
+ s3 = peg$currPos;
556
+ s4 = peg$parsestate();
557
+ if (s4 !== peg$FAILED) {
558
+ if (input.charCodeAt(peg$currPos) === 44) {
559
+ s5 = peg$c0;
560
+ peg$currPos++;
561
+ }
562
+ else {
563
+ s5 = peg$FAILED;
564
+ if (peg$silentFails === 0) {
565
+ peg$fail(peg$e1);
566
+ }
567
+ }
568
+ if (s5 !== peg$FAILED) {
569
+ peg$savedPos = s3;
570
+ s3 = peg$f2(s4);
571
+ }
572
+ else {
573
+ peg$currPos = s3;
574
+ s3 = peg$FAILED;
575
+ }
576
+ }
577
+ else {
578
+ peg$currPos = s3;
579
+ s3 = peg$FAILED;
580
+ }
581
+ while (s3 !== peg$FAILED) {
582
+ s2.push(s3);
583
+ s3 = peg$currPos;
584
+ s4 = peg$parsestate();
585
+ if (s4 !== peg$FAILED) {
586
+ if (input.charCodeAt(peg$currPos) === 44) {
587
+ s5 = peg$c0;
588
+ peg$currPos++;
589
+ }
590
+ else {
591
+ s5 = peg$FAILED;
592
+ if (peg$silentFails === 0) {
593
+ peg$fail(peg$e1);
594
+ }
595
+ }
596
+ if (s5 !== peg$FAILED) {
597
+ peg$savedPos = s3;
598
+ s3 = peg$f2(s4);
599
+ }
600
+ else {
601
+ peg$currPos = s3;
602
+ s3 = peg$FAILED;
603
+ }
604
+ }
605
+ else {
606
+ peg$currPos = s3;
607
+ s3 = peg$FAILED;
608
+ }
609
+ }
610
+ s3 = peg$currPos;
611
+ s4 = peg$parsestate();
612
+ if (s4 !== peg$FAILED) {
613
+ if (input.charCodeAt(peg$currPos) === 59) {
614
+ s5 = peg$c1;
615
+ peg$currPos++;
616
+ }
617
+ else {
618
+ s5 = peg$FAILED;
619
+ if (peg$silentFails === 0) {
620
+ peg$fail(peg$e2);
621
+ }
622
+ }
623
+ if (s5 !== peg$FAILED) {
624
+ peg$savedPos = s3;
625
+ s3 = peg$f3(s4);
626
+ }
627
+ else {
628
+ peg$currPos = s3;
629
+ s3 = peg$FAILED;
630
+ }
631
+ }
632
+ else {
633
+ peg$currPos = s3;
634
+ s3 = peg$FAILED;
635
+ }
636
+ if (s3 !== peg$FAILED) {
637
+ s2 = [s2, s3];
638
+ s1 = s2;
639
+ }
640
+ else {
641
+ peg$currPos = s1;
642
+ s1 = peg$FAILED;
643
+ }
644
+ if (s1 !== peg$FAILED) {
645
+ peg$savedPos = s0;
646
+ s1 = peg$f4(s1);
647
+ }
648
+ s0 = s1;
649
+ return s0;
650
+ }
651
+ function peg$parsestate() {
652
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14;
653
+ peg$silentFails++;
654
+ s0 = peg$currPos;
655
+ s1 = [];
656
+ s2 = peg$parsenote();
657
+ while (s2 !== peg$FAILED) {
658
+ s1.push(s2);
659
+ s2 = peg$parsenote();
660
+ }
661
+ s2 = peg$parse_();
662
+ s3 = peg$parseidentifier();
663
+ if (s3 !== peg$FAILED) {
664
+ s4 = peg$parse_();
665
+ s5 = peg$currPos;
666
+ if (input.charCodeAt(peg$currPos) === 91) {
667
+ s6 = peg$c2;
668
+ peg$currPos++;
669
+ }
670
+ else {
671
+ s6 = peg$FAILED;
672
+ if (peg$silentFails === 0) {
673
+ peg$fail(peg$e4);
674
+ }
675
+ }
676
+ if (s6 !== peg$FAILED) {
677
+ s7 = peg$parseextended_state_attributes();
678
+ if (input.charCodeAt(peg$currPos) === 93) {
679
+ s8 = peg$c3;
680
+ peg$currPos++;
681
+ }
682
+ else {
683
+ s8 = peg$FAILED;
684
+ if (peg$silentFails === 0) {
685
+ peg$fail(peg$e5);
686
+ }
687
+ }
688
+ if (s8 !== peg$FAILED) {
689
+ peg$savedPos = s5;
690
+ s5 = peg$f5(s1, s3, s7);
691
+ }
692
+ else {
693
+ peg$currPos = s5;
694
+ s5 = peg$FAILED;
695
+ }
696
+ }
697
+ else {
698
+ peg$currPos = s5;
699
+ s5 = peg$FAILED;
700
+ }
701
+ if (s5 === peg$FAILED) {
702
+ s5 = null;
703
+ }
704
+ s6 = peg$parse_();
705
+ s7 = peg$currPos;
706
+ if (input.charCodeAt(peg$currPos) === 58) {
707
+ s8 = peg$c4;
708
+ peg$currPos++;
709
+ }
710
+ else {
711
+ s8 = peg$FAILED;
712
+ if (peg$silentFails === 0) {
713
+ peg$fail(peg$e6);
714
+ }
715
+ }
716
+ if (s8 !== peg$FAILED) {
717
+ s9 = peg$parse_();
718
+ s10 = peg$parsestring();
719
+ if (s10 !== peg$FAILED) {
720
+ s11 = peg$parse_();
721
+ peg$savedPos = s7;
722
+ s7 = peg$f6(s1, s3, s5, s10);
723
+ }
724
+ else {
725
+ peg$currPos = s7;
726
+ s7 = peg$FAILED;
727
+ }
728
+ }
729
+ else {
730
+ peg$currPos = s7;
731
+ s7 = peg$FAILED;
732
+ }
733
+ if (s7 === peg$FAILED) {
734
+ s7 = null;
735
+ }
736
+ s8 = peg$parse_();
737
+ s9 = peg$currPos;
738
+ if (input.charCodeAt(peg$currPos) === 123) {
739
+ s10 = peg$c5;
740
+ peg$currPos++;
741
+ }
742
+ else {
743
+ s10 = peg$FAILED;
744
+ if (peg$silentFails === 0) {
745
+ peg$fail(peg$e7);
746
+ }
747
+ }
748
+ if (s10 !== peg$FAILED) {
749
+ s11 = peg$parse_();
750
+ s12 = peg$parsestatemachine();
751
+ if (s12 !== peg$FAILED) {
752
+ s13 = peg$parse_();
753
+ if (input.charCodeAt(peg$currPos) === 125) {
754
+ s14 = peg$c6;
755
+ peg$currPos++;
756
+ }
757
+ else {
758
+ s14 = peg$FAILED;
759
+ if (peg$silentFails === 0) {
760
+ peg$fail(peg$e8);
761
+ }
762
+ }
763
+ if (s14 !== peg$FAILED) {
764
+ peg$savedPos = s9;
765
+ s9 = peg$f7(s1, s3, s5, s7, s12);
766
+ }
767
+ else {
768
+ peg$currPos = s9;
769
+ s9 = peg$FAILED;
770
+ }
771
+ }
772
+ else {
773
+ peg$currPos = s9;
774
+ s9 = peg$FAILED;
775
+ }
776
+ }
777
+ else {
778
+ peg$currPos = s9;
779
+ s9 = peg$FAILED;
780
+ }
781
+ if (s9 === peg$FAILED) {
782
+ s9 = null;
783
+ }
784
+ s10 = peg$parse_();
785
+ peg$savedPos = s0;
786
+ s0 = peg$f8(s1, s3, s5, s7, s9);
787
+ }
788
+ else {
789
+ peg$currPos = s0;
790
+ s0 = peg$FAILED;
791
+ }
792
+ peg$silentFails--;
793
+ if (s0 === peg$FAILED) {
794
+ s1 = peg$FAILED;
795
+ if (peg$silentFails === 0) {
796
+ peg$fail(peg$e3);
797
+ }
798
+ }
799
+ return s0;
800
+ }
801
+ function peg$parseextended_state_attributes() {
802
+ var s0, s1;
803
+ peg$silentFails++;
804
+ s0 = [];
805
+ s1 = peg$parseextended_state_attribute();
806
+ while (s1 !== peg$FAILED) {
807
+ s0.push(s1);
808
+ s1 = peg$parseextended_state_attribute();
809
+ }
810
+ peg$silentFails--;
811
+ s1 = peg$FAILED;
812
+ if (peg$silentFails === 0) {
813
+ peg$fail(peg$e9);
814
+ }
815
+ return s0;
816
+ }
817
+ function peg$parseextended_state_attribute() {
818
+ var s0, s1, s2, s3, s4, s5, s6, s7;
819
+ peg$silentFails++;
820
+ s0 = peg$currPos;
821
+ s1 = peg$parse_();
822
+ s2 = peg$parseextended_state_string_attribute_name();
823
+ if (s2 !== peg$FAILED) {
824
+ s3 = peg$parse_();
825
+ if (input.charCodeAt(peg$currPos) === 61) {
826
+ s4 = peg$c7;
827
+ peg$currPos++;
828
+ }
829
+ else {
830
+ s4 = peg$FAILED;
831
+ if (peg$silentFails === 0) {
832
+ peg$fail(peg$e11);
833
+ }
834
+ }
835
+ if (s4 !== peg$FAILED) {
836
+ s5 = peg$parse_();
837
+ s6 = peg$parsequotedstring();
838
+ if (s6 !== peg$FAILED) {
839
+ s7 = peg$parse_();
840
+ peg$savedPos = s0;
841
+ s0 = peg$f9(s2, s6);
842
+ }
843
+ else {
844
+ peg$currPos = s0;
845
+ s0 = peg$FAILED;
846
+ }
847
+ }
848
+ else {
849
+ peg$currPos = s0;
850
+ s0 = peg$FAILED;
851
+ }
852
+ }
853
+ else {
854
+ peg$currPos = s0;
855
+ s0 = peg$FAILED;
856
+ }
857
+ if (s0 === peg$FAILED) {
858
+ s0 = peg$currPos;
859
+ s1 = peg$parse_();
860
+ s2 = peg$parseclass_attribute_name();
861
+ if (s2 !== peg$FAILED) {
862
+ s3 = peg$parse_();
863
+ if (input.charCodeAt(peg$currPos) === 61) {
864
+ s4 = peg$c7;
865
+ peg$currPos++;
866
+ }
867
+ else {
868
+ s4 = peg$FAILED;
869
+ if (peg$silentFails === 0) {
870
+ peg$fail(peg$e11);
871
+ }
872
+ }
873
+ if (s4 !== peg$FAILED) {
874
+ s5 = peg$parse_();
875
+ s6 = peg$parseclass_string();
876
+ if (s6 !== peg$FAILED) {
877
+ s7 = peg$parse_();
878
+ peg$savedPos = s0;
879
+ s0 = peg$f10(s2, s6);
880
+ }
881
+ else {
882
+ peg$currPos = s0;
883
+ s0 = peg$FAILED;
884
+ }
885
+ }
886
+ else {
887
+ peg$currPos = s0;
888
+ s0 = peg$FAILED;
889
+ }
890
+ }
891
+ else {
892
+ peg$currPos = s0;
893
+ s0 = peg$FAILED;
894
+ }
895
+ if (s0 === peg$FAILED) {
896
+ s0 = peg$currPos;
897
+ s1 = peg$parse_();
898
+ s2 = peg$parseextended_state_boolean_attribute_name();
899
+ if (s2 !== peg$FAILED) {
900
+ s3 = peg$parse_();
901
+ peg$savedPos = s0;
902
+ s0 = peg$f11(s2);
903
+ }
904
+ else {
905
+ peg$currPos = s0;
906
+ s0 = peg$FAILED;
907
+ }
908
+ if (s0 === peg$FAILED) {
909
+ s0 = peg$currPos;
910
+ s1 = peg$parse_();
911
+ s2 = peg$parseextended_state_type_attribute_name();
912
+ if (s2 !== peg$FAILED) {
913
+ s3 = peg$parse_();
914
+ if (input.charCodeAt(peg$currPos) === 61) {
915
+ s4 = peg$c7;
916
+ peg$currPos++;
917
+ }
918
+ else {
919
+ s4 = peg$FAILED;
920
+ if (peg$silentFails === 0) {
921
+ peg$fail(peg$e11);
922
+ }
923
+ }
924
+ if (s4 !== peg$FAILED) {
925
+ s5 = peg$parse_();
926
+ s6 = peg$parseextended_state_type_attribute_type();
927
+ if (s6 !== peg$FAILED) {
928
+ s7 = peg$parse_();
929
+ peg$savedPos = s0;
930
+ s0 = peg$f12(s2, s6);
931
+ }
932
+ else {
933
+ peg$currPos = s0;
934
+ s0 = peg$FAILED;
935
+ }
936
+ }
937
+ else {
938
+ peg$currPos = s0;
939
+ s0 = peg$FAILED;
940
+ }
941
+ }
942
+ else {
943
+ peg$currPos = s0;
944
+ s0 = peg$FAILED;
945
+ }
946
+ }
947
+ }
948
+ }
949
+ peg$silentFails--;
950
+ if (s0 === peg$FAILED) {
951
+ s1 = peg$FAILED;
952
+ if (peg$silentFails === 0) {
953
+ peg$fail(peg$e10);
954
+ }
955
+ }
956
+ return s0;
957
+ }
958
+ function peg$parseextended_state_string_attribute_name() {
959
+ var s0, s1;
960
+ peg$silentFails++;
961
+ s0 = peg$currPos;
962
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c8) {
963
+ s1 = input.substr(peg$currPos, 5);
964
+ peg$currPos += 5;
965
+ }
966
+ else {
967
+ s1 = peg$FAILED;
968
+ if (peg$silentFails === 0) {
969
+ peg$fail(peg$e13);
970
+ }
971
+ }
972
+ if (s1 === peg$FAILED) {
973
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c9) {
974
+ s1 = input.substr(peg$currPos, 5);
975
+ peg$currPos += 5;
976
+ }
977
+ else {
978
+ s1 = peg$FAILED;
979
+ if (peg$silentFails === 0) {
980
+ peg$fail(peg$e14);
981
+ }
982
+ }
983
+ }
984
+ if (s1 !== peg$FAILED) {
985
+ peg$savedPos = s0;
986
+ s1 = peg$f13(s1);
987
+ }
988
+ s0 = s1;
989
+ peg$silentFails--;
990
+ if (s0 === peg$FAILED) {
991
+ s1 = peg$FAILED;
992
+ if (peg$silentFails === 0) {
993
+ peg$fail(peg$e12);
994
+ }
995
+ }
996
+ return s0;
997
+ }
998
+ function peg$parseclass_attribute_name() {
999
+ var s0, s1;
1000
+ peg$silentFails++;
1001
+ s0 = peg$currPos;
1002
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c10) {
1003
+ s1 = input.substr(peg$currPos, 5);
1004
+ peg$currPos += 5;
1005
+ }
1006
+ else {
1007
+ s1 = peg$FAILED;
1008
+ if (peg$silentFails === 0) {
1009
+ peg$fail(peg$e16);
1010
+ }
1011
+ }
1012
+ if (s1 !== peg$FAILED) {
1013
+ peg$savedPos = s0;
1014
+ s1 = peg$f14(s1);
1015
+ }
1016
+ s0 = s1;
1017
+ peg$silentFails--;
1018
+ if (s0 === peg$FAILED) {
1019
+ s1 = peg$FAILED;
1020
+ if (peg$silentFails === 0) {
1021
+ peg$fail(peg$e15);
1022
+ }
1023
+ }
1024
+ return s0;
1025
+ }
1026
+ function peg$parseextended_state_boolean_attribute_name() {
1027
+ var s0, s1;
1028
+ peg$silentFails++;
1029
+ s0 = peg$currPos;
1030
+ if (input.substr(peg$currPos, 6).toLowerCase() === peg$c11) {
1031
+ s1 = input.substr(peg$currPos, 6);
1032
+ peg$currPos += 6;
1033
+ }
1034
+ else {
1035
+ s1 = peg$FAILED;
1036
+ if (peg$silentFails === 0) {
1037
+ peg$fail(peg$e18);
1038
+ }
1039
+ }
1040
+ if (s1 !== peg$FAILED) {
1041
+ peg$savedPos = s0;
1042
+ s1 = peg$f15(s1);
1043
+ }
1044
+ s0 = s1;
1045
+ peg$silentFails--;
1046
+ if (s0 === peg$FAILED) {
1047
+ s1 = peg$FAILED;
1048
+ if (peg$silentFails === 0) {
1049
+ peg$fail(peg$e17);
1050
+ }
1051
+ }
1052
+ return s0;
1053
+ }
1054
+ function peg$parseextended_state_type_attribute_name() {
1055
+ var s0, s1;
1056
+ peg$silentFails++;
1057
+ s0 = peg$currPos;
1058
+ if (input.substr(peg$currPos, 4).toLowerCase() === peg$c12) {
1059
+ s1 = input.substr(peg$currPos, 4);
1060
+ peg$currPos += 4;
1061
+ }
1062
+ else {
1063
+ s1 = peg$FAILED;
1064
+ if (peg$silentFails === 0) {
1065
+ peg$fail(peg$e20);
1066
+ }
1067
+ }
1068
+ if (s1 !== peg$FAILED) {
1069
+ peg$savedPos = s0;
1070
+ s1 = peg$f16(s1);
1071
+ }
1072
+ s0 = s1;
1073
+ peg$silentFails--;
1074
+ if (s0 === peg$FAILED) {
1075
+ s1 = peg$FAILED;
1076
+ if (peg$silentFails === 0) {
1077
+ peg$fail(peg$e19);
1078
+ }
1079
+ }
1080
+ return s0;
1081
+ }
1082
+ function peg$parseextended_state_type_attribute_type() {
1083
+ var s0, s1;
1084
+ peg$silentFails++;
1085
+ if (input.substr(peg$currPos, 7) === peg$c13) {
1086
+ s0 = peg$c13;
1087
+ peg$currPos += 7;
1088
+ }
1089
+ else {
1090
+ s0 = peg$FAILED;
1091
+ if (peg$silentFails === 0) {
1092
+ peg$fail(peg$e22);
1093
+ }
1094
+ }
1095
+ if (s0 === peg$FAILED) {
1096
+ if (input.substr(peg$currPos, 7) === peg$c14) {
1097
+ s0 = peg$c14;
1098
+ peg$currPos += 7;
1099
+ }
1100
+ else {
1101
+ s0 = peg$FAILED;
1102
+ if (peg$silentFails === 0) {
1103
+ peg$fail(peg$e23);
1104
+ }
1105
+ }
1106
+ if (s0 === peg$FAILED) {
1107
+ if (input.substr(peg$currPos, 9) === peg$c15) {
1108
+ s0 = peg$c15;
1109
+ peg$currPos += 9;
1110
+ }
1111
+ else {
1112
+ s0 = peg$FAILED;
1113
+ if (peg$silentFails === 0) {
1114
+ peg$fail(peg$e24);
1115
+ }
1116
+ }
1117
+ if (s0 === peg$FAILED) {
1118
+ if (input.substr(peg$currPos, 5) === peg$c16) {
1119
+ s0 = peg$c16;
1120
+ peg$currPos += 5;
1121
+ }
1122
+ else {
1123
+ s0 = peg$FAILED;
1124
+ if (peg$silentFails === 0) {
1125
+ peg$fail(peg$e25);
1126
+ }
1127
+ }
1128
+ if (s0 === peg$FAILED) {
1129
+ if (input.substr(peg$currPos, 8) === peg$c17) {
1130
+ s0 = peg$c17;
1131
+ peg$currPos += 8;
1132
+ }
1133
+ else {
1134
+ s0 = peg$FAILED;
1135
+ if (peg$silentFails === 0) {
1136
+ peg$fail(peg$e26);
1137
+ }
1138
+ }
1139
+ if (s0 === peg$FAILED) {
1140
+ if (input.substr(peg$currPos, 7) === peg$c18) {
1141
+ s0 = peg$c18;
1142
+ peg$currPos += 7;
1143
+ }
1144
+ else {
1145
+ s0 = peg$FAILED;
1146
+ if (peg$silentFails === 0) {
1147
+ peg$fail(peg$e27);
1148
+ }
1149
+ }
1150
+ if (s0 === peg$FAILED) {
1151
+ if (input.substr(peg$currPos, 11) === peg$c19) {
1152
+ s0 = peg$c19;
1153
+ peg$currPos += 11;
1154
+ }
1155
+ else {
1156
+ s0 = peg$FAILED;
1157
+ if (peg$silentFails === 0) {
1158
+ peg$fail(peg$e28);
1159
+ }
1160
+ }
1161
+ if (s0 === peg$FAILED) {
1162
+ if (input.substr(peg$currPos, 6) === peg$c20) {
1163
+ s0 = peg$c20;
1164
+ peg$currPos += 6;
1165
+ }
1166
+ else {
1167
+ s0 = peg$FAILED;
1168
+ if (peg$silentFails === 0) {
1169
+ peg$fail(peg$e29);
1170
+ }
1171
+ }
1172
+ if (s0 === peg$FAILED) {
1173
+ if (input.substr(peg$currPos, 8) === peg$c21) {
1174
+ s0 = peg$c21;
1175
+ peg$currPos += 8;
1176
+ }
1177
+ else {
1178
+ s0 = peg$FAILED;
1179
+ if (peg$silentFails === 0) {
1180
+ peg$fail(peg$e30);
1181
+ }
1182
+ }
1183
+ if (s0 === peg$FAILED) {
1184
+ if (input.substr(peg$currPos, 4) === peg$c22) {
1185
+ s0 = peg$c22;
1186
+ peg$currPos += 4;
1187
+ }
1188
+ else {
1189
+ s0 = peg$FAILED;
1190
+ if (peg$silentFails === 0) {
1191
+ peg$fail(peg$e31);
1192
+ }
1193
+ }
1194
+ if (s0 === peg$FAILED) {
1195
+ if (input.substr(peg$currPos, 4) === peg$c23) {
1196
+ s0 = peg$c23;
1197
+ peg$currPos += 4;
1198
+ }
1199
+ else {
1200
+ s0 = peg$FAILED;
1201
+ if (peg$silentFails === 0) {
1202
+ peg$fail(peg$e32);
1203
+ }
1204
+ }
1205
+ if (s0 === peg$FAILED) {
1206
+ if (input.substr(peg$currPos, 8) === peg$c24) {
1207
+ s0 = peg$c24;
1208
+ peg$currPos += 8;
1209
+ }
1210
+ else {
1211
+ s0 = peg$FAILED;
1212
+ if (peg$silentFails === 0) {
1213
+ peg$fail(peg$e33);
1214
+ }
1215
+ }
1216
+ }
1217
+ }
1218
+ }
1219
+ }
1220
+ }
1221
+ }
1222
+ }
1223
+ }
1224
+ }
1225
+ }
1226
+ }
1227
+ peg$silentFails--;
1228
+ if (s0 === peg$FAILED) {
1229
+ s1 = peg$FAILED;
1230
+ if (peg$silentFails === 0) {
1231
+ peg$fail(peg$e21);
1232
+ }
1233
+ }
1234
+ return s0;
1235
+ }
1236
+ function peg$parsetransition() {
1237
+ var s0, s1, s2, s3, s4, s5, s6, s7, s8;
1238
+ peg$silentFails++;
1239
+ s0 = peg$currPos;
1240
+ s1 = [];
1241
+ s2 = peg$parsenote();
1242
+ while (s2 !== peg$FAILED) {
1243
+ s1.push(s2);
1244
+ s2 = peg$parsenote();
1245
+ }
1246
+ s2 = peg$parsetransitionbase();
1247
+ if (s2 !== peg$FAILED) {
1248
+ s3 = peg$currPos;
1249
+ if (input.charCodeAt(peg$currPos) === 91) {
1250
+ s4 = peg$c2;
1251
+ peg$currPos++;
1252
+ }
1253
+ else {
1254
+ s4 = peg$FAILED;
1255
+ if (peg$silentFails === 0) {
1256
+ peg$fail(peg$e4);
1257
+ }
1258
+ }
1259
+ if (s4 !== peg$FAILED) {
1260
+ s5 = peg$parseextended_transition_attributes();
1261
+ if (input.charCodeAt(peg$currPos) === 93) {
1262
+ s6 = peg$c3;
1263
+ peg$currPos++;
1264
+ }
1265
+ else {
1266
+ s6 = peg$FAILED;
1267
+ if (peg$silentFails === 0) {
1268
+ peg$fail(peg$e5);
1269
+ }
1270
+ }
1271
+ if (s6 !== peg$FAILED) {
1272
+ s7 = peg$parse_();
1273
+ peg$savedPos = s3;
1274
+ s3 = peg$f17(s1, s2, s5);
1275
+ }
1276
+ else {
1277
+ peg$currPos = s3;
1278
+ s3 = peg$FAILED;
1279
+ }
1280
+ }
1281
+ else {
1282
+ peg$currPos = s3;
1283
+ s3 = peg$FAILED;
1284
+ }
1285
+ if (s3 === peg$FAILED) {
1286
+ s3 = null;
1287
+ }
1288
+ s4 = peg$currPos;
1289
+ if (input.charCodeAt(peg$currPos) === 58) {
1290
+ s5 = peg$c4;
1291
+ peg$currPos++;
1292
+ }
1293
+ else {
1294
+ s5 = peg$FAILED;
1295
+ if (peg$silentFails === 0) {
1296
+ peg$fail(peg$e6);
1297
+ }
1298
+ }
1299
+ if (s5 !== peg$FAILED) {
1300
+ s6 = peg$parse_();
1301
+ s7 = peg$parsetransitionstring();
1302
+ if (s7 !== peg$FAILED) {
1303
+ s8 = peg$parse_();
1304
+ peg$savedPos = s4;
1305
+ s4 = peg$f18(s1, s2, s3, s7);
1306
+ }
1307
+ else {
1308
+ peg$currPos = s4;
1309
+ s4 = peg$FAILED;
1310
+ }
1311
+ }
1312
+ else {
1313
+ peg$currPos = s4;
1314
+ s4 = peg$FAILED;
1315
+ }
1316
+ if (s4 === peg$FAILED) {
1317
+ s4 = null;
1318
+ }
1319
+ if (input.charCodeAt(peg$currPos) === 59) {
1320
+ s5 = peg$c1;
1321
+ peg$currPos++;
1322
+ }
1323
+ else {
1324
+ s5 = peg$FAILED;
1325
+ if (peg$silentFails === 0) {
1326
+ peg$fail(peg$e2);
1327
+ }
1328
+ }
1329
+ if (s5 !== peg$FAILED) {
1330
+ peg$savedPos = s0;
1331
+ s0 = peg$f19(s1, s2, s3, s4);
1332
+ }
1333
+ else {
1334
+ peg$currPos = s0;
1335
+ s0 = peg$FAILED;
1336
+ }
1337
+ }
1338
+ else {
1339
+ peg$currPos = s0;
1340
+ s0 = peg$FAILED;
1341
+ }
1342
+ peg$silentFails--;
1343
+ if (s0 === peg$FAILED) {
1344
+ s1 = peg$FAILED;
1345
+ if (peg$silentFails === 0) {
1346
+ peg$fail(peg$e34);
1347
+ }
1348
+ }
1349
+ return s0;
1350
+ }
1351
+ function peg$parsetransitionbase() {
1352
+ var s0, s1, s2, s3, s4, s5, s6, s7;
1353
+ s0 = peg$currPos;
1354
+ s1 = peg$parse_();
1355
+ s2 = peg$parseidentifier();
1356
+ if (s2 !== peg$FAILED) {
1357
+ s3 = peg$parse_();
1358
+ s4 = peg$parsefwdarrowtoken();
1359
+ if (s4 !== peg$FAILED) {
1360
+ s5 = peg$parse_();
1361
+ s6 = peg$parseidentifier();
1362
+ if (s6 !== peg$FAILED) {
1363
+ s7 = peg$parse_();
1364
+ peg$savedPos = s0;
1365
+ s0 = peg$f20(s2, s6);
1366
+ }
1367
+ else {
1368
+ peg$currPos = s0;
1369
+ s0 = peg$FAILED;
1370
+ }
1371
+ }
1372
+ else {
1373
+ peg$currPos = s0;
1374
+ s0 = peg$FAILED;
1375
+ }
1376
+ }
1377
+ else {
1378
+ peg$currPos = s0;
1379
+ s0 = peg$FAILED;
1380
+ }
1381
+ if (s0 === peg$FAILED) {
1382
+ s0 = peg$currPos;
1383
+ s1 = peg$parse_();
1384
+ s2 = peg$parseidentifier();
1385
+ if (s2 !== peg$FAILED) {
1386
+ s3 = peg$parse_();
1387
+ s4 = peg$parsebckarrowtoken();
1388
+ if (s4 !== peg$FAILED) {
1389
+ s5 = peg$parse_();
1390
+ s6 = peg$parseidentifier();
1391
+ if (s6 !== peg$FAILED) {
1392
+ s7 = peg$parse_();
1393
+ peg$savedPos = s0;
1394
+ s0 = peg$f21(s2, s6);
1395
+ }
1396
+ else {
1397
+ peg$currPos = s0;
1398
+ s0 = peg$FAILED;
1399
+ }
1400
+ }
1401
+ else {
1402
+ peg$currPos = s0;
1403
+ s0 = peg$FAILED;
1404
+ }
1405
+ }
1406
+ else {
1407
+ peg$currPos = s0;
1408
+ s0 = peg$FAILED;
1409
+ }
1410
+ }
1411
+ return s0;
1412
+ }
1413
+ function peg$parseextended_transition_attributes() {
1414
+ var s0, s1;
1415
+ peg$silentFails++;
1416
+ s0 = [];
1417
+ s1 = peg$parseextended_transition_attribute();
1418
+ while (s1 !== peg$FAILED) {
1419
+ s0.push(s1);
1420
+ s1 = peg$parseextended_transition_attribute();
1421
+ }
1422
+ peg$silentFails--;
1423
+ s1 = peg$FAILED;
1424
+ if (peg$silentFails === 0) {
1425
+ peg$fail(peg$e35);
1426
+ }
1427
+ return s0;
1428
+ }
1429
+ function peg$parseextended_transition_attribute() {
1430
+ var s0, s1, s2, s3, s4, s5, s6, s7;
1431
+ peg$silentFails++;
1432
+ s0 = peg$currPos;
1433
+ s1 = peg$parse_();
1434
+ s2 = peg$parseextended_transition_string_attribute_name();
1435
+ if (s2 !== peg$FAILED) {
1436
+ s3 = peg$parse_();
1437
+ if (input.charCodeAt(peg$currPos) === 61) {
1438
+ s4 = peg$c7;
1439
+ peg$currPos++;
1440
+ }
1441
+ else {
1442
+ s4 = peg$FAILED;
1443
+ if (peg$silentFails === 0) {
1444
+ peg$fail(peg$e11);
1445
+ }
1446
+ }
1447
+ if (s4 !== peg$FAILED) {
1448
+ s5 = peg$parse_();
1449
+ s6 = peg$parsequotedstring();
1450
+ if (s6 !== peg$FAILED) {
1451
+ s7 = peg$parse_();
1452
+ peg$savedPos = s0;
1453
+ s0 = peg$f22(s2, s6);
1454
+ }
1455
+ else {
1456
+ peg$currPos = s0;
1457
+ s0 = peg$FAILED;
1458
+ }
1459
+ }
1460
+ else {
1461
+ peg$currPos = s0;
1462
+ s0 = peg$FAILED;
1463
+ }
1464
+ }
1465
+ else {
1466
+ peg$currPos = s0;
1467
+ s0 = peg$FAILED;
1468
+ }
1469
+ if (s0 === peg$FAILED) {
1470
+ s0 = peg$currPos;
1471
+ s1 = peg$parse_();
1472
+ s2 = peg$parseclass_attribute_name();
1473
+ if (s2 !== peg$FAILED) {
1474
+ s3 = peg$parse_();
1475
+ if (input.charCodeAt(peg$currPos) === 61) {
1476
+ s4 = peg$c7;
1477
+ peg$currPos++;
1478
+ }
1479
+ else {
1480
+ s4 = peg$FAILED;
1481
+ if (peg$silentFails === 0) {
1482
+ peg$fail(peg$e11);
1483
+ }
1484
+ }
1485
+ if (s4 !== peg$FAILED) {
1486
+ s5 = peg$parse_();
1487
+ s6 = peg$parseclass_string();
1488
+ if (s6 !== peg$FAILED) {
1489
+ s7 = peg$parse_();
1490
+ peg$savedPos = s0;
1491
+ s0 = peg$f23(s2, s6);
1492
+ }
1493
+ else {
1494
+ peg$currPos = s0;
1495
+ s0 = peg$FAILED;
1496
+ }
1497
+ }
1498
+ else {
1499
+ peg$currPos = s0;
1500
+ s0 = peg$FAILED;
1501
+ }
1502
+ }
1503
+ else {
1504
+ peg$currPos = s0;
1505
+ s0 = peg$FAILED;
1506
+ }
1507
+ if (s0 === peg$FAILED) {
1508
+ s0 = peg$currPos;
1509
+ s1 = peg$parse_();
1510
+ s2 = peg$parseextended_transition_type_name();
1511
+ if (s2 !== peg$FAILED) {
1512
+ s3 = peg$parse_();
1513
+ if (input.charCodeAt(peg$currPos) === 61) {
1514
+ s4 = peg$c7;
1515
+ peg$currPos++;
1516
+ }
1517
+ else {
1518
+ s4 = peg$FAILED;
1519
+ if (peg$silentFails === 0) {
1520
+ peg$fail(peg$e11);
1521
+ }
1522
+ }
1523
+ if (s4 !== peg$FAILED) {
1524
+ s5 = peg$parse_();
1525
+ s6 = peg$parseextended_transition_type_value();
1526
+ if (s6 !== peg$FAILED) {
1527
+ s7 = peg$parse_();
1528
+ peg$savedPos = s0;
1529
+ s0 = peg$f24(s2, s6);
1530
+ }
1531
+ else {
1532
+ peg$currPos = s0;
1533
+ s0 = peg$FAILED;
1534
+ }
1535
+ }
1536
+ else {
1537
+ peg$currPos = s0;
1538
+ s0 = peg$FAILED;
1539
+ }
1540
+ }
1541
+ else {
1542
+ peg$currPos = s0;
1543
+ s0 = peg$FAILED;
1544
+ }
1545
+ if (s0 === peg$FAILED) {
1546
+ s0 = peg$currPos;
1547
+ s1 = peg$parse_();
1548
+ s2 = peg$parseextended_transition_numeric_attribute_name();
1549
+ if (s2 !== peg$FAILED) {
1550
+ s3 = peg$parse_();
1551
+ if (input.charCodeAt(peg$currPos) === 61) {
1552
+ s4 = peg$c7;
1553
+ peg$currPos++;
1554
+ }
1555
+ else {
1556
+ s4 = peg$FAILED;
1557
+ if (peg$silentFails === 0) {
1558
+ peg$fail(peg$e11);
1559
+ }
1560
+ }
1561
+ if (s4 !== peg$FAILED) {
1562
+ s5 = peg$parse_();
1563
+ s6 = peg$parsepositive_number();
1564
+ if (s6 !== peg$FAILED) {
1565
+ s7 = peg$parse_();
1566
+ peg$savedPos = s0;
1567
+ s0 = peg$f25(s2, s6);
1568
+ }
1569
+ else {
1570
+ peg$currPos = s0;
1571
+ s0 = peg$FAILED;
1572
+ }
1573
+ }
1574
+ else {
1575
+ peg$currPos = s0;
1576
+ s0 = peg$FAILED;
1577
+ }
1578
+ }
1579
+ else {
1580
+ peg$currPos = s0;
1581
+ s0 = peg$FAILED;
1582
+ }
1583
+ }
1584
+ }
1585
+ }
1586
+ peg$silentFails--;
1587
+ if (s0 === peg$FAILED) {
1588
+ s1 = peg$FAILED;
1589
+ if (peg$silentFails === 0) {
1590
+ peg$fail(peg$e36);
1591
+ }
1592
+ }
1593
+ return s0;
1594
+ }
1595
+ function peg$parseextended_transition_string_attribute_name() {
1596
+ var s0, s1;
1597
+ peg$silentFails++;
1598
+ s0 = peg$currPos;
1599
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c9) {
1600
+ s1 = input.substr(peg$currPos, 5);
1601
+ peg$currPos += 5;
1602
+ }
1603
+ else {
1604
+ s1 = peg$FAILED;
1605
+ if (peg$silentFails === 0) {
1606
+ peg$fail(peg$e14);
1607
+ }
1608
+ }
1609
+ if (s1 !== peg$FAILED) {
1610
+ peg$savedPos = s0;
1611
+ s1 = peg$f26(s1);
1612
+ }
1613
+ s0 = s1;
1614
+ peg$silentFails--;
1615
+ if (s0 === peg$FAILED) {
1616
+ s1 = peg$FAILED;
1617
+ if (peg$silentFails === 0) {
1618
+ peg$fail(peg$e37);
1619
+ }
1620
+ }
1621
+ return s0;
1622
+ }
1623
+ function peg$parseextended_transition_type_name() {
1624
+ var s0, s1;
1625
+ peg$silentFails++;
1626
+ s0 = peg$currPos;
1627
+ if (input.substr(peg$currPos, 4).toLowerCase() === peg$c12) {
1628
+ s1 = input.substr(peg$currPos, 4);
1629
+ peg$currPos += 4;
1630
+ }
1631
+ else {
1632
+ s1 = peg$FAILED;
1633
+ if (peg$silentFails === 0) {
1634
+ peg$fail(peg$e20);
1635
+ }
1636
+ }
1637
+ if (s1 !== peg$FAILED) {
1638
+ peg$savedPos = s0;
1639
+ s1 = peg$f27(s1);
1640
+ }
1641
+ s0 = s1;
1642
+ peg$silentFails--;
1643
+ if (s0 === peg$FAILED) {
1644
+ s1 = peg$FAILED;
1645
+ if (peg$silentFails === 0) {
1646
+ peg$fail(peg$e38);
1647
+ }
1648
+ }
1649
+ return s0;
1650
+ }
1651
+ function peg$parseextended_transition_numeric_attribute_name() {
1652
+ var s0, s1;
1653
+ peg$silentFails++;
1654
+ s0 = peg$currPos;
1655
+ if (input.substr(peg$currPos, 5).toLowerCase() === peg$c25) {
1656
+ s1 = input.substr(peg$currPos, 5);
1657
+ peg$currPos += 5;
1658
+ }
1659
+ else {
1660
+ s1 = peg$FAILED;
1661
+ if (peg$silentFails === 0) {
1662
+ peg$fail(peg$e40);
1663
+ }
1664
+ }
1665
+ if (s1 !== peg$FAILED) {
1666
+ peg$savedPos = s0;
1667
+ s1 = peg$f28(s1);
1668
+ }
1669
+ s0 = s1;
1670
+ peg$silentFails--;
1671
+ if (s0 === peg$FAILED) {
1672
+ s1 = peg$FAILED;
1673
+ if (peg$silentFails === 0) {
1674
+ peg$fail(peg$e39);
1675
+ }
1676
+ }
1677
+ return s0;
1678
+ }
1679
+ function peg$parseextended_transition_type_value() {
1680
+ var s0, s1;
1681
+ peg$silentFails++;
1682
+ if (input.substr(peg$currPos, 8) === peg$c26) {
1683
+ s0 = peg$c26;
1684
+ peg$currPos += 8;
1685
+ }
1686
+ else {
1687
+ s0 = peg$FAILED;
1688
+ if (peg$silentFails === 0) {
1689
+ peg$fail(peg$e42);
1690
+ }
1691
+ }
1692
+ if (s0 === peg$FAILED) {
1693
+ if (input.substr(peg$currPos, 8) === peg$c27) {
1694
+ s0 = peg$c27;
1695
+ peg$currPos += 8;
1696
+ }
1697
+ else {
1698
+ s0 = peg$FAILED;
1699
+ if (peg$silentFails === 0) {
1700
+ peg$fail(peg$e43);
1701
+ }
1702
+ }
1703
+ }
1704
+ peg$silentFails--;
1705
+ if (s0 === peg$FAILED) {
1706
+ s1 = peg$FAILED;
1707
+ if (peg$silentFails === 0) {
1708
+ peg$fail(peg$e41);
1709
+ }
1710
+ }
1711
+ return s0;
1712
+ }
1713
+ function peg$parsefwdarrowtoken() {
1714
+ var s0, s1;
1715
+ peg$silentFails++;
1716
+ if (input.substr(peg$currPos, 2) === peg$c28) {
1717
+ s0 = peg$c28;
1718
+ peg$currPos += 2;
1719
+ }
1720
+ else {
1721
+ s0 = peg$FAILED;
1722
+ if (peg$silentFails === 0) {
1723
+ peg$fail(peg$e45);
1724
+ }
1725
+ }
1726
+ if (s0 === peg$FAILED) {
1727
+ if (input.substr(peg$currPos, 3) === peg$c29) {
1728
+ s0 = peg$c29;
1729
+ peg$currPos += 3;
1730
+ }
1731
+ else {
1732
+ s0 = peg$FAILED;
1733
+ if (peg$silentFails === 0) {
1734
+ peg$fail(peg$e46);
1735
+ }
1736
+ }
1737
+ if (s0 === peg$FAILED) {
1738
+ if (input.substr(peg$currPos, 2) === peg$c30) {
1739
+ s0 = peg$c30;
1740
+ peg$currPos += 2;
1741
+ }
1742
+ else {
1743
+ s0 = peg$FAILED;
1744
+ if (peg$silentFails === 0) {
1745
+ peg$fail(peg$e47);
1746
+ }
1747
+ }
1748
+ if (s0 === peg$FAILED) {
1749
+ if (input.substr(peg$currPos, 2) === peg$c31) {
1750
+ s0 = peg$c31;
1751
+ peg$currPos += 2;
1752
+ }
1753
+ else {
1754
+ s0 = peg$FAILED;
1755
+ if (peg$silentFails === 0) {
1756
+ peg$fail(peg$e48);
1757
+ }
1758
+ }
1759
+ if (s0 === peg$FAILED) {
1760
+ if (input.substr(peg$currPos, 2) === peg$c32) {
1761
+ s0 = peg$c32;
1762
+ peg$currPos += 2;
1763
+ }
1764
+ else {
1765
+ s0 = peg$FAILED;
1766
+ if (peg$silentFails === 0) {
1767
+ peg$fail(peg$e49);
1768
+ }
1769
+ }
1770
+ if (s0 === peg$FAILED) {
1771
+ if (input.substr(peg$currPos, 2) === peg$c33) {
1772
+ s0 = peg$c33;
1773
+ peg$currPos += 2;
1774
+ }
1775
+ else {
1776
+ s0 = peg$FAILED;
1777
+ if (peg$silentFails === 0) {
1778
+ peg$fail(peg$e50);
1779
+ }
1780
+ }
1781
+ if (s0 === peg$FAILED) {
1782
+ if (input.substr(peg$currPos, 2) === peg$c34) {
1783
+ s0 = peg$c34;
1784
+ peg$currPos += 2;
1785
+ }
1786
+ else {
1787
+ s0 = peg$FAILED;
1788
+ if (peg$silentFails === 0) {
1789
+ peg$fail(peg$e51);
1790
+ }
1791
+ }
1792
+ }
1793
+ }
1794
+ }
1795
+ }
1796
+ }
1797
+ }
1798
+ peg$silentFails--;
1799
+ if (s0 === peg$FAILED) {
1800
+ s1 = peg$FAILED;
1801
+ if (peg$silentFails === 0) {
1802
+ peg$fail(peg$e44);
1803
+ }
1804
+ }
1805
+ return s0;
1806
+ }
1807
+ function peg$parsebckarrowtoken() {
1808
+ var s0, s1;
1809
+ peg$silentFails++;
1810
+ if (input.substr(peg$currPos, 2) === peg$c35) {
1811
+ s0 = peg$c35;
1812
+ peg$currPos += 2;
1813
+ }
1814
+ else {
1815
+ s0 = peg$FAILED;
1816
+ if (peg$silentFails === 0) {
1817
+ peg$fail(peg$e53);
1818
+ }
1819
+ }
1820
+ if (s0 === peg$FAILED) {
1821
+ if (input.substr(peg$currPos, 3) === peg$c36) {
1822
+ s0 = peg$c36;
1823
+ peg$currPos += 3;
1824
+ }
1825
+ else {
1826
+ s0 = peg$FAILED;
1827
+ if (peg$silentFails === 0) {
1828
+ peg$fail(peg$e54);
1829
+ }
1830
+ }
1831
+ if (s0 === peg$FAILED) {
1832
+ if (input.substr(peg$currPos, 2) === peg$c37) {
1833
+ s0 = peg$c37;
1834
+ peg$currPos += 2;
1835
+ }
1836
+ else {
1837
+ s0 = peg$FAILED;
1838
+ if (peg$silentFails === 0) {
1839
+ peg$fail(peg$e55);
1840
+ }
1841
+ }
1842
+ if (s0 === peg$FAILED) {
1843
+ if (input.substr(peg$currPos, 2) === peg$c38) {
1844
+ s0 = peg$c38;
1845
+ peg$currPos += 2;
1846
+ }
1847
+ else {
1848
+ s0 = peg$FAILED;
1849
+ if (peg$silentFails === 0) {
1850
+ peg$fail(peg$e56);
1851
+ }
1852
+ }
1853
+ if (s0 === peg$FAILED) {
1854
+ if (input.substr(peg$currPos, 2) === peg$c39) {
1855
+ s0 = peg$c39;
1856
+ peg$currPos += 2;
1857
+ }
1858
+ else {
1859
+ s0 = peg$FAILED;
1860
+ if (peg$silentFails === 0) {
1861
+ peg$fail(peg$e57);
1862
+ }
1863
+ }
1864
+ }
1865
+ }
1866
+ }
1867
+ }
1868
+ peg$silentFails--;
1869
+ if (s0 === peg$FAILED) {
1870
+ s1 = peg$FAILED;
1871
+ if (peg$silentFails === 0) {
1872
+ peg$fail(peg$e52);
1873
+ }
1874
+ }
1875
+ return s0;
1876
+ }
1877
+ function peg$parsenote() {
1878
+ var s0, s1, s2, s3, s4;
1879
+ s0 = peg$currPos;
1880
+ s1 = peg$parse_();
1881
+ if (input.charCodeAt(peg$currPos) === 35) {
1882
+ s2 = peg$c40;
1883
+ peg$currPos++;
1884
+ }
1885
+ else {
1886
+ s2 = peg$FAILED;
1887
+ if (peg$silentFails === 0) {
1888
+ peg$fail(peg$e58);
1889
+ }
1890
+ }
1891
+ if (s2 !== peg$FAILED) {
1892
+ s3 = [];
1893
+ s4 = peg$parseslcomtok();
1894
+ while (s4 !== peg$FAILED) {
1895
+ s3.push(s4);
1896
+ s4 = peg$parseslcomtok();
1897
+ }
1898
+ peg$savedPos = s0;
1899
+ s0 = peg$f29(s3);
1900
+ }
1901
+ else {
1902
+ peg$currPos = s0;
1903
+ s0 = peg$FAILED;
1904
+ }
1905
+ return s0;
1906
+ }
1907
+ function peg$parsepositive_number() {
1908
+ var s0;
1909
+ s0 = peg$parsepositive_real();
1910
+ if (s0 === peg$FAILED) {
1911
+ s0 = peg$parsecardinal();
1912
+ }
1913
+ return s0;
1914
+ }
1915
+ function peg$parsepositive_real() {
1916
+ var s0, s1, s2, s3, s4;
1917
+ s0 = peg$currPos;
1918
+ s1 = peg$currPos;
1919
+ s2 = peg$parsecardinal();
1920
+ if (s2 !== peg$FAILED) {
1921
+ if (input.charCodeAt(peg$currPos) === 46) {
1922
+ s3 = peg$c41;
1923
+ peg$currPos++;
1924
+ }
1925
+ else {
1926
+ s3 = peg$FAILED;
1927
+ if (peg$silentFails === 0) {
1928
+ peg$fail(peg$e59);
1929
+ }
1930
+ }
1931
+ if (s3 !== peg$FAILED) {
1932
+ s4 = peg$parsecardinal();
1933
+ if (s4 !== peg$FAILED) {
1934
+ s2 = [s2, s3, s4];
1935
+ s1 = s2;
1936
+ }
1937
+ else {
1938
+ peg$currPos = s1;
1939
+ s1 = peg$FAILED;
1940
+ }
1941
+ }
1942
+ else {
1943
+ peg$currPos = s1;
1944
+ s1 = peg$FAILED;
1945
+ }
1946
+ }
1947
+ else {
1948
+ peg$currPos = s1;
1949
+ s1 = peg$FAILED;
1950
+ }
1951
+ if (s1 !== peg$FAILED) {
1952
+ peg$savedPos = s0;
1953
+ s1 = peg$f30(s1);
1954
+ }
1955
+ s0 = s1;
1956
+ return s0;
1957
+ }
1958
+ function peg$parsecardinal() {
1959
+ var s0, s1, s2;
1960
+ s0 = peg$currPos;
1961
+ s1 = [];
1962
+ if (peg$r0.test(input.charAt(peg$currPos))) {
1963
+ s2 = input.charAt(peg$currPos);
1964
+ peg$currPos++;
1965
+ }
1966
+ else {
1967
+ s2 = peg$FAILED;
1968
+ if (peg$silentFails === 0) {
1969
+ peg$fail(peg$e60);
1970
+ }
1971
+ }
1972
+ if (s2 !== peg$FAILED) {
1973
+ while (s2 !== peg$FAILED) {
1974
+ s1.push(s2);
1975
+ if (peg$r0.test(input.charAt(peg$currPos))) {
1976
+ s2 = input.charAt(peg$currPos);
1977
+ peg$currPos++;
1978
+ }
1979
+ else {
1980
+ s2 = peg$FAILED;
1981
+ if (peg$silentFails === 0) {
1982
+ peg$fail(peg$e60);
1983
+ }
1984
+ }
1985
+ }
1986
+ }
1987
+ else {
1988
+ s1 = peg$FAILED;
1989
+ }
1990
+ if (s1 !== peg$FAILED) {
1991
+ peg$savedPos = s0;
1992
+ s1 = peg$f31(s1);
1993
+ }
1994
+ s0 = s1;
1995
+ return s0;
1996
+ }
1997
+ function peg$parsetransitionstring() {
1998
+ var s0;
1999
+ s0 = peg$parsequotedstring();
2000
+ if (s0 === peg$FAILED) {
2001
+ s0 = peg$parseunquotedtransitionstring();
2002
+ }
2003
+ return s0;
2004
+ }
2005
+ function peg$parsestring() {
2006
+ var s0;
2007
+ s0 = peg$parsequotedstring();
2008
+ if (s0 === peg$FAILED) {
2009
+ s0 = peg$parseunquotedstring();
2010
+ }
2011
+ return s0;
2012
+ }
2013
+ function peg$parsequotedstring() {
2014
+ var s0, s1, s2, s3;
2015
+ peg$silentFails++;
2016
+ s0 = peg$currPos;
2017
+ if (input.charCodeAt(peg$currPos) === 34) {
2018
+ s1 = peg$c42;
2019
+ peg$currPos++;
2020
+ }
2021
+ else {
2022
+ s1 = peg$FAILED;
2023
+ if (peg$silentFails === 0) {
2024
+ peg$fail(peg$e62);
2025
+ }
2026
+ }
2027
+ if (s1 !== peg$FAILED) {
2028
+ s2 = peg$parsestringcontent();
2029
+ if (input.charCodeAt(peg$currPos) === 34) {
2030
+ s3 = peg$c42;
2031
+ peg$currPos++;
2032
+ }
2033
+ else {
2034
+ s3 = peg$FAILED;
2035
+ if (peg$silentFails === 0) {
2036
+ peg$fail(peg$e62);
2037
+ }
2038
+ }
2039
+ if (s3 !== peg$FAILED) {
2040
+ peg$savedPos = s0;
2041
+ s0 = peg$f32(s2);
2042
+ }
2043
+ else {
2044
+ peg$currPos = s0;
2045
+ s0 = peg$FAILED;
2046
+ }
2047
+ }
2048
+ else {
2049
+ peg$currPos = s0;
2050
+ s0 = peg$FAILED;
2051
+ }
2052
+ peg$silentFails--;
2053
+ if (s0 === peg$FAILED) {
2054
+ s1 = peg$FAILED;
2055
+ if (peg$silentFails === 0) {
2056
+ peg$fail(peg$e61);
2057
+ }
2058
+ }
2059
+ return s0;
2060
+ }
2061
+ function peg$parsestringcontent() {
2062
+ var s0, s1, s2, s3;
2063
+ s0 = [];
2064
+ s1 = peg$currPos;
2065
+ s2 = peg$currPos;
2066
+ peg$silentFails++;
2067
+ if (input.charCodeAt(peg$currPos) === 34) {
2068
+ s3 = peg$c42;
2069
+ peg$currPos++;
2070
+ }
2071
+ else {
2072
+ s3 = peg$FAILED;
2073
+ if (peg$silentFails === 0) {
2074
+ peg$fail(peg$e62);
2075
+ }
2076
+ }
2077
+ peg$silentFails--;
2078
+ if (s3 === peg$FAILED) {
2079
+ s2 = undefined;
2080
+ }
2081
+ else {
2082
+ peg$currPos = s2;
2083
+ s2 = peg$FAILED;
2084
+ }
2085
+ if (s2 !== peg$FAILED) {
2086
+ if (input.substr(peg$currPos, 2) === peg$c43) {
2087
+ s3 = peg$c43;
2088
+ peg$currPos += 2;
2089
+ }
2090
+ else {
2091
+ s3 = peg$FAILED;
2092
+ if (peg$silentFails === 0) {
2093
+ peg$fail(peg$e63);
2094
+ }
2095
+ }
2096
+ if (s3 === peg$FAILED) {
2097
+ if (input.length > peg$currPos) {
2098
+ s3 = input.charAt(peg$currPos);
2099
+ peg$currPos++;
2100
+ }
2101
+ else {
2102
+ s3 = peg$FAILED;
2103
+ if (peg$silentFails === 0) {
2104
+ peg$fail(peg$e64);
2105
+ }
2106
+ }
2107
+ }
2108
+ if (s3 !== peg$FAILED) {
2109
+ peg$savedPos = s1;
2110
+ s1 = peg$f33(s3);
2111
+ }
2112
+ else {
2113
+ peg$currPos = s1;
2114
+ s1 = peg$FAILED;
2115
+ }
2116
+ }
2117
+ else {
2118
+ peg$currPos = s1;
2119
+ s1 = peg$FAILED;
2120
+ }
2121
+ while (s1 !== peg$FAILED) {
2122
+ s0.push(s1);
2123
+ s1 = peg$currPos;
2124
+ s2 = peg$currPos;
2125
+ peg$silentFails++;
2126
+ if (input.charCodeAt(peg$currPos) === 34) {
2127
+ s3 = peg$c42;
2128
+ peg$currPos++;
2129
+ }
2130
+ else {
2131
+ s3 = peg$FAILED;
2132
+ if (peg$silentFails === 0) {
2133
+ peg$fail(peg$e62);
2134
+ }
2135
+ }
2136
+ peg$silentFails--;
2137
+ if (s3 === peg$FAILED) {
2138
+ s2 = undefined;
2139
+ }
2140
+ else {
2141
+ peg$currPos = s2;
2142
+ s2 = peg$FAILED;
2143
+ }
2144
+ if (s2 !== peg$FAILED) {
2145
+ if (input.substr(peg$currPos, 2) === peg$c43) {
2146
+ s3 = peg$c43;
2147
+ peg$currPos += 2;
2148
+ }
2149
+ else {
2150
+ s3 = peg$FAILED;
2151
+ if (peg$silentFails === 0) {
2152
+ peg$fail(peg$e63);
2153
+ }
2154
+ }
2155
+ if (s3 === peg$FAILED) {
2156
+ if (input.length > peg$currPos) {
2157
+ s3 = input.charAt(peg$currPos);
2158
+ peg$currPos++;
2159
+ }
2160
+ else {
2161
+ s3 = peg$FAILED;
2162
+ if (peg$silentFails === 0) {
2163
+ peg$fail(peg$e64);
2164
+ }
2165
+ }
2166
+ }
2167
+ if (s3 !== peg$FAILED) {
2168
+ peg$savedPos = s1;
2169
+ s1 = peg$f33(s3);
2170
+ }
2171
+ else {
2172
+ peg$currPos = s1;
2173
+ s1 = peg$FAILED;
2174
+ }
2175
+ }
2176
+ else {
2177
+ peg$currPos = s1;
2178
+ s1 = peg$FAILED;
2179
+ }
2180
+ }
2181
+ return s0;
2182
+ }
2183
+ function peg$parseclass_string() {
2184
+ var s0, s1, s2, s3;
2185
+ peg$silentFails++;
2186
+ s0 = peg$currPos;
2187
+ if (input.charCodeAt(peg$currPos) === 34) {
2188
+ s1 = peg$c42;
2189
+ peg$currPos++;
2190
+ }
2191
+ else {
2192
+ s1 = peg$FAILED;
2193
+ if (peg$silentFails === 0) {
2194
+ peg$fail(peg$e62);
2195
+ }
2196
+ }
2197
+ if (s1 !== peg$FAILED) {
2198
+ s2 = peg$parseclass_stringcontent();
2199
+ if (input.charCodeAt(peg$currPos) === 34) {
2200
+ s3 = peg$c42;
2201
+ peg$currPos++;
2202
+ }
2203
+ else {
2204
+ s3 = peg$FAILED;
2205
+ if (peg$silentFails === 0) {
2206
+ peg$fail(peg$e62);
2207
+ }
2208
+ }
2209
+ if (s3 !== peg$FAILED) {
2210
+ peg$savedPos = s0;
2211
+ s0 = peg$f34(s2);
2212
+ }
2213
+ else {
2214
+ peg$currPos = s0;
2215
+ s0 = peg$FAILED;
2216
+ }
2217
+ }
2218
+ else {
2219
+ peg$currPos = s0;
2220
+ s0 = peg$FAILED;
2221
+ }
2222
+ peg$silentFails--;
2223
+ if (s0 === peg$FAILED) {
2224
+ s1 = peg$FAILED;
2225
+ if (peg$silentFails === 0) {
2226
+ peg$fail(peg$e65);
2227
+ }
2228
+ }
2229
+ return s0;
2230
+ }
2231
+ function peg$parseclass_stringcontent() {
2232
+ var s0, s1, s2, s3;
2233
+ s0 = [];
2234
+ s1 = peg$currPos;
2235
+ s2 = peg$currPos;
2236
+ peg$silentFails++;
2237
+ if (input.charCodeAt(peg$currPos) === 34) {
2238
+ s3 = peg$c42;
2239
+ peg$currPos++;
2240
+ }
2241
+ else {
2242
+ s3 = peg$FAILED;
2243
+ if (peg$silentFails === 0) {
2244
+ peg$fail(peg$e62);
2245
+ }
2246
+ }
2247
+ peg$silentFails--;
2248
+ if (s3 === peg$FAILED) {
2249
+ s2 = undefined;
2250
+ }
2251
+ else {
2252
+ peg$currPos = s2;
2253
+ s2 = peg$FAILED;
2254
+ }
2255
+ if (s2 !== peg$FAILED) {
2256
+ if (peg$r1.test(input.charAt(peg$currPos))) {
2257
+ s3 = input.charAt(peg$currPos);
2258
+ peg$currPos++;
2259
+ }
2260
+ else {
2261
+ s3 = peg$FAILED;
2262
+ if (peg$silentFails === 0) {
2263
+ peg$fail(peg$e66);
2264
+ }
2265
+ }
2266
+ if (s3 !== peg$FAILED) {
2267
+ peg$savedPos = s1;
2268
+ s1 = peg$f35(s3);
2269
+ }
2270
+ else {
2271
+ peg$currPos = s1;
2272
+ s1 = peg$FAILED;
2273
+ }
2274
+ }
2275
+ else {
2276
+ peg$currPos = s1;
2277
+ s1 = peg$FAILED;
2278
+ }
2279
+ while (s1 !== peg$FAILED) {
2280
+ s0.push(s1);
2281
+ s1 = peg$currPos;
2282
+ s2 = peg$currPos;
2283
+ peg$silentFails++;
2284
+ if (input.charCodeAt(peg$currPos) === 34) {
2285
+ s3 = peg$c42;
2286
+ peg$currPos++;
2287
+ }
2288
+ else {
2289
+ s3 = peg$FAILED;
2290
+ if (peg$silentFails === 0) {
2291
+ peg$fail(peg$e62);
2292
+ }
2293
+ }
2294
+ peg$silentFails--;
2295
+ if (s3 === peg$FAILED) {
2296
+ s2 = undefined;
2297
+ }
2298
+ else {
2299
+ peg$currPos = s2;
2300
+ s2 = peg$FAILED;
2301
+ }
2302
+ if (s2 !== peg$FAILED) {
2303
+ if (peg$r1.test(input.charAt(peg$currPos))) {
2304
+ s3 = input.charAt(peg$currPos);
2305
+ peg$currPos++;
2306
+ }
2307
+ else {
2308
+ s3 = peg$FAILED;
2309
+ if (peg$silentFails === 0) {
2310
+ peg$fail(peg$e66);
2311
+ }
2312
+ }
2313
+ if (s3 !== peg$FAILED) {
2314
+ peg$savedPos = s1;
2315
+ s1 = peg$f35(s3);
2316
+ }
2317
+ else {
2318
+ peg$currPos = s1;
2319
+ s1 = peg$FAILED;
2320
+ }
2321
+ }
2322
+ else {
2323
+ peg$currPos = s1;
2324
+ s1 = peg$FAILED;
2325
+ }
2326
+ }
2327
+ return s0;
2328
+ }
2329
+ function peg$parseunquotedtransitionstring() {
2330
+ var s0, s1;
2331
+ s0 = peg$currPos;
2332
+ s1 = peg$parsetransitionnonsep();
2333
+ peg$savedPos = s0;
2334
+ s1 = peg$f36(s1);
2335
+ s0 = s1;
2336
+ return s0;
2337
+ }
2338
+ function peg$parseunquotedstring() {
2339
+ var s0, s1;
2340
+ s0 = peg$currPos;
2341
+ s1 = peg$parsenonsep();
2342
+ peg$savedPos = s0;
2343
+ s1 = peg$f37(s1);
2344
+ s0 = s1;
2345
+ return s0;
2346
+ }
2347
+ function peg$parsenonsep() {
2348
+ var s0, s1, s2, s3;
2349
+ s0 = [];
2350
+ s1 = peg$currPos;
2351
+ s2 = peg$currPos;
2352
+ peg$silentFails++;
2353
+ if (input.charCodeAt(peg$currPos) === 44) {
2354
+ s3 = peg$c0;
2355
+ peg$currPos++;
2356
+ }
2357
+ else {
2358
+ s3 = peg$FAILED;
2359
+ if (peg$silentFails === 0) {
2360
+ peg$fail(peg$e1);
2361
+ }
2362
+ }
2363
+ if (s3 === peg$FAILED) {
2364
+ if (input.charCodeAt(peg$currPos) === 59) {
2365
+ s3 = peg$c1;
2366
+ peg$currPos++;
2367
+ }
2368
+ else {
2369
+ s3 = peg$FAILED;
2370
+ if (peg$silentFails === 0) {
2371
+ peg$fail(peg$e2);
2372
+ }
2373
+ }
2374
+ if (s3 === peg$FAILED) {
2375
+ if (input.charCodeAt(peg$currPos) === 123) {
2376
+ s3 = peg$c5;
2377
+ peg$currPos++;
2378
+ }
2379
+ else {
2380
+ s3 = peg$FAILED;
2381
+ if (peg$silentFails === 0) {
2382
+ peg$fail(peg$e7);
2383
+ }
2384
+ }
2385
+ }
2386
+ }
2387
+ peg$silentFails--;
2388
+ if (s3 === peg$FAILED) {
2389
+ s2 = undefined;
2390
+ }
2391
+ else {
2392
+ peg$currPos = s2;
2393
+ s2 = peg$FAILED;
2394
+ }
2395
+ if (s2 !== peg$FAILED) {
2396
+ if (input.length > peg$currPos) {
2397
+ s3 = input.charAt(peg$currPos);
2398
+ peg$currPos++;
2399
+ }
2400
+ else {
2401
+ s3 = peg$FAILED;
2402
+ if (peg$silentFails === 0) {
2403
+ peg$fail(peg$e64);
2404
+ }
2405
+ }
2406
+ if (s3 !== peg$FAILED) {
2407
+ peg$savedPos = s1;
2408
+ s1 = peg$f38(s3);
2409
+ }
2410
+ else {
2411
+ peg$currPos = s1;
2412
+ s1 = peg$FAILED;
2413
+ }
2414
+ }
2415
+ else {
2416
+ peg$currPos = s1;
2417
+ s1 = peg$FAILED;
2418
+ }
2419
+ while (s1 !== peg$FAILED) {
2420
+ s0.push(s1);
2421
+ s1 = peg$currPos;
2422
+ s2 = peg$currPos;
2423
+ peg$silentFails++;
2424
+ if (input.charCodeAt(peg$currPos) === 44) {
2425
+ s3 = peg$c0;
2426
+ peg$currPos++;
2427
+ }
2428
+ else {
2429
+ s3 = peg$FAILED;
2430
+ if (peg$silentFails === 0) {
2431
+ peg$fail(peg$e1);
2432
+ }
2433
+ }
2434
+ if (s3 === peg$FAILED) {
2435
+ if (input.charCodeAt(peg$currPos) === 59) {
2436
+ s3 = peg$c1;
2437
+ peg$currPos++;
2438
+ }
2439
+ else {
2440
+ s3 = peg$FAILED;
2441
+ if (peg$silentFails === 0) {
2442
+ peg$fail(peg$e2);
2443
+ }
2444
+ }
2445
+ if (s3 === peg$FAILED) {
2446
+ if (input.charCodeAt(peg$currPos) === 123) {
2447
+ s3 = peg$c5;
2448
+ peg$currPos++;
2449
+ }
2450
+ else {
2451
+ s3 = peg$FAILED;
2452
+ if (peg$silentFails === 0) {
2453
+ peg$fail(peg$e7);
2454
+ }
2455
+ }
2456
+ }
2457
+ }
2458
+ peg$silentFails--;
2459
+ if (s3 === peg$FAILED) {
2460
+ s2 = undefined;
2461
+ }
2462
+ else {
2463
+ peg$currPos = s2;
2464
+ s2 = peg$FAILED;
2465
+ }
2466
+ if (s2 !== peg$FAILED) {
2467
+ if (input.length > peg$currPos) {
2468
+ s3 = input.charAt(peg$currPos);
2469
+ peg$currPos++;
2470
+ }
2471
+ else {
2472
+ s3 = peg$FAILED;
2473
+ if (peg$silentFails === 0) {
2474
+ peg$fail(peg$e64);
2475
+ }
2476
+ }
2477
+ if (s3 !== peg$FAILED) {
2478
+ peg$savedPos = s1;
2479
+ s1 = peg$f38(s3);
2480
+ }
2481
+ else {
2482
+ peg$currPos = s1;
2483
+ s1 = peg$FAILED;
2484
+ }
2485
+ }
2486
+ else {
2487
+ peg$currPos = s1;
2488
+ s1 = peg$FAILED;
2489
+ }
2490
+ }
2491
+ return s0;
2492
+ }
2493
+ function peg$parsetransitionnonsep() {
2494
+ var s0, s1, s2, s3;
2495
+ s0 = [];
2496
+ s1 = peg$currPos;
2497
+ s2 = peg$currPos;
2498
+ peg$silentFails++;
2499
+ if (input.charCodeAt(peg$currPos) === 59) {
2500
+ s3 = peg$c1;
2501
+ peg$currPos++;
2502
+ }
2503
+ else {
2504
+ s3 = peg$FAILED;
2505
+ if (peg$silentFails === 0) {
2506
+ peg$fail(peg$e2);
2507
+ }
2508
+ }
2509
+ if (s3 === peg$FAILED) {
2510
+ if (input.charCodeAt(peg$currPos) === 123) {
2511
+ s3 = peg$c5;
2512
+ peg$currPos++;
2513
+ }
2514
+ else {
2515
+ s3 = peg$FAILED;
2516
+ if (peg$silentFails === 0) {
2517
+ peg$fail(peg$e7);
2518
+ }
2519
+ }
2520
+ }
2521
+ peg$silentFails--;
2522
+ if (s3 === peg$FAILED) {
2523
+ s2 = undefined;
2524
+ }
2525
+ else {
2526
+ peg$currPos = s2;
2527
+ s2 = peg$FAILED;
2528
+ }
2529
+ if (s2 !== peg$FAILED) {
2530
+ if (input.length > peg$currPos) {
2531
+ s3 = input.charAt(peg$currPos);
2532
+ peg$currPos++;
2533
+ }
2534
+ else {
2535
+ s3 = peg$FAILED;
2536
+ if (peg$silentFails === 0) {
2537
+ peg$fail(peg$e64);
2538
+ }
2539
+ }
2540
+ if (s3 !== peg$FAILED) {
2541
+ peg$savedPos = s1;
2542
+ s1 = peg$f39(s3);
2543
+ }
2544
+ else {
2545
+ peg$currPos = s1;
2546
+ s1 = peg$FAILED;
2547
+ }
2548
+ }
2549
+ else {
2550
+ peg$currPos = s1;
2551
+ s1 = peg$FAILED;
2552
+ }
2553
+ while (s1 !== peg$FAILED) {
2554
+ s0.push(s1);
2555
+ s1 = peg$currPos;
2556
+ s2 = peg$currPos;
2557
+ peg$silentFails++;
2558
+ if (input.charCodeAt(peg$currPos) === 59) {
2559
+ s3 = peg$c1;
2560
+ peg$currPos++;
2561
+ }
2562
+ else {
2563
+ s3 = peg$FAILED;
2564
+ if (peg$silentFails === 0) {
2565
+ peg$fail(peg$e2);
2566
+ }
2567
+ }
2568
+ if (s3 === peg$FAILED) {
2569
+ if (input.charCodeAt(peg$currPos) === 123) {
2570
+ s3 = peg$c5;
2571
+ peg$currPos++;
2572
+ }
2573
+ else {
2574
+ s3 = peg$FAILED;
2575
+ if (peg$silentFails === 0) {
2576
+ peg$fail(peg$e7);
2577
+ }
2578
+ }
2579
+ }
2580
+ peg$silentFails--;
2581
+ if (s3 === peg$FAILED) {
2582
+ s2 = undefined;
2583
+ }
2584
+ else {
2585
+ peg$currPos = s2;
2586
+ s2 = peg$FAILED;
2587
+ }
2588
+ if (s2 !== peg$FAILED) {
2589
+ if (input.length > peg$currPos) {
2590
+ s3 = input.charAt(peg$currPos);
2591
+ peg$currPos++;
2592
+ }
2593
+ else {
2594
+ s3 = peg$FAILED;
2595
+ if (peg$silentFails === 0) {
2596
+ peg$fail(peg$e64);
2597
+ }
2598
+ }
2599
+ if (s3 !== peg$FAILED) {
2600
+ peg$savedPos = s1;
2601
+ s1 = peg$f39(s3);
2602
+ }
2603
+ else {
2604
+ peg$currPos = s1;
2605
+ s1 = peg$FAILED;
2606
+ }
2607
+ }
2608
+ else {
2609
+ peg$currPos = s1;
2610
+ s1 = peg$FAILED;
2611
+ }
2612
+ }
2613
+ return s0;
2614
+ }
2615
+ function peg$parseidentifier() {
2616
+ var s0, s1, s2;
2617
+ peg$silentFails++;
2618
+ s0 = peg$currPos;
2619
+ s1 = [];
2620
+ if (peg$r2.test(input.charAt(peg$currPos))) {
2621
+ s2 = input.charAt(peg$currPos);
2622
+ peg$currPos++;
2623
+ }
2624
+ else {
2625
+ s2 = peg$FAILED;
2626
+ if (peg$silentFails === 0) {
2627
+ peg$fail(peg$e68);
2628
+ }
2629
+ }
2630
+ if (s2 !== peg$FAILED) {
2631
+ while (s2 !== peg$FAILED) {
2632
+ s1.push(s2);
2633
+ if (peg$r2.test(input.charAt(peg$currPos))) {
2634
+ s2 = input.charAt(peg$currPos);
2635
+ peg$currPos++;
2636
+ }
2637
+ else {
2638
+ s2 = peg$FAILED;
2639
+ if (peg$silentFails === 0) {
2640
+ peg$fail(peg$e68);
2641
+ }
2642
+ }
2643
+ }
2644
+ }
2645
+ else {
2646
+ s1 = peg$FAILED;
2647
+ }
2648
+ if (s1 !== peg$FAILED) {
2649
+ peg$savedPos = s0;
2650
+ s1 = peg$f40(s1);
2651
+ }
2652
+ s0 = s1;
2653
+ if (s0 === peg$FAILED) {
2654
+ s0 = peg$parsequotedstring();
2655
+ }
2656
+ peg$silentFails--;
2657
+ if (s0 === peg$FAILED) {
2658
+ s1 = peg$FAILED;
2659
+ if (peg$silentFails === 0) {
2660
+ peg$fail(peg$e67);
2661
+ }
2662
+ }
2663
+ return s0;
2664
+ }
2665
+ function peg$parsewhitespace() {
2666
+ var s0, s1;
2667
+ peg$silentFails++;
2668
+ s0 = peg$currPos;
2669
+ if (peg$r3.test(input.charAt(peg$currPos))) {
2670
+ s1 = input.charAt(peg$currPos);
2671
+ peg$currPos++;
2672
+ }
2673
+ else {
2674
+ s1 = peg$FAILED;
2675
+ if (peg$silentFails === 0) {
2676
+ peg$fail(peg$e70);
2677
+ }
2678
+ }
2679
+ if (s1 !== peg$FAILED) {
2680
+ peg$savedPos = s0;
2681
+ s1 = peg$f41(s1);
2682
+ }
2683
+ s0 = s1;
2684
+ peg$silentFails--;
2685
+ if (s0 === peg$FAILED) {
2686
+ s1 = peg$FAILED;
2687
+ if (peg$silentFails === 0) {
2688
+ peg$fail(peg$e69);
2689
+ }
2690
+ }
2691
+ return s0;
2692
+ }
2693
+ function peg$parselineend() {
2694
+ var s0, s1;
2695
+ peg$silentFails++;
2696
+ s0 = peg$currPos;
2697
+ if (peg$r4.test(input.charAt(peg$currPos))) {
2698
+ s1 = input.charAt(peg$currPos);
2699
+ peg$currPos++;
2700
+ }
2701
+ else {
2702
+ s1 = peg$FAILED;
2703
+ if (peg$silentFails === 0) {
2704
+ peg$fail(peg$e72);
2705
+ }
2706
+ }
2707
+ if (s1 !== peg$FAILED) {
2708
+ peg$savedPos = s0;
2709
+ s1 = peg$f42(s1);
2710
+ }
2711
+ s0 = s1;
2712
+ peg$silentFails--;
2713
+ if (s0 === peg$FAILED) {
2714
+ s1 = peg$FAILED;
2715
+ if (peg$silentFails === 0) {
2716
+ peg$fail(peg$e71);
2717
+ }
2718
+ }
2719
+ return s0;
2720
+ }
2721
+ function peg$parsemlcomstart() {
2722
+ var s0;
2723
+ if (input.substr(peg$currPos, 2) === peg$c44) {
2724
+ s0 = peg$c44;
2725
+ peg$currPos += 2;
2726
+ }
2727
+ else {
2728
+ s0 = peg$FAILED;
2729
+ if (peg$silentFails === 0) {
2730
+ peg$fail(peg$e73);
2731
+ }
2732
+ }
2733
+ return s0;
2734
+ }
2735
+ function peg$parsemlcomend() {
2736
+ var s0;
2737
+ if (input.substr(peg$currPos, 2) === peg$c45) {
2738
+ s0 = peg$c45;
2739
+ peg$currPos += 2;
2740
+ }
2741
+ else {
2742
+ s0 = peg$FAILED;
2743
+ if (peg$silentFails === 0) {
2744
+ peg$fail(peg$e74);
2745
+ }
2746
+ }
2747
+ return s0;
2748
+ }
2749
+ function peg$parsemlcomtok() {
2750
+ var s0, s1, s2;
2751
+ s0 = peg$currPos;
2752
+ s1 = peg$currPos;
2753
+ peg$silentFails++;
2754
+ if (input.substr(peg$currPos, 2) === peg$c45) {
2755
+ s2 = peg$c45;
2756
+ peg$currPos += 2;
2757
+ }
2758
+ else {
2759
+ s2 = peg$FAILED;
2760
+ if (peg$silentFails === 0) {
2761
+ peg$fail(peg$e74);
2762
+ }
2763
+ }
2764
+ peg$silentFails--;
2765
+ if (s2 === peg$FAILED) {
2766
+ s1 = undefined;
2767
+ }
2768
+ else {
2769
+ peg$currPos = s1;
2770
+ s1 = peg$FAILED;
2771
+ }
2772
+ if (s1 !== peg$FAILED) {
2773
+ if (input.length > peg$currPos) {
2774
+ s2 = input.charAt(peg$currPos);
2775
+ peg$currPos++;
2776
+ }
2777
+ else {
2778
+ s2 = peg$FAILED;
2779
+ if (peg$silentFails === 0) {
2780
+ peg$fail(peg$e64);
2781
+ }
2782
+ }
2783
+ if (s2 !== peg$FAILED) {
2784
+ peg$savedPos = s0;
2785
+ s0 = peg$f43(s2);
2786
+ }
2787
+ else {
2788
+ peg$currPos = s0;
2789
+ s0 = peg$FAILED;
2790
+ }
2791
+ }
2792
+ else {
2793
+ peg$currPos = s0;
2794
+ s0 = peg$FAILED;
2795
+ }
2796
+ return s0;
2797
+ }
2798
+ function peg$parsemlcomment() {
2799
+ var s0, s1, s2, s3;
2800
+ s0 = peg$currPos;
2801
+ s1 = peg$parsemlcomstart();
2802
+ if (s1 !== peg$FAILED) {
2803
+ s2 = [];
2804
+ s3 = peg$parsemlcomtok();
2805
+ while (s3 !== peg$FAILED) {
2806
+ s2.push(s3);
2807
+ s3 = peg$parsemlcomtok();
2808
+ }
2809
+ s3 = peg$parsemlcomend();
2810
+ if (s3 !== peg$FAILED) {
2811
+ peg$savedPos = s0;
2812
+ s0 = peg$f44(s1, s2, s3);
2813
+ }
2814
+ else {
2815
+ peg$currPos = s0;
2816
+ s0 = peg$FAILED;
2817
+ }
2818
+ }
2819
+ else {
2820
+ peg$currPos = s0;
2821
+ s0 = peg$FAILED;
2822
+ }
2823
+ return s0;
2824
+ }
2825
+ function peg$parseslcomstart() {
2826
+ var s0;
2827
+ if (input.substr(peg$currPos, 2) === peg$c46) {
2828
+ s0 = peg$c46;
2829
+ peg$currPos += 2;
2830
+ }
2831
+ else {
2832
+ s0 = peg$FAILED;
2833
+ if (peg$silentFails === 0) {
2834
+ peg$fail(peg$e75);
2835
+ }
2836
+ }
2837
+ return s0;
2838
+ }
2839
+ function peg$parseslcomtok() {
2840
+ var s0;
2841
+ if (peg$r5.test(input.charAt(peg$currPos))) {
2842
+ s0 = input.charAt(peg$currPos);
2843
+ peg$currPos++;
2844
+ }
2845
+ else {
2846
+ s0 = peg$FAILED;
2847
+ if (peg$silentFails === 0) {
2848
+ peg$fail(peg$e76);
2849
+ }
2850
+ }
2851
+ return s0;
2852
+ }
2853
+ function peg$parseslcomment() {
2854
+ var s0, s1, s2, s3;
2855
+ s0 = peg$currPos;
2856
+ s1 = peg$parseslcomstart();
2857
+ if (s1 !== peg$FAILED) {
2858
+ s2 = [];
2859
+ s3 = peg$parseslcomtok();
2860
+ while (s3 !== peg$FAILED) {
2861
+ s2.push(s3);
2862
+ s3 = peg$parseslcomtok();
2863
+ }
2864
+ peg$savedPos = s0;
2865
+ s0 = peg$f45(s1, s2);
2866
+ }
2867
+ else {
2868
+ peg$currPos = s0;
2869
+ s0 = peg$FAILED;
2870
+ }
2871
+ return s0;
2872
+ }
2873
+ function peg$parsecomment() {
2874
+ var s0, s1;
2875
+ peg$silentFails++;
2876
+ s0 = peg$parseslcomment();
2877
+ if (s0 === peg$FAILED) {
2878
+ s0 = peg$parsemlcomment();
2879
+ }
2880
+ peg$silentFails--;
2881
+ if (s0 === peg$FAILED) {
2882
+ s1 = peg$FAILED;
2883
+ if (peg$silentFails === 0) {
2884
+ peg$fail(peg$e77);
2885
+ }
2886
+ }
2887
+ return s0;
2888
+ }
2889
+ function peg$parse_() {
2890
+ var s0, s1;
2891
+ s0 = [];
2892
+ s1 = peg$parsewhitespace();
2893
+ if (s1 === peg$FAILED) {
2894
+ s1 = peg$parselineend();
2895
+ if (s1 === peg$FAILED) {
2896
+ s1 = peg$parsecomment();
2897
+ }
2898
+ }
2899
+ while (s1 !== peg$FAILED) {
2900
+ s0.push(s1);
2901
+ s1 = peg$parsewhitespace();
2902
+ if (s1 === peg$FAILED) {
2903
+ s1 = peg$parselineend();
2904
+ if (s1 === peg$FAILED) {
2905
+ s1 = peg$parsecomment();
2906
+ }
2907
+ }
2908
+ }
2909
+ return s0;
2910
+ }
2911
+ peg$result = peg$startRuleFunction();
2912
+ if (peg$result !== peg$FAILED && peg$currPos === input.length) {
2913
+ return peg$result;
2914
+ }
2915
+ else {
2916
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
2917
+ peg$fail(peg$endExpectation());
2918
+ }
2919
+ throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
2920
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
2921
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
2922
+ }
2923
+ }
2924
+ export { peg$SyntaxError as SyntaxError, peg$parse as parse };