objection 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/lib/queryBuilder/InternalOptions.js +2 -0
- package/lib/queryBuilder/graph/GraphOptions.js +153 -6
- package/lib/queryBuilder/graph/GraphUpsert.js +35 -0
- package/lib/queryBuilder/graph/patch/GraphPatchAction.js +3 -0
- package/lib/queryBuilder/parsers/jsonFieldExpressionParser.js +434 -364
- package/lib/queryBuilder/parsers/relationExpressionParser.js +512 -547
- package/lib/relations/Relation.js +6 -0
- package/lib/relations/RelationFindOperation.js +6 -1
- package/lib/relations/belongsToOne/BelongsToOneRelation.js +9 -0
- package/lib/relations/manyToMany/ManyToManyModifyMixin.js +5 -1
- package/lib/relations/manyToMany/ManyToManyRelation.js +7 -2
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperationBase.js +21 -1
- package/lib/utils/objectUtils.js +77 -2
- package/package.json +5 -2
- package/typings/objection/index.d.ts +10 -10
- package/lib/utils/clone.js +0 -2329
|
@@ -1,277 +1,316 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* http://pegjs.org/
|
|
5
|
-
*/
|
|
1
|
+
// @generated by Peggy 5.1.0.
|
|
2
|
+
//
|
|
3
|
+
// https://peggyjs.org/
|
|
6
4
|
|
|
7
5
|
'use strict';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
class peg$SyntaxError extends SyntaxError {
|
|
8
|
+
constructor(message, expected, found, location) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.expected = expected;
|
|
11
|
+
this.found = found;
|
|
12
|
+
this.location = location;
|
|
13
|
+
this.name = 'SyntaxError';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
format(sources) {
|
|
17
|
+
let str = 'Error: ' + this.message;
|
|
18
|
+
if (this.location) {
|
|
19
|
+
let src = null;
|
|
20
|
+
const st = sources.find((s) => s.source === this.location.source);
|
|
21
|
+
if (st) {
|
|
22
|
+
src = st.text.split(/\r\n|\n|\r/g);
|
|
23
|
+
}
|
|
24
|
+
const s = this.location.start;
|
|
25
|
+
const offset_s =
|
|
26
|
+
this.location.source && typeof this.location.source.offset === 'function'
|
|
27
|
+
? this.location.source.offset(s)
|
|
28
|
+
: s;
|
|
29
|
+
const loc = this.location.source + ':' + offset_s.line + ':' + offset_s.column;
|
|
30
|
+
if (src) {
|
|
31
|
+
const e = this.location.end;
|
|
32
|
+
const filler = ''.padEnd(offset_s.line.toString().length, ' ');
|
|
33
|
+
const line = src[s.line - 1];
|
|
34
|
+
const last = s.line === e.line ? e.column : line.length + 1;
|
|
35
|
+
const hatLen = last - s.column || 1;
|
|
36
|
+
str +=
|
|
37
|
+
'\n --> ' +
|
|
38
|
+
loc +
|
|
39
|
+
'\n' +
|
|
40
|
+
filler +
|
|
41
|
+
' |\n' +
|
|
42
|
+
offset_s.line +
|
|
43
|
+
' | ' +
|
|
44
|
+
line +
|
|
45
|
+
'\n' +
|
|
46
|
+
filler +
|
|
47
|
+
' | ' +
|
|
48
|
+
''.padEnd(s.column - 1, ' ') +
|
|
49
|
+
''.padEnd(hatLen, '^');
|
|
50
|
+
} else {
|
|
51
|
+
str += '\n at ' + loc;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return str;
|
|
26
55
|
}
|
|
27
|
-
}
|
|
28
56
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
literal: function (expectation) {
|
|
34
|
-
return '"' + literalEscape(expectation.text) + '"';
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
class: function (expectation) {
|
|
38
|
-
var escapedParts = '',
|
|
39
|
-
i;
|
|
57
|
+
static buildMessage(expected, found) {
|
|
58
|
+
function hex(ch) {
|
|
59
|
+
return ch.codePointAt(0).toString(16).toUpperCase();
|
|
60
|
+
}
|
|
40
61
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
62
|
+
const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, 'unicode')
|
|
63
|
+
? new RegExp('[\\p{C}\\p{Mn}\\p{Mc}]', 'gu')
|
|
64
|
+
: null;
|
|
65
|
+
function unicodeEscape(s) {
|
|
66
|
+
if (nonPrintable) {
|
|
67
|
+
return s.replace(nonPrintable, (ch) => '\\u{' + hex(ch) + '}');
|
|
46
68
|
}
|
|
69
|
+
return s;
|
|
70
|
+
}
|
|
47
71
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
function literalEscape(s) {
|
|
73
|
+
return unicodeEscape(
|
|
74
|
+
s
|
|
75
|
+
.replace(/\\/g, '\\\\')
|
|
76
|
+
.replace(/"/g, '\\"')
|
|
77
|
+
.replace(/\0/g, '\\0')
|
|
78
|
+
.replace(/\t/g, '\\t')
|
|
79
|
+
.replace(/\n/g, '\\n')
|
|
80
|
+
.replace(/\r/g, '\\r')
|
|
81
|
+
.replace(/[\x00-\x0F]/g, (ch) => '\\x0' + hex(ch))
|
|
82
|
+
.replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => '\\x' + hex(ch)),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
54
85
|
|
|
55
|
-
|
|
56
|
-
return
|
|
57
|
-
|
|
86
|
+
function classEscape(s) {
|
|
87
|
+
return unicodeEscape(
|
|
88
|
+
s
|
|
89
|
+
.replace(/\\/g, '\\\\')
|
|
90
|
+
.replace(/\]/g, '\\]')
|
|
91
|
+
.replace(/\^/g, '\\^')
|
|
92
|
+
.replace(/-/g, '\\-')
|
|
93
|
+
.replace(/\0/g, '\\0')
|
|
94
|
+
.replace(/\t/g, '\\t')
|
|
95
|
+
.replace(/\n/g, '\\n')
|
|
96
|
+
.replace(/\r/g, '\\r')
|
|
97
|
+
.replace(/[\x00-\x0F]/g, (ch) => '\\x0' + hex(ch))
|
|
98
|
+
.replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => '\\x' + hex(ch)),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
58
101
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
102
|
+
const DESCRIBE_EXPECTATION_FNS = {
|
|
103
|
+
literal(expectation) {
|
|
104
|
+
return '"' + literalEscape(expectation.text) + '"';
|
|
105
|
+
},
|
|
63
106
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
107
|
+
class(expectation) {
|
|
108
|
+
const escapedParts = expectation.parts.map((part) =>
|
|
109
|
+
Array.isArray(part)
|
|
110
|
+
? classEscape(part[0]) + '-' + classEscape(part[1])
|
|
111
|
+
: classEscape(part),
|
|
112
|
+
);
|
|
67
113
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
.replace(/[\x00-\x0F]/g, function (ch) {
|
|
77
|
-
return '\\x0' + hex(ch);
|
|
78
|
-
})
|
|
79
|
-
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
|
|
80
|
-
return '\\x' + hex(ch);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
114
|
+
return (
|
|
115
|
+
'[' +
|
|
116
|
+
(expectation.inverted ? '^' : '') +
|
|
117
|
+
escapedParts.join('') +
|
|
118
|
+
']' +
|
|
119
|
+
(expectation.unicode ? 'u' : '')
|
|
120
|
+
);
|
|
121
|
+
},
|
|
83
122
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.replace(/\]/g, '\\]')
|
|
88
|
-
.replace(/\^/g, '\\^')
|
|
89
|
-
.replace(/-/g, '\\-')
|
|
90
|
-
.replace(/\0/g, '\\0')
|
|
91
|
-
.replace(/\t/g, '\\t')
|
|
92
|
-
.replace(/\n/g, '\\n')
|
|
93
|
-
.replace(/\r/g, '\\r')
|
|
94
|
-
.replace(/[\x00-\x0F]/g, function (ch) {
|
|
95
|
-
return '\\x0' + hex(ch);
|
|
96
|
-
})
|
|
97
|
-
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
|
|
98
|
-
return '\\x' + hex(ch);
|
|
99
|
-
});
|
|
100
|
-
}
|
|
123
|
+
any() {
|
|
124
|
+
return 'any character';
|
|
125
|
+
},
|
|
101
126
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
127
|
+
end() {
|
|
128
|
+
return 'end of input';
|
|
129
|
+
},
|
|
105
130
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
131
|
+
other(expectation) {
|
|
132
|
+
return expectation.description;
|
|
133
|
+
},
|
|
134
|
+
};
|
|
110
135
|
|
|
111
|
-
|
|
112
|
-
|
|
136
|
+
function describeExpectation(expectation) {
|
|
137
|
+
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
113
138
|
}
|
|
114
139
|
|
|
115
|
-
|
|
140
|
+
function describeExpected(expected) {
|
|
141
|
+
const descriptions = expected.map(describeExpectation);
|
|
142
|
+
descriptions.sort();
|
|
116
143
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
descriptions[
|
|
121
|
-
|
|
144
|
+
if (descriptions.length > 0) {
|
|
145
|
+
let j = 1;
|
|
146
|
+
for (let i = 1; i < descriptions.length; i++) {
|
|
147
|
+
if (descriptions[i - 1] !== descriptions[i]) {
|
|
148
|
+
descriptions[j] = descriptions[i];
|
|
149
|
+
j++;
|
|
150
|
+
}
|
|
122
151
|
}
|
|
152
|
+
descriptions.length = j;
|
|
123
153
|
}
|
|
124
|
-
descriptions.length = j;
|
|
125
|
-
}
|
|
126
154
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
155
|
+
switch (descriptions.length) {
|
|
156
|
+
case 1:
|
|
157
|
+
return descriptions[0];
|
|
130
158
|
|
|
131
|
-
|
|
132
|
-
|
|
159
|
+
case 2:
|
|
160
|
+
return descriptions[0] + ' or ' + descriptions[1];
|
|
133
161
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
162
|
+
default:
|
|
163
|
+
return (
|
|
164
|
+
descriptions.slice(0, -1).join(', ') + ', or ' + descriptions[descriptions.length - 1]
|
|
165
|
+
);
|
|
166
|
+
}
|
|
138
167
|
}
|
|
139
|
-
}
|
|
140
168
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
169
|
+
function describeFound(found) {
|
|
170
|
+
return found ? '"' + literalEscape(found) + '"' : 'end of input';
|
|
171
|
+
}
|
|
144
172
|
|
|
145
|
-
|
|
146
|
-
}
|
|
173
|
+
return 'Expected ' + describeExpected(expected) + ' but ' + describeFound(found) + ' found.';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
147
176
|
|
|
148
177
|
function peg$parse(input, options) {
|
|
149
|
-
options = options !==
|
|
178
|
+
options = options !== undefined ? options : {};
|
|
150
179
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
peg$startRuleFunction = peg$parsestart,
|
|
154
|
-
peg$c0 = function (expr) {
|
|
155
|
-
const node = newNode();
|
|
180
|
+
const peg$FAILED = {};
|
|
181
|
+
const peg$source = options.grammarSource;
|
|
156
182
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
183
|
+
const peg$startRuleFunctions = {
|
|
184
|
+
start: peg$parsestart,
|
|
185
|
+
};
|
|
186
|
+
let peg$startRuleFunction = peg$parsestart;
|
|
187
|
+
|
|
188
|
+
const peg$c0 = 'as';
|
|
189
|
+
const peg$c1 = '(';
|
|
190
|
+
const peg$c2 = ')';
|
|
191
|
+
const peg$c3 = ',';
|
|
192
|
+
const peg$c4 = '.';
|
|
193
|
+
const peg$c5 = '[';
|
|
194
|
+
const peg$c6 = ']';
|
|
195
|
+
|
|
196
|
+
const peg$r0 = /^[^[\](),. \t\r\n]/;
|
|
197
|
+
const peg$r1 = /^[ \t\r\n]/;
|
|
198
|
+
|
|
199
|
+
const peg$e0 = peg$literalExpectation('as', false);
|
|
200
|
+
const peg$e1 = peg$classExpectation(
|
|
201
|
+
['[', ']', '(', ')', ',', '.', ' ', '\t', '\r', '\n'],
|
|
202
|
+
true,
|
|
203
|
+
false,
|
|
204
|
+
false,
|
|
205
|
+
);
|
|
206
|
+
const peg$e2 = peg$literalExpectation('(', false);
|
|
207
|
+
const peg$e3 = peg$literalExpectation(')', false);
|
|
208
|
+
const peg$e4 = peg$literalExpectation(',', false);
|
|
209
|
+
const peg$e5 = peg$classExpectation([' ', '\t', '\r', '\n'], false, false, false);
|
|
210
|
+
const peg$e6 = peg$literalExpectation('.', false);
|
|
211
|
+
const peg$e7 = peg$literalExpectation('[', false);
|
|
212
|
+
const peg$e8 = peg$literalExpectation(']', false);
|
|
213
|
+
|
|
214
|
+
function peg$f0(expr) {
|
|
215
|
+
const node = newNode();
|
|
216
|
+
|
|
217
|
+
if (expr.$name === '*') {
|
|
218
|
+
node.$allRecursive = true;
|
|
219
|
+
} else {
|
|
220
|
+
assertDuplicateRelation(node, expr);
|
|
221
|
+
node[expr.$name] = expr;
|
|
222
|
+
node.$childNames.push(expr.$name);
|
|
223
|
+
}
|
|
164
224
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
225
|
+
return node;
|
|
226
|
+
}
|
|
227
|
+
function peg$f1(list) {
|
|
228
|
+
const node = newNode();
|
|
169
229
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
230
|
+
list.forEach((expr) => {
|
|
231
|
+
assertDuplicateRelation(node, expr);
|
|
232
|
+
node[expr.$name] = expr;
|
|
233
|
+
node.$childNames.push(expr.$name);
|
|
234
|
+
});
|
|
175
235
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
236
|
+
return node;
|
|
237
|
+
}
|
|
238
|
+
function peg$f2(name, args, alias, list) {
|
|
239
|
+
const node = newNode();
|
|
180
240
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
241
|
+
node.$name = alias || name;
|
|
242
|
+
node.$relation = name;
|
|
243
|
+
node.$modify = args || [];
|
|
184
244
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
245
|
+
list.forEach((expr) => {
|
|
246
|
+
assertDuplicateRelation(node, expr);
|
|
247
|
+
node[expr.$name] = expr;
|
|
248
|
+
node.$childNames.push(expr.$name);
|
|
249
|
+
});
|
|
190
250
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
251
|
+
return node;
|
|
252
|
+
}
|
|
253
|
+
function peg$f3(name, args, alias, expr) {
|
|
254
|
+
const node = newNode();
|
|
195
255
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
256
|
+
node.$name = alias || name;
|
|
257
|
+
node.$relation = name;
|
|
258
|
+
node.$modify = args || [];
|
|
199
259
|
|
|
200
|
-
|
|
201
|
-
|
|
260
|
+
if (expr) {
|
|
261
|
+
const match = /^\^(\d*)$/.exec(expr.$name);
|
|
202
262
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
} else {
|
|
207
|
-
node.$recursive = true;
|
|
208
|
-
}
|
|
209
|
-
} else if (expr.$name === '*') {
|
|
210
|
-
node.$allRecursive = true;
|
|
263
|
+
if (match) {
|
|
264
|
+
if (match[1]) {
|
|
265
|
+
node.$recursive = parseInt(match[1], 10);
|
|
211
266
|
} else {
|
|
212
|
-
|
|
213
|
-
node[expr.$name] = expr;
|
|
214
|
-
node.$childNames.push(expr.$name);
|
|
267
|
+
node.$recursive = true;
|
|
215
268
|
}
|
|
269
|
+
} else if (expr.$name === '*') {
|
|
270
|
+
node.$allRecursive = true;
|
|
271
|
+
} else {
|
|
272
|
+
assertDuplicateRelation(node, expr);
|
|
273
|
+
node[expr.$name] = expr;
|
|
274
|
+
node.$childNames.push(expr.$name);
|
|
216
275
|
}
|
|
276
|
+
}
|
|
217
277
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
peg$c24 = peg$literalExpectation('[', false),
|
|
255
|
-
peg$c25 = ']',
|
|
256
|
-
peg$c26 = peg$literalExpectation(']', false),
|
|
257
|
-
peg$c27 = function (items) {
|
|
258
|
-
return items;
|
|
259
|
-
},
|
|
260
|
-
peg$c28 = function (expr) {
|
|
261
|
-
return expr;
|
|
262
|
-
},
|
|
263
|
-
peg$c29 = function (sub) {
|
|
264
|
-
return sub;
|
|
265
|
-
},
|
|
266
|
-
peg$currPos = 0,
|
|
267
|
-
peg$savedPos = 0,
|
|
268
|
-
peg$posDetailsCache = [{ line: 1, column: 1 }],
|
|
269
|
-
peg$maxFailPos = 0,
|
|
270
|
-
peg$maxFailExpected = [],
|
|
271
|
-
peg$silentFails = 0,
|
|
272
|
-
peg$result;
|
|
273
|
-
|
|
274
|
-
if ('startRule' in options) {
|
|
278
|
+
return node;
|
|
279
|
+
}
|
|
280
|
+
function peg$f4(alias) {
|
|
281
|
+
return alias;
|
|
282
|
+
}
|
|
283
|
+
function peg$f5(name) {
|
|
284
|
+
return name.join('');
|
|
285
|
+
}
|
|
286
|
+
function peg$f6(args) {
|
|
287
|
+
return args;
|
|
288
|
+
}
|
|
289
|
+
function peg$f7(arg) {
|
|
290
|
+
return arg;
|
|
291
|
+
}
|
|
292
|
+
function peg$f8(list) {
|
|
293
|
+
return list;
|
|
294
|
+
}
|
|
295
|
+
function peg$f9(items) {
|
|
296
|
+
return items;
|
|
297
|
+
}
|
|
298
|
+
function peg$f10(expr) {
|
|
299
|
+
return expr;
|
|
300
|
+
}
|
|
301
|
+
function peg$f11(sub) {
|
|
302
|
+
return sub;
|
|
303
|
+
}
|
|
304
|
+
let peg$currPos = options.peg$currPos | 0;
|
|
305
|
+
let peg$savedPos = peg$currPos;
|
|
306
|
+
const peg$posDetailsCache = [{ line: 1, column: 1 }];
|
|
307
|
+
let peg$maxFailPos = peg$currPos;
|
|
308
|
+
let peg$maxFailExpected = options.peg$maxFailExpected || [];
|
|
309
|
+
let peg$silentFails = options.peg$silentFails | 0;
|
|
310
|
+
|
|
311
|
+
let peg$result;
|
|
312
|
+
|
|
313
|
+
if (options.startRule) {
|
|
275
314
|
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
276
315
|
throw new Error('Can\'t start parsing from rule "' + options.startRule + '".');
|
|
277
316
|
}
|
|
@@ -283,12 +322,24 @@ function peg$parse(input, options) {
|
|
|
283
322
|
return input.substring(peg$savedPos, peg$currPos);
|
|
284
323
|
}
|
|
285
324
|
|
|
325
|
+
function offset() {
|
|
326
|
+
return peg$savedPos;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function range() {
|
|
330
|
+
return {
|
|
331
|
+
source: peg$source,
|
|
332
|
+
start: peg$savedPos,
|
|
333
|
+
end: peg$currPos,
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
|
|
286
337
|
function location() {
|
|
287
338
|
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
288
339
|
}
|
|
289
340
|
|
|
290
341
|
function expected(description, location) {
|
|
291
|
-
location = location !==
|
|
342
|
+
location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
292
343
|
|
|
293
344
|
throw peg$buildStructuredError(
|
|
294
345
|
[peg$otherExpectation(description)],
|
|
@@ -298,17 +349,25 @@ function peg$parse(input, options) {
|
|
|
298
349
|
}
|
|
299
350
|
|
|
300
351
|
function error(message, location) {
|
|
301
|
-
location = location !==
|
|
352
|
+
location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
302
353
|
|
|
303
354
|
throw peg$buildSimpleError(message, location);
|
|
304
355
|
}
|
|
305
356
|
|
|
357
|
+
function peg$getUnicode(pos = peg$currPos) {
|
|
358
|
+
const cp = input.codePointAt(pos);
|
|
359
|
+
if (cp === undefined) {
|
|
360
|
+
return '';
|
|
361
|
+
}
|
|
362
|
+
return String.fromCodePoint(cp);
|
|
363
|
+
}
|
|
364
|
+
|
|
306
365
|
function peg$literalExpectation(text, ignoreCase) {
|
|
307
|
-
return { type: 'literal', text
|
|
366
|
+
return { type: 'literal', text, ignoreCase };
|
|
308
367
|
}
|
|
309
368
|
|
|
310
|
-
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
311
|
-
return { type: 'class', parts
|
|
369
|
+
function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
|
|
370
|
+
return { type: 'class', parts, inverted, ignoreCase, unicode };
|
|
312
371
|
}
|
|
313
372
|
|
|
314
373
|
function peg$anyExpectation() {
|
|
@@ -320,19 +379,21 @@ function peg$parse(input, options) {
|
|
|
320
379
|
}
|
|
321
380
|
|
|
322
381
|
function peg$otherExpectation(description) {
|
|
323
|
-
return { type: 'other', description
|
|
382
|
+
return { type: 'other', description };
|
|
324
383
|
}
|
|
325
384
|
|
|
326
385
|
function peg$computePosDetails(pos) {
|
|
327
|
-
|
|
328
|
-
|
|
386
|
+
let details = peg$posDetailsCache[pos];
|
|
387
|
+
let p;
|
|
329
388
|
|
|
330
389
|
if (details) {
|
|
331
390
|
return details;
|
|
332
391
|
} else {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
392
|
+
if (pos >= peg$posDetailsCache.length) {
|
|
393
|
+
p = peg$posDetailsCache.length - 1;
|
|
394
|
+
} else {
|
|
395
|
+
p = pos;
|
|
396
|
+
while (!peg$posDetailsCache[--p]) {}
|
|
336
397
|
}
|
|
337
398
|
|
|
338
399
|
details = peg$posDetailsCache[p];
|
|
@@ -353,15 +414,17 @@ function peg$parse(input, options) {
|
|
|
353
414
|
}
|
|
354
415
|
|
|
355
416
|
peg$posDetailsCache[pos] = details;
|
|
417
|
+
|
|
356
418
|
return details;
|
|
357
419
|
}
|
|
358
420
|
}
|
|
359
421
|
|
|
360
|
-
function peg$computeLocation(startPos, endPos) {
|
|
361
|
-
|
|
362
|
-
|
|
422
|
+
function peg$computeLocation(startPos, endPos, offset) {
|
|
423
|
+
const startPosDetails = peg$computePosDetails(startPos);
|
|
424
|
+
const endPosDetails = peg$computePosDetails(endPos);
|
|
363
425
|
|
|
364
|
-
|
|
426
|
+
const res = {
|
|
427
|
+
source: peg$source,
|
|
365
428
|
start: {
|
|
366
429
|
offset: startPos,
|
|
367
430
|
line: startPosDetails.line,
|
|
@@ -373,6 +436,11 @@ function peg$parse(input, options) {
|
|
|
373
436
|
column: endPosDetails.column,
|
|
374
437
|
},
|
|
375
438
|
};
|
|
439
|
+
if (offset && peg$source && typeof peg$source.offset === 'function') {
|
|
440
|
+
res.start = peg$source.offset(res.start);
|
|
441
|
+
res.end = peg$source.offset(res.end);
|
|
442
|
+
}
|
|
443
|
+
return res;
|
|
376
444
|
}
|
|
377
445
|
|
|
378
446
|
function peg$fail(expected) {
|
|
@@ -402,13 +470,13 @@ function peg$parse(input, options) {
|
|
|
402
470
|
}
|
|
403
471
|
|
|
404
472
|
function peg$parsestart() {
|
|
405
|
-
|
|
473
|
+
let s0, s1;
|
|
406
474
|
|
|
407
475
|
s0 = peg$currPos;
|
|
408
476
|
s1 = peg$parseexpression();
|
|
409
477
|
if (s1 !== peg$FAILED) {
|
|
410
478
|
peg$savedPos = s0;
|
|
411
|
-
s1 = peg$
|
|
479
|
+
s1 = peg$f0(s1);
|
|
412
480
|
}
|
|
413
481
|
s0 = s1;
|
|
414
482
|
if (s0 === peg$FAILED) {
|
|
@@ -416,7 +484,7 @@ function peg$parse(input, options) {
|
|
|
416
484
|
s1 = peg$parselistExpression();
|
|
417
485
|
if (s1 !== peg$FAILED) {
|
|
418
486
|
peg$savedPos = s0;
|
|
419
|
-
s1 = peg$
|
|
487
|
+
s1 = peg$f1(s1);
|
|
420
488
|
}
|
|
421
489
|
s0 = s1;
|
|
422
490
|
}
|
|
@@ -425,7 +493,7 @@ function peg$parse(input, options) {
|
|
|
425
493
|
}
|
|
426
494
|
|
|
427
495
|
function peg$parseexpression() {
|
|
428
|
-
|
|
496
|
+
let s0, s1, s2, s3, s4;
|
|
429
497
|
|
|
430
498
|
s0 = peg$currPos;
|
|
431
499
|
s1 = peg$parsename();
|
|
@@ -434,25 +502,14 @@ function peg$parse(input, options) {
|
|
|
434
502
|
if (s2 === peg$FAILED) {
|
|
435
503
|
s2 = null;
|
|
436
504
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
peg$savedPos = s0;
|
|
446
|
-
s1 = peg$c2(s1, s2, s3, s4);
|
|
447
|
-
s0 = s1;
|
|
448
|
-
} else {
|
|
449
|
-
peg$currPos = s0;
|
|
450
|
-
s0 = peg$FAILED;
|
|
451
|
-
}
|
|
452
|
-
} else {
|
|
453
|
-
peg$currPos = s0;
|
|
454
|
-
s0 = peg$FAILED;
|
|
455
|
-
}
|
|
505
|
+
s3 = peg$parsealias();
|
|
506
|
+
if (s3 === peg$FAILED) {
|
|
507
|
+
s3 = null;
|
|
508
|
+
}
|
|
509
|
+
s4 = peg$parsesubListExpression();
|
|
510
|
+
if (s4 !== peg$FAILED) {
|
|
511
|
+
peg$savedPos = s0;
|
|
512
|
+
s0 = peg$f2(s1, s2, s3, s4);
|
|
456
513
|
} else {
|
|
457
514
|
peg$currPos = s0;
|
|
458
515
|
s0 = peg$FAILED;
|
|
@@ -469,32 +526,16 @@ function peg$parse(input, options) {
|
|
|
469
526
|
if (s2 === peg$FAILED) {
|
|
470
527
|
s2 = null;
|
|
471
528
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
s3 = null;
|
|
476
|
-
}
|
|
477
|
-
if (s3 !== peg$FAILED) {
|
|
478
|
-
s4 = peg$parsesubExpression();
|
|
479
|
-
if (s4 === peg$FAILED) {
|
|
480
|
-
s4 = null;
|
|
481
|
-
}
|
|
482
|
-
if (s4 !== peg$FAILED) {
|
|
483
|
-
peg$savedPos = s0;
|
|
484
|
-
s1 = peg$c3(s1, s2, s3, s4);
|
|
485
|
-
s0 = s1;
|
|
486
|
-
} else {
|
|
487
|
-
peg$currPos = s0;
|
|
488
|
-
s0 = peg$FAILED;
|
|
489
|
-
}
|
|
490
|
-
} else {
|
|
491
|
-
peg$currPos = s0;
|
|
492
|
-
s0 = peg$FAILED;
|
|
493
|
-
}
|
|
494
|
-
} else {
|
|
495
|
-
peg$currPos = s0;
|
|
496
|
-
s0 = peg$FAILED;
|
|
529
|
+
s3 = peg$parsealias();
|
|
530
|
+
if (s3 === peg$FAILED) {
|
|
531
|
+
s3 = null;
|
|
497
532
|
}
|
|
533
|
+
s4 = peg$parsesubExpression();
|
|
534
|
+
if (s4 === peg$FAILED) {
|
|
535
|
+
s4 = null;
|
|
536
|
+
}
|
|
537
|
+
peg$savedPos = s0;
|
|
538
|
+
s0 = peg$f3(s1, s2, s3, s4);
|
|
498
539
|
} else {
|
|
499
540
|
peg$currPos = s0;
|
|
500
541
|
s0 = peg$FAILED;
|
|
@@ -505,7 +546,7 @@ function peg$parse(input, options) {
|
|
|
505
546
|
}
|
|
506
547
|
|
|
507
548
|
function peg$parsealias() {
|
|
508
|
-
|
|
549
|
+
let s0, s1, s2, s3, s4;
|
|
509
550
|
|
|
510
551
|
s0 = peg$currPos;
|
|
511
552
|
s1 = [];
|
|
@@ -519,13 +560,13 @@ function peg$parse(input, options) {
|
|
|
519
560
|
s1 = peg$FAILED;
|
|
520
561
|
}
|
|
521
562
|
if (s1 !== peg$FAILED) {
|
|
522
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
523
|
-
s2 = peg$
|
|
563
|
+
if (input.substr(peg$currPos, 2) === peg$c0) {
|
|
564
|
+
s2 = peg$c0;
|
|
524
565
|
peg$currPos += 2;
|
|
525
566
|
} else {
|
|
526
567
|
s2 = peg$FAILED;
|
|
527
568
|
if (peg$silentFails === 0) {
|
|
528
|
-
peg$fail(peg$
|
|
569
|
+
peg$fail(peg$e0);
|
|
529
570
|
}
|
|
530
571
|
}
|
|
531
572
|
if (s2 !== peg$FAILED) {
|
|
@@ -543,8 +584,7 @@ function peg$parse(input, options) {
|
|
|
543
584
|
s4 = peg$parsename();
|
|
544
585
|
if (s4 !== peg$FAILED) {
|
|
545
586
|
peg$savedPos = s0;
|
|
546
|
-
|
|
547
|
-
s0 = s1;
|
|
587
|
+
s0 = peg$f4(s4);
|
|
548
588
|
} else {
|
|
549
589
|
peg$currPos = s0;
|
|
550
590
|
s0 = peg$FAILED;
|
|
@@ -566,7 +606,7 @@ function peg$parse(input, options) {
|
|
|
566
606
|
}
|
|
567
607
|
|
|
568
608
|
function peg$parsename() {
|
|
569
|
-
|
|
609
|
+
let s0, s1, s2;
|
|
570
610
|
|
|
571
611
|
s0 = peg$currPos;
|
|
572
612
|
s1 = [];
|
|
@@ -581,7 +621,7 @@ function peg$parse(input, options) {
|
|
|
581
621
|
}
|
|
582
622
|
if (s1 !== peg$FAILED) {
|
|
583
623
|
peg$savedPos = s0;
|
|
584
|
-
s1 = peg$
|
|
624
|
+
s1 = peg$f5(s1);
|
|
585
625
|
}
|
|
586
626
|
s0 = s1;
|
|
587
627
|
|
|
@@ -589,15 +629,15 @@ function peg$parse(input, options) {
|
|
|
589
629
|
}
|
|
590
630
|
|
|
591
631
|
function peg$parsechar() {
|
|
592
|
-
|
|
632
|
+
let s0;
|
|
593
633
|
|
|
594
|
-
|
|
595
|
-
|
|
634
|
+
s0 = input.charAt(peg$currPos);
|
|
635
|
+
if (peg$r0.test(s0)) {
|
|
596
636
|
peg$currPos++;
|
|
597
637
|
} else {
|
|
598
638
|
s0 = peg$FAILED;
|
|
599
639
|
if (peg$silentFails === 0) {
|
|
600
|
-
peg$fail(peg$
|
|
640
|
+
peg$fail(peg$e1);
|
|
601
641
|
}
|
|
602
642
|
}
|
|
603
643
|
|
|
@@ -605,7 +645,7 @@ function peg$parse(input, options) {
|
|
|
605
645
|
}
|
|
606
646
|
|
|
607
647
|
function peg$parseargs() {
|
|
608
|
-
|
|
648
|
+
let s0, s1, s2, s3, s4, s5;
|
|
609
649
|
|
|
610
650
|
s0 = peg$currPos;
|
|
611
651
|
s1 = [];
|
|
@@ -614,56 +654,40 @@ function peg$parse(input, options) {
|
|
|
614
654
|
s1.push(s2);
|
|
615
655
|
s2 = peg$parsews();
|
|
616
656
|
}
|
|
617
|
-
if (
|
|
618
|
-
|
|
619
|
-
|
|
657
|
+
if (input.charCodeAt(peg$currPos) === 40) {
|
|
658
|
+
s2 = peg$c1;
|
|
659
|
+
peg$currPos++;
|
|
660
|
+
} else {
|
|
661
|
+
s2 = peg$FAILED;
|
|
662
|
+
if (peg$silentFails === 0) {
|
|
663
|
+
peg$fail(peg$e2);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
if (s2 !== peg$FAILED) {
|
|
667
|
+
s3 = [];
|
|
668
|
+
s4 = peg$parseargListItem();
|
|
669
|
+
while (s4 !== peg$FAILED) {
|
|
670
|
+
s3.push(s4);
|
|
671
|
+
s4 = peg$parseargListItem();
|
|
672
|
+
}
|
|
673
|
+
s4 = [];
|
|
674
|
+
s5 = peg$parsews();
|
|
675
|
+
while (s5 !== peg$FAILED) {
|
|
676
|
+
s4.push(s5);
|
|
677
|
+
s5 = peg$parsews();
|
|
678
|
+
}
|
|
679
|
+
if (input.charCodeAt(peg$currPos) === 41) {
|
|
680
|
+
s5 = peg$c2;
|
|
620
681
|
peg$currPos++;
|
|
621
682
|
} else {
|
|
622
|
-
|
|
683
|
+
s5 = peg$FAILED;
|
|
623
684
|
if (peg$silentFails === 0) {
|
|
624
|
-
peg$fail(peg$
|
|
685
|
+
peg$fail(peg$e3);
|
|
625
686
|
}
|
|
626
687
|
}
|
|
627
|
-
if (
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
while (s4 !== peg$FAILED) {
|
|
631
|
-
s3.push(s4);
|
|
632
|
-
s4 = peg$parseargListItem();
|
|
633
|
-
}
|
|
634
|
-
if (s3 !== peg$FAILED) {
|
|
635
|
-
s4 = [];
|
|
636
|
-
s5 = peg$parsews();
|
|
637
|
-
while (s5 !== peg$FAILED) {
|
|
638
|
-
s4.push(s5);
|
|
639
|
-
s5 = peg$parsews();
|
|
640
|
-
}
|
|
641
|
-
if (s4 !== peg$FAILED) {
|
|
642
|
-
if (input.charCodeAt(peg$currPos) === 41) {
|
|
643
|
-
s5 = peg$c12;
|
|
644
|
-
peg$currPos++;
|
|
645
|
-
} else {
|
|
646
|
-
s5 = peg$FAILED;
|
|
647
|
-
if (peg$silentFails === 0) {
|
|
648
|
-
peg$fail(peg$c13);
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
if (s5 !== peg$FAILED) {
|
|
652
|
-
peg$savedPos = s0;
|
|
653
|
-
s1 = peg$c14(s3);
|
|
654
|
-
s0 = s1;
|
|
655
|
-
} else {
|
|
656
|
-
peg$currPos = s0;
|
|
657
|
-
s0 = peg$FAILED;
|
|
658
|
-
}
|
|
659
|
-
} else {
|
|
660
|
-
peg$currPos = s0;
|
|
661
|
-
s0 = peg$FAILED;
|
|
662
|
-
}
|
|
663
|
-
} else {
|
|
664
|
-
peg$currPos = s0;
|
|
665
|
-
s0 = peg$FAILED;
|
|
666
|
-
}
|
|
688
|
+
if (s5 !== peg$FAILED) {
|
|
689
|
+
peg$savedPos = s0;
|
|
690
|
+
s0 = peg$f6(s3);
|
|
667
691
|
} else {
|
|
668
692
|
peg$currPos = s0;
|
|
669
693
|
s0 = peg$FAILED;
|
|
@@ -677,7 +701,7 @@ function peg$parse(input, options) {
|
|
|
677
701
|
}
|
|
678
702
|
|
|
679
703
|
function peg$parseargListItem() {
|
|
680
|
-
|
|
704
|
+
let s0, s1, s2, s3, s4;
|
|
681
705
|
|
|
682
706
|
s0 = peg$currPos;
|
|
683
707
|
s1 = [];
|
|
@@ -686,44 +710,28 @@ function peg$parse(input, options) {
|
|
|
686
710
|
s1.push(s2);
|
|
687
711
|
s2 = peg$parsews();
|
|
688
712
|
}
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
713
|
+
s2 = peg$parsename();
|
|
714
|
+
if (s2 !== peg$FAILED) {
|
|
715
|
+
s3 = [];
|
|
716
|
+
s4 = peg$parsews();
|
|
717
|
+
while (s4 !== peg$FAILED) {
|
|
718
|
+
s3.push(s4);
|
|
693
719
|
s4 = peg$parsews();
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
if (s3 !== peg$FAILED) {
|
|
699
|
-
if (input.charCodeAt(peg$currPos) === 44) {
|
|
700
|
-
s4 = peg$c15;
|
|
701
|
-
peg$currPos++;
|
|
702
|
-
} else {
|
|
703
|
-
s4 = peg$FAILED;
|
|
704
|
-
if (peg$silentFails === 0) {
|
|
705
|
-
peg$fail(peg$c16);
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
if (s4 === peg$FAILED) {
|
|
709
|
-
s4 = null;
|
|
710
|
-
}
|
|
711
|
-
if (s4 !== peg$FAILED) {
|
|
712
|
-
peg$savedPos = s0;
|
|
713
|
-
s1 = peg$c17(s2);
|
|
714
|
-
s0 = s1;
|
|
715
|
-
} else {
|
|
716
|
-
peg$currPos = s0;
|
|
717
|
-
s0 = peg$FAILED;
|
|
718
|
-
}
|
|
719
|
-
} else {
|
|
720
|
-
peg$currPos = s0;
|
|
721
|
-
s0 = peg$FAILED;
|
|
722
|
-
}
|
|
720
|
+
}
|
|
721
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
722
|
+
s4 = peg$c3;
|
|
723
|
+
peg$currPos++;
|
|
723
724
|
} else {
|
|
724
|
-
|
|
725
|
-
|
|
725
|
+
s4 = peg$FAILED;
|
|
726
|
+
if (peg$silentFails === 0) {
|
|
727
|
+
peg$fail(peg$e4);
|
|
728
|
+
}
|
|
726
729
|
}
|
|
730
|
+
if (s4 === peg$FAILED) {
|
|
731
|
+
s4 = null;
|
|
732
|
+
}
|
|
733
|
+
peg$savedPos = s0;
|
|
734
|
+
s0 = peg$f7(s2);
|
|
727
735
|
} else {
|
|
728
736
|
peg$currPos = s0;
|
|
729
737
|
s0 = peg$FAILED;
|
|
@@ -733,15 +741,15 @@ function peg$parse(input, options) {
|
|
|
733
741
|
}
|
|
734
742
|
|
|
735
743
|
function peg$parsews() {
|
|
736
|
-
|
|
744
|
+
let s0;
|
|
737
745
|
|
|
738
|
-
|
|
739
|
-
|
|
746
|
+
s0 = input.charAt(peg$currPos);
|
|
747
|
+
if (peg$r1.test(s0)) {
|
|
740
748
|
peg$currPos++;
|
|
741
749
|
} else {
|
|
742
750
|
s0 = peg$FAILED;
|
|
743
751
|
if (peg$silentFails === 0) {
|
|
744
|
-
peg$fail(peg$
|
|
752
|
+
peg$fail(peg$e5);
|
|
745
753
|
}
|
|
746
754
|
}
|
|
747
755
|
|
|
@@ -749,7 +757,7 @@ function peg$parse(input, options) {
|
|
|
749
757
|
}
|
|
750
758
|
|
|
751
759
|
function peg$parsesubListExpression() {
|
|
752
|
-
|
|
760
|
+
let s0, s1, s2, s3;
|
|
753
761
|
|
|
754
762
|
s0 = peg$currPos;
|
|
755
763
|
s1 = [];
|
|
@@ -758,26 +766,20 @@ function peg$parse(input, options) {
|
|
|
758
766
|
s1.push(s2);
|
|
759
767
|
s2 = peg$parsews();
|
|
760
768
|
}
|
|
761
|
-
if (
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
peg$fail(peg$c21);
|
|
769
|
-
}
|
|
769
|
+
if (input.charCodeAt(peg$currPos) === 46) {
|
|
770
|
+
s2 = peg$c4;
|
|
771
|
+
peg$currPos++;
|
|
772
|
+
} else {
|
|
773
|
+
s2 = peg$FAILED;
|
|
774
|
+
if (peg$silentFails === 0) {
|
|
775
|
+
peg$fail(peg$e6);
|
|
770
776
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
} else {
|
|
778
|
-
peg$currPos = s0;
|
|
779
|
-
s0 = peg$FAILED;
|
|
780
|
-
}
|
|
777
|
+
}
|
|
778
|
+
if (s2 !== peg$FAILED) {
|
|
779
|
+
s3 = peg$parselistExpression();
|
|
780
|
+
if (s3 !== peg$FAILED) {
|
|
781
|
+
peg$savedPos = s0;
|
|
782
|
+
s0 = peg$f8(s3);
|
|
781
783
|
} else {
|
|
782
784
|
peg$currPos = s0;
|
|
783
785
|
s0 = peg$FAILED;
|
|
@@ -791,7 +793,7 @@ function peg$parse(input, options) {
|
|
|
791
793
|
}
|
|
792
794
|
|
|
793
795
|
function peg$parselistExpression() {
|
|
794
|
-
|
|
796
|
+
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
795
797
|
|
|
796
798
|
s0 = peg$currPos;
|
|
797
799
|
s1 = [];
|
|
@@ -800,67 +802,46 @@ function peg$parse(input, options) {
|
|
|
800
802
|
s1.push(s2);
|
|
801
803
|
s2 = peg$parsews();
|
|
802
804
|
}
|
|
803
|
-
if (
|
|
804
|
-
|
|
805
|
-
|
|
805
|
+
if (input.charCodeAt(peg$currPos) === 91) {
|
|
806
|
+
s2 = peg$c5;
|
|
807
|
+
peg$currPos++;
|
|
808
|
+
} else {
|
|
809
|
+
s2 = peg$FAILED;
|
|
810
|
+
if (peg$silentFails === 0) {
|
|
811
|
+
peg$fail(peg$e7);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
if (s2 !== peg$FAILED) {
|
|
815
|
+
s3 = [];
|
|
816
|
+
s4 = peg$parselistExpressionItem();
|
|
817
|
+
while (s4 !== peg$FAILED) {
|
|
818
|
+
s3.push(s4);
|
|
819
|
+
s4 = peg$parselistExpressionItem();
|
|
820
|
+
}
|
|
821
|
+
s4 = [];
|
|
822
|
+
s5 = peg$parsews();
|
|
823
|
+
while (s5 !== peg$FAILED) {
|
|
824
|
+
s4.push(s5);
|
|
825
|
+
s5 = peg$parsews();
|
|
826
|
+
}
|
|
827
|
+
if (input.charCodeAt(peg$currPos) === 93) {
|
|
828
|
+
s5 = peg$c6;
|
|
806
829
|
peg$currPos++;
|
|
807
830
|
} else {
|
|
808
|
-
|
|
831
|
+
s5 = peg$FAILED;
|
|
809
832
|
if (peg$silentFails === 0) {
|
|
810
|
-
peg$fail(peg$
|
|
833
|
+
peg$fail(peg$e8);
|
|
811
834
|
}
|
|
812
835
|
}
|
|
813
|
-
if (
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
while (
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
}
|
|
820
|
-
if (s3 !== peg$FAILED) {
|
|
821
|
-
s4 = [];
|
|
822
|
-
s5 = peg$parsews();
|
|
823
|
-
while (s5 !== peg$FAILED) {
|
|
824
|
-
s4.push(s5);
|
|
825
|
-
s5 = peg$parsews();
|
|
826
|
-
}
|
|
827
|
-
if (s4 !== peg$FAILED) {
|
|
828
|
-
if (input.charCodeAt(peg$currPos) === 93) {
|
|
829
|
-
s5 = peg$c25;
|
|
830
|
-
peg$currPos++;
|
|
831
|
-
} else {
|
|
832
|
-
s5 = peg$FAILED;
|
|
833
|
-
if (peg$silentFails === 0) {
|
|
834
|
-
peg$fail(peg$c26);
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
if (s5 !== peg$FAILED) {
|
|
838
|
-
s6 = [];
|
|
839
|
-
s7 = peg$parsews();
|
|
840
|
-
while (s7 !== peg$FAILED) {
|
|
841
|
-
s6.push(s7);
|
|
842
|
-
s7 = peg$parsews();
|
|
843
|
-
}
|
|
844
|
-
if (s6 !== peg$FAILED) {
|
|
845
|
-
peg$savedPos = s0;
|
|
846
|
-
s1 = peg$c27(s3);
|
|
847
|
-
s0 = s1;
|
|
848
|
-
} else {
|
|
849
|
-
peg$currPos = s0;
|
|
850
|
-
s0 = peg$FAILED;
|
|
851
|
-
}
|
|
852
|
-
} else {
|
|
853
|
-
peg$currPos = s0;
|
|
854
|
-
s0 = peg$FAILED;
|
|
855
|
-
}
|
|
856
|
-
} else {
|
|
857
|
-
peg$currPos = s0;
|
|
858
|
-
s0 = peg$FAILED;
|
|
859
|
-
}
|
|
860
|
-
} else {
|
|
861
|
-
peg$currPos = s0;
|
|
862
|
-
s0 = peg$FAILED;
|
|
836
|
+
if (s5 !== peg$FAILED) {
|
|
837
|
+
s6 = [];
|
|
838
|
+
s7 = peg$parsews();
|
|
839
|
+
while (s7 !== peg$FAILED) {
|
|
840
|
+
s6.push(s7);
|
|
841
|
+
s7 = peg$parsews();
|
|
863
842
|
}
|
|
843
|
+
peg$savedPos = s0;
|
|
844
|
+
s0 = peg$f9(s3);
|
|
864
845
|
} else {
|
|
865
846
|
peg$currPos = s0;
|
|
866
847
|
s0 = peg$FAILED;
|
|
@@ -874,7 +855,7 @@ function peg$parse(input, options) {
|
|
|
874
855
|
}
|
|
875
856
|
|
|
876
857
|
function peg$parselistExpressionItem() {
|
|
877
|
-
|
|
858
|
+
let s0, s1, s2, s3, s4;
|
|
878
859
|
|
|
879
860
|
s0 = peg$currPos;
|
|
880
861
|
s1 = [];
|
|
@@ -883,44 +864,28 @@ function peg$parse(input, options) {
|
|
|
883
864
|
s1.push(s2);
|
|
884
865
|
s2 = peg$parsews();
|
|
885
866
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
867
|
+
s2 = peg$parseexpression();
|
|
868
|
+
if (s2 !== peg$FAILED) {
|
|
869
|
+
s3 = [];
|
|
870
|
+
s4 = peg$parsews();
|
|
871
|
+
while (s4 !== peg$FAILED) {
|
|
872
|
+
s3.push(s4);
|
|
890
873
|
s4 = peg$parsews();
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
if (s3 !== peg$FAILED) {
|
|
896
|
-
if (input.charCodeAt(peg$currPos) === 44) {
|
|
897
|
-
s4 = peg$c15;
|
|
898
|
-
peg$currPos++;
|
|
899
|
-
} else {
|
|
900
|
-
s4 = peg$FAILED;
|
|
901
|
-
if (peg$silentFails === 0) {
|
|
902
|
-
peg$fail(peg$c16);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
if (s4 === peg$FAILED) {
|
|
906
|
-
s4 = null;
|
|
907
|
-
}
|
|
908
|
-
if (s4 !== peg$FAILED) {
|
|
909
|
-
peg$savedPos = s0;
|
|
910
|
-
s1 = peg$c28(s2);
|
|
911
|
-
s0 = s1;
|
|
912
|
-
} else {
|
|
913
|
-
peg$currPos = s0;
|
|
914
|
-
s0 = peg$FAILED;
|
|
915
|
-
}
|
|
916
|
-
} else {
|
|
917
|
-
peg$currPos = s0;
|
|
918
|
-
s0 = peg$FAILED;
|
|
919
|
-
}
|
|
874
|
+
}
|
|
875
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
876
|
+
s4 = peg$c3;
|
|
877
|
+
peg$currPos++;
|
|
920
878
|
} else {
|
|
921
|
-
|
|
922
|
-
|
|
879
|
+
s4 = peg$FAILED;
|
|
880
|
+
if (peg$silentFails === 0) {
|
|
881
|
+
peg$fail(peg$e4);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (s4 === peg$FAILED) {
|
|
885
|
+
s4 = null;
|
|
923
886
|
}
|
|
887
|
+
peg$savedPos = s0;
|
|
888
|
+
s0 = peg$f10(s2);
|
|
924
889
|
} else {
|
|
925
890
|
peg$currPos = s0;
|
|
926
891
|
s0 = peg$FAILED;
|
|
@@ -930,7 +895,7 @@ function peg$parse(input, options) {
|
|
|
930
895
|
}
|
|
931
896
|
|
|
932
897
|
function peg$parsesubExpression() {
|
|
933
|
-
|
|
898
|
+
let s0, s1, s2, s3, s4, s5, s6;
|
|
934
899
|
|
|
935
900
|
s0 = peg$currPos;
|
|
936
901
|
s1 = [];
|
|
@@ -939,48 +904,32 @@ function peg$parse(input, options) {
|
|
|
939
904
|
s1.push(s2);
|
|
940
905
|
s2 = peg$parsews();
|
|
941
906
|
}
|
|
942
|
-
if (
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
peg$fail(peg$c21);
|
|
950
|
-
}
|
|
907
|
+
if (input.charCodeAt(peg$currPos) === 46) {
|
|
908
|
+
s2 = peg$c4;
|
|
909
|
+
peg$currPos++;
|
|
910
|
+
} else {
|
|
911
|
+
s2 = peg$FAILED;
|
|
912
|
+
if (peg$silentFails === 0) {
|
|
913
|
+
peg$fail(peg$e6);
|
|
951
914
|
}
|
|
952
|
-
|
|
953
|
-
|
|
915
|
+
}
|
|
916
|
+
if (s2 !== peg$FAILED) {
|
|
917
|
+
s3 = [];
|
|
918
|
+
s4 = peg$parsews();
|
|
919
|
+
while (s4 !== peg$FAILED) {
|
|
920
|
+
s3.push(s4);
|
|
954
921
|
s4 = peg$parsews();
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
s6 = peg$parsews();
|
|
964
|
-
while (s6 !== peg$FAILED) {
|
|
965
|
-
s5.push(s6);
|
|
966
|
-
s6 = peg$parsews();
|
|
967
|
-
}
|
|
968
|
-
if (s5 !== peg$FAILED) {
|
|
969
|
-
peg$savedPos = s0;
|
|
970
|
-
s1 = peg$c29(s4);
|
|
971
|
-
s0 = s1;
|
|
972
|
-
} else {
|
|
973
|
-
peg$currPos = s0;
|
|
974
|
-
s0 = peg$FAILED;
|
|
975
|
-
}
|
|
976
|
-
} else {
|
|
977
|
-
peg$currPos = s0;
|
|
978
|
-
s0 = peg$FAILED;
|
|
979
|
-
}
|
|
980
|
-
} else {
|
|
981
|
-
peg$currPos = s0;
|
|
982
|
-
s0 = peg$FAILED;
|
|
922
|
+
}
|
|
923
|
+
s4 = peg$parseexpression();
|
|
924
|
+
if (s4 !== peg$FAILED) {
|
|
925
|
+
s5 = [];
|
|
926
|
+
s6 = peg$parsews();
|
|
927
|
+
while (s6 !== peg$FAILED) {
|
|
928
|
+
s5.push(s6);
|
|
929
|
+
s6 = peg$parsews();
|
|
983
930
|
}
|
|
931
|
+
peg$savedPos = s0;
|
|
932
|
+
s0 = peg$f11(s4);
|
|
984
933
|
} else {
|
|
985
934
|
peg$currPos = s0;
|
|
986
935
|
s0 = peg$FAILED;
|
|
@@ -1019,24 +968,40 @@ function peg$parse(input, options) {
|
|
|
1019
968
|
|
|
1020
969
|
peg$result = peg$startRuleFunction();
|
|
1021
970
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
} else {
|
|
971
|
+
const peg$success = peg$result !== peg$FAILED && peg$currPos === input.length;
|
|
972
|
+
function peg$throw() {
|
|
1025
973
|
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
1026
974
|
peg$fail(peg$endExpectation());
|
|
1027
975
|
}
|
|
1028
976
|
|
|
1029
977
|
throw peg$buildStructuredError(
|
|
1030
978
|
peg$maxFailExpected,
|
|
1031
|
-
peg$maxFailPos < input.length ?
|
|
979
|
+
peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
|
|
1032
980
|
peg$maxFailPos < input.length
|
|
1033
981
|
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
|
1034
982
|
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos),
|
|
1035
983
|
);
|
|
1036
984
|
}
|
|
985
|
+
if (options.peg$library) {
|
|
986
|
+
return /** @type {any} */ ({
|
|
987
|
+
peg$result,
|
|
988
|
+
peg$currPos,
|
|
989
|
+
peg$FAILED,
|
|
990
|
+
peg$maxFailExpected,
|
|
991
|
+
peg$maxFailPos,
|
|
992
|
+
peg$success,
|
|
993
|
+
peg$throw: peg$success ? undefined : peg$throw,
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
if (peg$success) {
|
|
997
|
+
return peg$result;
|
|
998
|
+
} else {
|
|
999
|
+
peg$throw();
|
|
1000
|
+
}
|
|
1037
1001
|
}
|
|
1038
1002
|
|
|
1039
1003
|
module.exports = {
|
|
1004
|
+
StartRules: ['start'],
|
|
1040
1005
|
SyntaxError: peg$SyntaxError,
|
|
1041
1006
|
parse: peg$parse,
|
|
1042
1007
|
};
|