objection 3.5.0 → 3.7.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/model/AjvValidator.js +33 -10
- package/lib/model/modelClone.js +0 -2
- package/lib/queryBuilder/InternalOptions.js +2 -0
- package/lib/queryBuilder/QueryBuilder.js +56 -10
- package/lib/queryBuilder/RelationExpression.js +6 -4
- package/lib/queryBuilder/graph/GraphOptions.js +141 -22
- package/lib/queryBuilder/graph/GraphUpsert.js +57 -0
- package/lib/queryBuilder/graph/insert/GraphInsert.js +2 -0
- package/lib/queryBuilder/graph/patch/GraphPatchAction.js +3 -0
- package/lib/queryBuilder/operations/InstanceUpdateOperation.js +6 -1
- package/lib/queryBuilder/operations/UpdateOperation.js +11 -0
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeMsSqlOperation.js +3 -1
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeSqliteOperation.js +4 -9
- package/lib/queryBuilder/parsers/jsonFieldExpressionParser.js +434 -364
- package/lib/queryBuilder/parsers/relationExpressionParser.js +513 -548
- package/lib/queryBuilder/parsers/relationExpressionParser.pegjs +1 -1
- package/lib/queryBuilder/transformations/WrapMysqlModifySubqueryTransformation.js +4 -7
- package/lib/relations/Relation.js +7 -0
- package/lib/relations/RelationFindOperation.js +27 -40
- package/lib/relations/belongsToOne/BelongsToOneDeleteOperation.js +4 -2
- package/lib/relations/belongsToOne/BelongsToOneRelation.js +9 -0
- package/lib/relations/manyToMany/ManyToManyModifyMixin.js +41 -13
- package/lib/relations/manyToMany/ManyToManyMySqlModifyMixin.js +31 -42
- package/lib/relations/manyToMany/ManyToManyRelation.js +15 -18
- package/lib/relations/manyToMany/ManyToManySqliteModifyMixin.js +0 -13
- package/lib/relations/manyToMany/find/ManyToManyFindOperation.js +2 -3
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateMySqlOperation.js +1 -5
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperation.js +1 -5
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperationBase.js +9 -0
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateSqliteOperation.js +1 -5
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperationBase.js +28 -2
- package/lib/utils/identifierMapping.js +8 -17
- package/lib/utils/objectUtils.js +109 -2
- package/lib/utils/parseFieldExpression.js +10 -3
- package/package.json +5 -2
- package/typings/objection/index.d.ts +56 -36
- package/lib/relations/manyToMany/ManyToManyPostgresModifyMixin.js +0 -27
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelatePostgresOperation.js +0 -16
- package/lib/relations/manyToMany/update/ManyToManyUpdatePostgresOperation.js +0 -12
- package/lib/utils/clone.js +0 -2329
|
@@ -1,213 +1,266 @@
|
|
|
1
|
-
|
|
1
|
+
// @generated by Peggy 5.1.0.
|
|
2
|
+
//
|
|
3
|
+
// https://peggyjs.org/
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
* Generated by PEG.js 0.10.0.
|
|
5
|
-
*
|
|
6
|
-
* http://pegjs.org/
|
|
7
|
-
*/
|
|
5
|
+
'use strict';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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;
|
|
12
55
|
}
|
|
13
|
-
ctor.prototype = parent.prototype;
|
|
14
|
-
child.prototype = new ctor();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function peg$SyntaxError(message, expected, found, location) {
|
|
18
|
-
this.message = message;
|
|
19
|
-
this.expected = expected;
|
|
20
|
-
this.found = found;
|
|
21
|
-
this.location = location;
|
|
22
|
-
this.name = 'SyntaxError';
|
|
23
56
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
57
|
+
static buildMessage(expected, found) {
|
|
58
|
+
function hex(ch) {
|
|
59
|
+
return ch.codePointAt(0).toString(16).toUpperCase();
|
|
60
|
+
}
|
|
28
61
|
|
|
29
|
-
|
|
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) + '}');
|
|
68
|
+
}
|
|
69
|
+
return s;
|
|
70
|
+
}
|
|
71
|
+
|
|
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
|
+
}
|
|
85
|
+
|
|
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
|
+
}
|
|
101
|
+
|
|
102
|
+
const DESCRIBE_EXPECTATION_FNS = {
|
|
103
|
+
literal(expectation) {
|
|
104
|
+
return '"' + literalEscape(expectation.text) + '"';
|
|
105
|
+
},
|
|
30
106
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
);
|
|
36
113
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
114
|
+
return (
|
|
115
|
+
'[' +
|
|
116
|
+
(expectation.inverted ? '^' : '') +
|
|
117
|
+
escapedParts.join('') +
|
|
118
|
+
']' +
|
|
119
|
+
(expectation.unicode ? 'u' : '')
|
|
120
|
+
);
|
|
121
|
+
},
|
|
40
122
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
? classEscape(expectation.parts[i][0]) + '-' + classEscape(expectation.parts[i][1])
|
|
45
|
-
: classEscape(expectation.parts[i]);
|
|
46
|
-
}
|
|
123
|
+
any() {
|
|
124
|
+
return 'any character';
|
|
125
|
+
},
|
|
47
126
|
|
|
48
|
-
|
|
49
|
-
|
|
127
|
+
end() {
|
|
128
|
+
return 'end of input';
|
|
129
|
+
},
|
|
50
130
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
131
|
+
other(expectation) {
|
|
132
|
+
return expectation.description;
|
|
133
|
+
},
|
|
134
|
+
};
|
|
54
135
|
|
|
55
|
-
|
|
56
|
-
return
|
|
57
|
-
}
|
|
136
|
+
function describeExpectation(expectation) {
|
|
137
|
+
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
138
|
+
}
|
|
58
139
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
140
|
+
function describeExpected(expected) {
|
|
141
|
+
const descriptions = expected.map(describeExpectation);
|
|
142
|
+
descriptions.sort();
|
|
63
143
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.replace(/"/g, '\\"')
|
|
72
|
-
.replace(/\0/g, '\\0')
|
|
73
|
-
.replace(/\t/g, '\\t')
|
|
74
|
-
.replace(/\n/g, '\\n')
|
|
75
|
-
.replace(/\r/g, '\\r')
|
|
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
|
-
}
|
|
83
|
-
|
|
84
|
-
function classEscape(s) {
|
|
85
|
-
return s
|
|
86
|
-
.replace(/\\/g, '\\\\')
|
|
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
|
-
}
|
|
101
|
-
|
|
102
|
-
function describeExpectation(expectation) {
|
|
103
|
-
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function describeExpected(expected) {
|
|
107
|
-
var descriptions = new Array(expected.length),
|
|
108
|
-
i,
|
|
109
|
-
j;
|
|
110
|
-
|
|
111
|
-
for (i = 0; i < expected.length; i++) {
|
|
112
|
-
descriptions[i] = describeExpectation(expected[i]);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
descriptions.sort();
|
|
116
|
-
|
|
117
|
-
if (descriptions.length > 0) {
|
|
118
|
-
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
119
|
-
if (descriptions[i - 1] !== descriptions[i]) {
|
|
120
|
-
descriptions[j] = descriptions[i];
|
|
121
|
-
j++;
|
|
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 !==
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
178
|
+
options = options !== undefined ? options : {};
|
|
179
|
+
|
|
180
|
+
const peg$FAILED = {};
|
|
181
|
+
const peg$source = options.grammarSource;
|
|
182
|
+
|
|
183
|
+
const peg$startRuleFunctions = {
|
|
184
|
+
start: peg$parsestart,
|
|
185
|
+
};
|
|
186
|
+
let peg$startRuleFunction = peg$parsestart;
|
|
187
|
+
|
|
188
|
+
const peg$c0 = ':';
|
|
189
|
+
const peg$c1 = '[';
|
|
190
|
+
const peg$c2 = '"';
|
|
191
|
+
const peg$c3 = ']';
|
|
192
|
+
const peg$c4 = "'";
|
|
193
|
+
const peg$c5 = '.';
|
|
194
|
+
|
|
195
|
+
const peg$r0 = /^[^\][]/;
|
|
196
|
+
const peg$r1 = /^[^:]/;
|
|
197
|
+
const peg$r2 = /^[^"]/;
|
|
198
|
+
const peg$r3 = /^[^']/;
|
|
199
|
+
const peg$r4 = /^[^.\][]/;
|
|
200
|
+
const peg$r5 = /^[0-9]/;
|
|
201
|
+
|
|
202
|
+
const peg$e0 = peg$literalExpectation(':', false);
|
|
203
|
+
const peg$e1 = peg$literalExpectation('[', false);
|
|
204
|
+
const peg$e2 = peg$literalExpectation('"', false);
|
|
205
|
+
const peg$e3 = peg$literalExpectation(']', false);
|
|
206
|
+
const peg$e4 = peg$literalExpectation("'", false);
|
|
207
|
+
const peg$e5 = peg$literalExpectation('.', false);
|
|
208
|
+
const peg$e6 = peg$classExpectation([']', '['], true, false, false);
|
|
209
|
+
const peg$e7 = peg$classExpectation([':'], true, false, false);
|
|
210
|
+
const peg$e8 = peg$classExpectation(['"'], true, false, false);
|
|
211
|
+
const peg$e9 = peg$classExpectation(["'"], true, false, false);
|
|
212
|
+
const peg$e10 = peg$classExpectation(['.', ']', '['], true, false, false);
|
|
213
|
+
const peg$e11 = peg$classExpectation([['0', '9']], false, false, false);
|
|
214
|
+
|
|
215
|
+
function peg$f0(column, refs) {
|
|
216
|
+
var access = [];
|
|
217
|
+
if (refs) {
|
|
218
|
+
var firstAccess = refs[1];
|
|
219
|
+
access = refs[2];
|
|
220
|
+
access.unshift(firstAccess);
|
|
221
|
+
}
|
|
222
|
+
return { columnName: column, access: access };
|
|
223
|
+
}
|
|
224
|
+
function peg$f1(key) {
|
|
225
|
+
return { type: 'object', ref: Array.isArray(key) ? key[1] : key };
|
|
226
|
+
}
|
|
227
|
+
function peg$f2(index) {
|
|
228
|
+
return { type: 'array', ref: parseInt(index, 10) };
|
|
229
|
+
}
|
|
230
|
+
function peg$f3(key) {
|
|
231
|
+
return { type: 'object', ref: key };
|
|
232
|
+
}
|
|
233
|
+
function peg$f4(key) {
|
|
234
|
+
return { type: 'object', ref: key };
|
|
235
|
+
}
|
|
236
|
+
function peg$f5(chars) {
|
|
237
|
+
return chars.join('');
|
|
238
|
+
}
|
|
239
|
+
function peg$f6(chars) {
|
|
240
|
+
return chars.join('');
|
|
241
|
+
}
|
|
242
|
+
function peg$f7(chars) {
|
|
243
|
+
return chars.join('');
|
|
244
|
+
}
|
|
245
|
+
function peg$f8(chars) {
|
|
246
|
+
return chars.join('');
|
|
247
|
+
}
|
|
248
|
+
function peg$f9(chars) {
|
|
249
|
+
return chars.join('');
|
|
250
|
+
}
|
|
251
|
+
function peg$f10(digits) {
|
|
252
|
+
return digits.join('');
|
|
253
|
+
}
|
|
254
|
+
let peg$currPos = options.peg$currPos | 0;
|
|
255
|
+
let peg$savedPos = peg$currPos;
|
|
256
|
+
const peg$posDetailsCache = [{ line: 1, column: 1 }];
|
|
257
|
+
let peg$maxFailPos = peg$currPos;
|
|
258
|
+
let peg$maxFailExpected = options.peg$maxFailExpected || [];
|
|
259
|
+
let peg$silentFails = options.peg$silentFails | 0;
|
|
260
|
+
|
|
261
|
+
let peg$result;
|
|
262
|
+
|
|
263
|
+
if (options.startRule) {
|
|
211
264
|
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
212
265
|
throw new Error('Can\'t start parsing from rule "' + options.startRule + '".');
|
|
213
266
|
}
|
|
@@ -219,12 +272,24 @@ function peg$parse(input, options) {
|
|
|
219
272
|
return input.substring(peg$savedPos, peg$currPos);
|
|
220
273
|
}
|
|
221
274
|
|
|
275
|
+
function offset() {
|
|
276
|
+
return peg$savedPos;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function range() {
|
|
280
|
+
return {
|
|
281
|
+
source: peg$source,
|
|
282
|
+
start: peg$savedPos,
|
|
283
|
+
end: peg$currPos,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
222
287
|
function location() {
|
|
223
288
|
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
224
289
|
}
|
|
225
290
|
|
|
226
291
|
function expected(description, location) {
|
|
227
|
-
location = location !==
|
|
292
|
+
location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
228
293
|
|
|
229
294
|
throw peg$buildStructuredError(
|
|
230
295
|
[peg$otherExpectation(description)],
|
|
@@ -234,17 +299,25 @@ function peg$parse(input, options) {
|
|
|
234
299
|
}
|
|
235
300
|
|
|
236
301
|
function error(message, location) {
|
|
237
|
-
location = location !==
|
|
302
|
+
location = location !== undefined ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
238
303
|
|
|
239
304
|
throw peg$buildSimpleError(message, location);
|
|
240
305
|
}
|
|
241
306
|
|
|
307
|
+
function peg$getUnicode(pos = peg$currPos) {
|
|
308
|
+
const cp = input.codePointAt(pos);
|
|
309
|
+
if (cp === undefined) {
|
|
310
|
+
return '';
|
|
311
|
+
}
|
|
312
|
+
return String.fromCodePoint(cp);
|
|
313
|
+
}
|
|
314
|
+
|
|
242
315
|
function peg$literalExpectation(text, ignoreCase) {
|
|
243
|
-
return { type: 'literal', text
|
|
316
|
+
return { type: 'literal', text, ignoreCase };
|
|
244
317
|
}
|
|
245
318
|
|
|
246
|
-
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
247
|
-
return { type: 'class', parts
|
|
319
|
+
function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
|
|
320
|
+
return { type: 'class', parts, inverted, ignoreCase, unicode };
|
|
248
321
|
}
|
|
249
322
|
|
|
250
323
|
function peg$anyExpectation() {
|
|
@@ -256,19 +329,21 @@ function peg$parse(input, options) {
|
|
|
256
329
|
}
|
|
257
330
|
|
|
258
331
|
function peg$otherExpectation(description) {
|
|
259
|
-
return { type: 'other', description
|
|
332
|
+
return { type: 'other', description };
|
|
260
333
|
}
|
|
261
334
|
|
|
262
335
|
function peg$computePosDetails(pos) {
|
|
263
|
-
|
|
264
|
-
|
|
336
|
+
let details = peg$posDetailsCache[pos];
|
|
337
|
+
let p;
|
|
265
338
|
|
|
266
339
|
if (details) {
|
|
267
340
|
return details;
|
|
268
341
|
} else {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
342
|
+
if (pos >= peg$posDetailsCache.length) {
|
|
343
|
+
p = peg$posDetailsCache.length - 1;
|
|
344
|
+
} else {
|
|
345
|
+
p = pos;
|
|
346
|
+
while (!peg$posDetailsCache[--p]) {}
|
|
272
347
|
}
|
|
273
348
|
|
|
274
349
|
details = peg$posDetailsCache[p];
|
|
@@ -289,15 +364,17 @@ function peg$parse(input, options) {
|
|
|
289
364
|
}
|
|
290
365
|
|
|
291
366
|
peg$posDetailsCache[pos] = details;
|
|
367
|
+
|
|
292
368
|
return details;
|
|
293
369
|
}
|
|
294
370
|
}
|
|
295
371
|
|
|
296
|
-
function peg$computeLocation(startPos, endPos) {
|
|
297
|
-
|
|
298
|
-
|
|
372
|
+
function peg$computeLocation(startPos, endPos, offset) {
|
|
373
|
+
const startPosDetails = peg$computePosDetails(startPos);
|
|
374
|
+
const endPosDetails = peg$computePosDetails(endPos);
|
|
299
375
|
|
|
300
|
-
|
|
376
|
+
const res = {
|
|
377
|
+
source: peg$source,
|
|
301
378
|
start: {
|
|
302
379
|
offset: startPos,
|
|
303
380
|
line: startPosDetails.line,
|
|
@@ -309,6 +386,11 @@ function peg$parse(input, options) {
|
|
|
309
386
|
column: endPosDetails.column,
|
|
310
387
|
},
|
|
311
388
|
};
|
|
389
|
+
if (offset && peg$source && typeof peg$source.offset === 'function') {
|
|
390
|
+
res.start = peg$source.offset(res.start);
|
|
391
|
+
res.end = peg$source.offset(res.end);
|
|
392
|
+
}
|
|
393
|
+
return res;
|
|
312
394
|
}
|
|
313
395
|
|
|
314
396
|
function peg$fail(expected) {
|
|
@@ -338,7 +420,7 @@ function peg$parse(input, options) {
|
|
|
338
420
|
}
|
|
339
421
|
|
|
340
422
|
function peg$parsestart() {
|
|
341
|
-
|
|
423
|
+
let s0, s1, s2, s3, s4, s5, s6;
|
|
342
424
|
|
|
343
425
|
s0 = peg$currPos;
|
|
344
426
|
s1 = peg$parsestringWithoutColon();
|
|
@@ -350,7 +432,7 @@ function peg$parse(input, options) {
|
|
|
350
432
|
} else {
|
|
351
433
|
s3 = peg$FAILED;
|
|
352
434
|
if (peg$silentFails === 0) {
|
|
353
|
-
peg$fail(peg$
|
|
435
|
+
peg$fail(peg$e0);
|
|
354
436
|
}
|
|
355
437
|
}
|
|
356
438
|
if (s3 !== peg$FAILED) {
|
|
@@ -380,13 +462,8 @@ function peg$parse(input, options) {
|
|
|
380
462
|
}
|
|
381
463
|
}
|
|
382
464
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
s2 = s3;
|
|
386
|
-
} else {
|
|
387
|
-
peg$currPos = s2;
|
|
388
|
-
s2 = peg$FAILED;
|
|
389
|
-
}
|
|
465
|
+
s3 = [s3, s4, s5];
|
|
466
|
+
s2 = s3;
|
|
390
467
|
} else {
|
|
391
468
|
peg$currPos = s2;
|
|
392
469
|
s2 = peg$FAILED;
|
|
@@ -398,14 +475,8 @@ function peg$parse(input, options) {
|
|
|
398
475
|
if (s2 === peg$FAILED) {
|
|
399
476
|
s2 = null;
|
|
400
477
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
s1 = peg$c2(s1, s2);
|
|
404
|
-
s0 = s1;
|
|
405
|
-
} else {
|
|
406
|
-
peg$currPos = s0;
|
|
407
|
-
s0 = peg$FAILED;
|
|
408
|
-
}
|
|
478
|
+
peg$savedPos = s0;
|
|
479
|
+
s0 = peg$f0(s1, s2);
|
|
409
480
|
} else {
|
|
410
481
|
peg$currPos = s0;
|
|
411
482
|
s0 = peg$FAILED;
|
|
@@ -415,67 +486,62 @@ function peg$parse(input, options) {
|
|
|
415
486
|
}
|
|
416
487
|
|
|
417
488
|
function peg$parsebracketStringRef() {
|
|
418
|
-
|
|
489
|
+
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
419
490
|
|
|
420
491
|
s0 = peg$currPos;
|
|
421
492
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
422
|
-
s1 = peg$
|
|
493
|
+
s1 = peg$c1;
|
|
423
494
|
peg$currPos++;
|
|
424
495
|
} else {
|
|
425
496
|
s1 = peg$FAILED;
|
|
426
497
|
if (peg$silentFails === 0) {
|
|
427
|
-
peg$fail(peg$
|
|
498
|
+
peg$fail(peg$e1);
|
|
428
499
|
}
|
|
429
500
|
}
|
|
430
501
|
if (s1 !== peg$FAILED) {
|
|
431
502
|
s2 = peg$currPos;
|
|
432
503
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
433
|
-
s3 = peg$
|
|
504
|
+
s3 = peg$c2;
|
|
434
505
|
peg$currPos++;
|
|
435
506
|
} else {
|
|
436
507
|
s3 = peg$FAILED;
|
|
437
508
|
if (peg$silentFails === 0) {
|
|
438
|
-
peg$fail(peg$
|
|
509
|
+
peg$fail(peg$e2);
|
|
439
510
|
}
|
|
440
511
|
}
|
|
441
512
|
if (s3 !== peg$FAILED) {
|
|
442
513
|
s4 = peg$parsestringWithoutDoubleQuotes();
|
|
443
|
-
if (
|
|
444
|
-
|
|
445
|
-
|
|
514
|
+
if (input.charCodeAt(peg$currPos) === 34) {
|
|
515
|
+
s5 = peg$c2;
|
|
516
|
+
peg$currPos++;
|
|
517
|
+
} else {
|
|
518
|
+
s5 = peg$FAILED;
|
|
519
|
+
if (peg$silentFails === 0) {
|
|
520
|
+
peg$fail(peg$e2);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
if (s5 !== peg$FAILED) {
|
|
524
|
+
s6 = peg$currPos;
|
|
525
|
+
peg$silentFails++;
|
|
526
|
+
if (input.charCodeAt(peg$currPos) === 93) {
|
|
527
|
+
s7 = peg$c3;
|
|
446
528
|
peg$currPos++;
|
|
447
529
|
} else {
|
|
448
|
-
|
|
530
|
+
s7 = peg$FAILED;
|
|
449
531
|
if (peg$silentFails === 0) {
|
|
450
|
-
peg$fail(peg$
|
|
532
|
+
peg$fail(peg$e3);
|
|
451
533
|
}
|
|
452
534
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
peg$
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
peg$silentFails--;
|
|
466
|
-
if (s7 !== peg$FAILED) {
|
|
467
|
-
peg$currPos = s6;
|
|
468
|
-
s6 = void 0;
|
|
469
|
-
} else {
|
|
470
|
-
s6 = peg$FAILED;
|
|
471
|
-
}
|
|
472
|
-
if (s6 !== peg$FAILED) {
|
|
473
|
-
s3 = [s3, s4, s5, s6];
|
|
474
|
-
s2 = s3;
|
|
475
|
-
} else {
|
|
476
|
-
peg$currPos = s2;
|
|
477
|
-
s2 = peg$FAILED;
|
|
478
|
-
}
|
|
535
|
+
peg$silentFails--;
|
|
536
|
+
if (s7 !== peg$FAILED) {
|
|
537
|
+
peg$currPos = s6;
|
|
538
|
+
s6 = undefined;
|
|
539
|
+
} else {
|
|
540
|
+
s6 = peg$FAILED;
|
|
541
|
+
}
|
|
542
|
+
if (s6 !== peg$FAILED) {
|
|
543
|
+
s3 = [s3, s4, s5, s6];
|
|
544
|
+
s2 = s3;
|
|
479
545
|
} else {
|
|
480
546
|
peg$currPos = s2;
|
|
481
547
|
s2 = peg$FAILED;
|
|
@@ -491,52 +557,47 @@ function peg$parse(input, options) {
|
|
|
491
557
|
if (s2 === peg$FAILED) {
|
|
492
558
|
s2 = peg$currPos;
|
|
493
559
|
if (input.charCodeAt(peg$currPos) === 39) {
|
|
494
|
-
s3 = peg$
|
|
560
|
+
s3 = peg$c4;
|
|
495
561
|
peg$currPos++;
|
|
496
562
|
} else {
|
|
497
563
|
s3 = peg$FAILED;
|
|
498
564
|
if (peg$silentFails === 0) {
|
|
499
|
-
peg$fail(peg$
|
|
565
|
+
peg$fail(peg$e4);
|
|
500
566
|
}
|
|
501
567
|
}
|
|
502
568
|
if (s3 !== peg$FAILED) {
|
|
503
569
|
s4 = peg$parsestringWithoutSingleQuotes();
|
|
504
|
-
if (
|
|
505
|
-
|
|
506
|
-
|
|
570
|
+
if (input.charCodeAt(peg$currPos) === 39) {
|
|
571
|
+
s5 = peg$c4;
|
|
572
|
+
peg$currPos++;
|
|
573
|
+
} else {
|
|
574
|
+
s5 = peg$FAILED;
|
|
575
|
+
if (peg$silentFails === 0) {
|
|
576
|
+
peg$fail(peg$e4);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
if (s5 !== peg$FAILED) {
|
|
580
|
+
s6 = peg$currPos;
|
|
581
|
+
peg$silentFails++;
|
|
582
|
+
if (input.charCodeAt(peg$currPos) === 93) {
|
|
583
|
+
s7 = peg$c3;
|
|
507
584
|
peg$currPos++;
|
|
508
585
|
} else {
|
|
509
|
-
|
|
586
|
+
s7 = peg$FAILED;
|
|
510
587
|
if (peg$silentFails === 0) {
|
|
511
|
-
peg$fail(peg$
|
|
588
|
+
peg$fail(peg$e3);
|
|
512
589
|
}
|
|
513
590
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
peg$
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
peg$silentFails--;
|
|
527
|
-
if (s7 !== peg$FAILED) {
|
|
528
|
-
peg$currPos = s6;
|
|
529
|
-
s6 = void 0;
|
|
530
|
-
} else {
|
|
531
|
-
s6 = peg$FAILED;
|
|
532
|
-
}
|
|
533
|
-
if (s6 !== peg$FAILED) {
|
|
534
|
-
s3 = [s3, s4, s5, s6];
|
|
535
|
-
s2 = s3;
|
|
536
|
-
} else {
|
|
537
|
-
peg$currPos = s2;
|
|
538
|
-
s2 = peg$FAILED;
|
|
539
|
-
}
|
|
591
|
+
peg$silentFails--;
|
|
592
|
+
if (s7 !== peg$FAILED) {
|
|
593
|
+
peg$currPos = s6;
|
|
594
|
+
s6 = undefined;
|
|
595
|
+
} else {
|
|
596
|
+
s6 = peg$FAILED;
|
|
597
|
+
}
|
|
598
|
+
if (s6 !== peg$FAILED) {
|
|
599
|
+
s3 = [s3, s4, s5, s6];
|
|
600
|
+
s2 = s3;
|
|
540
601
|
} else {
|
|
541
602
|
peg$currPos = s2;
|
|
542
603
|
s2 = peg$FAILED;
|
|
@@ -555,18 +616,17 @@ function peg$parse(input, options) {
|
|
|
555
616
|
}
|
|
556
617
|
if (s2 !== peg$FAILED) {
|
|
557
618
|
if (input.charCodeAt(peg$currPos) === 93) {
|
|
558
|
-
s3 = peg$
|
|
619
|
+
s3 = peg$c3;
|
|
559
620
|
peg$currPos++;
|
|
560
621
|
} else {
|
|
561
622
|
s3 = peg$FAILED;
|
|
562
623
|
if (peg$silentFails === 0) {
|
|
563
|
-
peg$fail(peg$
|
|
624
|
+
peg$fail(peg$e3);
|
|
564
625
|
}
|
|
565
626
|
}
|
|
566
627
|
if (s3 !== peg$FAILED) {
|
|
567
628
|
peg$savedPos = s0;
|
|
568
|
-
|
|
569
|
-
s0 = s1;
|
|
629
|
+
s0 = peg$f1(s2);
|
|
570
630
|
} else {
|
|
571
631
|
peg$currPos = s0;
|
|
572
632
|
s0 = peg$FAILED;
|
|
@@ -584,34 +644,33 @@ function peg$parse(input, options) {
|
|
|
584
644
|
}
|
|
585
645
|
|
|
586
646
|
function peg$parsebracketIndexRef() {
|
|
587
|
-
|
|
647
|
+
let s0, s1, s2, s3;
|
|
588
648
|
|
|
589
649
|
s0 = peg$currPos;
|
|
590
650
|
if (input.charCodeAt(peg$currPos) === 91) {
|
|
591
|
-
s1 = peg$
|
|
651
|
+
s1 = peg$c1;
|
|
592
652
|
peg$currPos++;
|
|
593
653
|
} else {
|
|
594
654
|
s1 = peg$FAILED;
|
|
595
655
|
if (peg$silentFails === 0) {
|
|
596
|
-
peg$fail(peg$
|
|
656
|
+
peg$fail(peg$e1);
|
|
597
657
|
}
|
|
598
658
|
}
|
|
599
659
|
if (s1 !== peg$FAILED) {
|
|
600
660
|
s2 = peg$parseinteger();
|
|
601
661
|
if (s2 !== peg$FAILED) {
|
|
602
662
|
if (input.charCodeAt(peg$currPos) === 93) {
|
|
603
|
-
s3 = peg$
|
|
663
|
+
s3 = peg$c3;
|
|
604
664
|
peg$currPos++;
|
|
605
665
|
} else {
|
|
606
666
|
s3 = peg$FAILED;
|
|
607
667
|
if (peg$silentFails === 0) {
|
|
608
|
-
peg$fail(peg$
|
|
668
|
+
peg$fail(peg$e3);
|
|
609
669
|
}
|
|
610
670
|
}
|
|
611
671
|
if (s3 !== peg$FAILED) {
|
|
612
672
|
peg$savedPos = s0;
|
|
613
|
-
|
|
614
|
-
s0 = s1;
|
|
673
|
+
s0 = peg$f2(s2);
|
|
615
674
|
} else {
|
|
616
675
|
peg$currPos = s0;
|
|
617
676
|
s0 = peg$FAILED;
|
|
@@ -629,13 +688,13 @@ function peg$parse(input, options) {
|
|
|
629
688
|
}
|
|
630
689
|
|
|
631
690
|
function peg$parsecolonReference() {
|
|
632
|
-
|
|
691
|
+
let s0, s1;
|
|
633
692
|
|
|
634
693
|
s0 = peg$currPos;
|
|
635
694
|
s1 = peg$parsestringWithoutSquareBracketsOrDots();
|
|
636
695
|
if (s1 !== peg$FAILED) {
|
|
637
696
|
peg$savedPos = s0;
|
|
638
|
-
s1 = peg$
|
|
697
|
+
s1 = peg$f3(s1);
|
|
639
698
|
}
|
|
640
699
|
s0 = s1;
|
|
641
700
|
|
|
@@ -643,24 +702,23 @@ function peg$parse(input, options) {
|
|
|
643
702
|
}
|
|
644
703
|
|
|
645
704
|
function peg$parsedotReference() {
|
|
646
|
-
|
|
705
|
+
let s0, s1, s2;
|
|
647
706
|
|
|
648
707
|
s0 = peg$currPos;
|
|
649
708
|
if (input.charCodeAt(peg$currPos) === 46) {
|
|
650
|
-
s1 = peg$
|
|
709
|
+
s1 = peg$c5;
|
|
651
710
|
peg$currPos++;
|
|
652
711
|
} else {
|
|
653
712
|
s1 = peg$FAILED;
|
|
654
713
|
if (peg$silentFails === 0) {
|
|
655
|
-
peg$fail(peg$
|
|
714
|
+
peg$fail(peg$e5);
|
|
656
715
|
}
|
|
657
716
|
}
|
|
658
717
|
if (s1 !== peg$FAILED) {
|
|
659
718
|
s2 = peg$parsestringWithoutSquareBracketsOrDots();
|
|
660
719
|
if (s2 !== peg$FAILED) {
|
|
661
720
|
peg$savedPos = s0;
|
|
662
|
-
|
|
663
|
-
s0 = s1;
|
|
721
|
+
s0 = peg$f4(s2);
|
|
664
722
|
} else {
|
|
665
723
|
peg$currPos = s0;
|
|
666
724
|
s0 = peg$FAILED;
|
|
@@ -674,29 +732,29 @@ function peg$parse(input, options) {
|
|
|
674
732
|
}
|
|
675
733
|
|
|
676
734
|
function peg$parsestringWithoutSquareBrackets() {
|
|
677
|
-
|
|
735
|
+
let s0, s1, s2;
|
|
678
736
|
|
|
679
737
|
s0 = peg$currPos;
|
|
680
738
|
s1 = [];
|
|
681
|
-
|
|
682
|
-
|
|
739
|
+
s2 = input.charAt(peg$currPos);
|
|
740
|
+
if (peg$r0.test(s2)) {
|
|
683
741
|
peg$currPos++;
|
|
684
742
|
} else {
|
|
685
743
|
s2 = peg$FAILED;
|
|
686
744
|
if (peg$silentFails === 0) {
|
|
687
|
-
peg$fail(peg$
|
|
745
|
+
peg$fail(peg$e6);
|
|
688
746
|
}
|
|
689
747
|
}
|
|
690
748
|
if (s2 !== peg$FAILED) {
|
|
691
749
|
while (s2 !== peg$FAILED) {
|
|
692
750
|
s1.push(s2);
|
|
693
|
-
|
|
694
|
-
|
|
751
|
+
s2 = input.charAt(peg$currPos);
|
|
752
|
+
if (peg$r0.test(s2)) {
|
|
695
753
|
peg$currPos++;
|
|
696
754
|
} else {
|
|
697
755
|
s2 = peg$FAILED;
|
|
698
756
|
if (peg$silentFails === 0) {
|
|
699
|
-
peg$fail(peg$
|
|
757
|
+
peg$fail(peg$e6);
|
|
700
758
|
}
|
|
701
759
|
}
|
|
702
760
|
}
|
|
@@ -705,7 +763,7 @@ function peg$parse(input, options) {
|
|
|
705
763
|
}
|
|
706
764
|
if (s1 !== peg$FAILED) {
|
|
707
765
|
peg$savedPos = s0;
|
|
708
|
-
s1 = peg$
|
|
766
|
+
s1 = peg$f5(s1);
|
|
709
767
|
}
|
|
710
768
|
s0 = s1;
|
|
711
769
|
|
|
@@ -713,29 +771,29 @@ function peg$parse(input, options) {
|
|
|
713
771
|
}
|
|
714
772
|
|
|
715
773
|
function peg$parsestringWithoutColon() {
|
|
716
|
-
|
|
774
|
+
let s0, s1, s2;
|
|
717
775
|
|
|
718
776
|
s0 = peg$currPos;
|
|
719
777
|
s1 = [];
|
|
720
|
-
|
|
721
|
-
|
|
778
|
+
s2 = input.charAt(peg$currPos);
|
|
779
|
+
if (peg$r1.test(s2)) {
|
|
722
780
|
peg$currPos++;
|
|
723
781
|
} else {
|
|
724
782
|
s2 = peg$FAILED;
|
|
725
783
|
if (peg$silentFails === 0) {
|
|
726
|
-
peg$fail(peg$
|
|
784
|
+
peg$fail(peg$e7);
|
|
727
785
|
}
|
|
728
786
|
}
|
|
729
787
|
if (s2 !== peg$FAILED) {
|
|
730
788
|
while (s2 !== peg$FAILED) {
|
|
731
789
|
s1.push(s2);
|
|
732
|
-
|
|
733
|
-
|
|
790
|
+
s2 = input.charAt(peg$currPos);
|
|
791
|
+
if (peg$r1.test(s2)) {
|
|
734
792
|
peg$currPos++;
|
|
735
793
|
} else {
|
|
736
794
|
s2 = peg$FAILED;
|
|
737
795
|
if (peg$silentFails === 0) {
|
|
738
|
-
peg$fail(peg$
|
|
796
|
+
peg$fail(peg$e7);
|
|
739
797
|
}
|
|
740
798
|
}
|
|
741
799
|
}
|
|
@@ -744,7 +802,7 @@ function peg$parse(input, options) {
|
|
|
744
802
|
}
|
|
745
803
|
if (s1 !== peg$FAILED) {
|
|
746
804
|
peg$savedPos = s0;
|
|
747
|
-
s1 = peg$
|
|
805
|
+
s1 = peg$f6(s1);
|
|
748
806
|
}
|
|
749
807
|
s0 = s1;
|
|
750
808
|
|
|
@@ -752,99 +810,95 @@ function peg$parse(input, options) {
|
|
|
752
810
|
}
|
|
753
811
|
|
|
754
812
|
function peg$parsestringWithoutDoubleQuotes() {
|
|
755
|
-
|
|
813
|
+
let s0, s1, s2;
|
|
756
814
|
|
|
757
815
|
s0 = peg$currPos;
|
|
758
816
|
s1 = [];
|
|
759
|
-
|
|
760
|
-
|
|
817
|
+
s2 = input.charAt(peg$currPos);
|
|
818
|
+
if (peg$r2.test(s2)) {
|
|
761
819
|
peg$currPos++;
|
|
762
820
|
} else {
|
|
763
821
|
s2 = peg$FAILED;
|
|
764
822
|
if (peg$silentFails === 0) {
|
|
765
|
-
peg$fail(peg$
|
|
823
|
+
peg$fail(peg$e8);
|
|
766
824
|
}
|
|
767
825
|
}
|
|
768
826
|
while (s2 !== peg$FAILED) {
|
|
769
827
|
s1.push(s2);
|
|
770
|
-
|
|
771
|
-
|
|
828
|
+
s2 = input.charAt(peg$currPos);
|
|
829
|
+
if (peg$r2.test(s2)) {
|
|
772
830
|
peg$currPos++;
|
|
773
831
|
} else {
|
|
774
832
|
s2 = peg$FAILED;
|
|
775
833
|
if (peg$silentFails === 0) {
|
|
776
|
-
peg$fail(peg$
|
|
834
|
+
peg$fail(peg$e8);
|
|
777
835
|
}
|
|
778
836
|
}
|
|
779
837
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
s1 = peg$c18(s1);
|
|
783
|
-
}
|
|
838
|
+
peg$savedPos = s0;
|
|
839
|
+
s1 = peg$f7(s1);
|
|
784
840
|
s0 = s1;
|
|
785
841
|
|
|
786
842
|
return s0;
|
|
787
843
|
}
|
|
788
844
|
|
|
789
845
|
function peg$parsestringWithoutSingleQuotes() {
|
|
790
|
-
|
|
846
|
+
let s0, s1, s2;
|
|
791
847
|
|
|
792
848
|
s0 = peg$currPos;
|
|
793
849
|
s1 = [];
|
|
794
|
-
|
|
795
|
-
|
|
850
|
+
s2 = input.charAt(peg$currPos);
|
|
851
|
+
if (peg$r3.test(s2)) {
|
|
796
852
|
peg$currPos++;
|
|
797
853
|
} else {
|
|
798
854
|
s2 = peg$FAILED;
|
|
799
855
|
if (peg$silentFails === 0) {
|
|
800
|
-
peg$fail(peg$
|
|
856
|
+
peg$fail(peg$e9);
|
|
801
857
|
}
|
|
802
858
|
}
|
|
803
859
|
while (s2 !== peg$FAILED) {
|
|
804
860
|
s1.push(s2);
|
|
805
|
-
|
|
806
|
-
|
|
861
|
+
s2 = input.charAt(peg$currPos);
|
|
862
|
+
if (peg$r3.test(s2)) {
|
|
807
863
|
peg$currPos++;
|
|
808
864
|
} else {
|
|
809
865
|
s2 = peg$FAILED;
|
|
810
866
|
if (peg$silentFails === 0) {
|
|
811
|
-
peg$fail(peg$
|
|
867
|
+
peg$fail(peg$e9);
|
|
812
868
|
}
|
|
813
869
|
}
|
|
814
870
|
}
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
s1 = peg$c18(s1);
|
|
818
|
-
}
|
|
871
|
+
peg$savedPos = s0;
|
|
872
|
+
s1 = peg$f8(s1);
|
|
819
873
|
s0 = s1;
|
|
820
874
|
|
|
821
875
|
return s0;
|
|
822
876
|
}
|
|
823
877
|
|
|
824
878
|
function peg$parsestringWithoutSquareBracketsOrDots() {
|
|
825
|
-
|
|
879
|
+
let s0, s1, s2;
|
|
826
880
|
|
|
827
881
|
s0 = peg$currPos;
|
|
828
882
|
s1 = [];
|
|
829
|
-
|
|
830
|
-
|
|
883
|
+
s2 = input.charAt(peg$currPos);
|
|
884
|
+
if (peg$r4.test(s2)) {
|
|
831
885
|
peg$currPos++;
|
|
832
886
|
} else {
|
|
833
887
|
s2 = peg$FAILED;
|
|
834
888
|
if (peg$silentFails === 0) {
|
|
835
|
-
peg$fail(peg$
|
|
889
|
+
peg$fail(peg$e10);
|
|
836
890
|
}
|
|
837
891
|
}
|
|
838
892
|
if (s2 !== peg$FAILED) {
|
|
839
893
|
while (s2 !== peg$FAILED) {
|
|
840
894
|
s1.push(s2);
|
|
841
|
-
|
|
842
|
-
|
|
895
|
+
s2 = input.charAt(peg$currPos);
|
|
896
|
+
if (peg$r4.test(s2)) {
|
|
843
897
|
peg$currPos++;
|
|
844
898
|
} else {
|
|
845
899
|
s2 = peg$FAILED;
|
|
846
900
|
if (peg$silentFails === 0) {
|
|
847
|
-
peg$fail(peg$
|
|
901
|
+
peg$fail(peg$e10);
|
|
848
902
|
}
|
|
849
903
|
}
|
|
850
904
|
}
|
|
@@ -853,7 +907,7 @@ function peg$parse(input, options) {
|
|
|
853
907
|
}
|
|
854
908
|
if (s1 !== peg$FAILED) {
|
|
855
909
|
peg$savedPos = s0;
|
|
856
|
-
s1 = peg$
|
|
910
|
+
s1 = peg$f9(s1);
|
|
857
911
|
}
|
|
858
912
|
s0 = s1;
|
|
859
913
|
|
|
@@ -861,29 +915,29 @@ function peg$parse(input, options) {
|
|
|
861
915
|
}
|
|
862
916
|
|
|
863
917
|
function peg$parseinteger() {
|
|
864
|
-
|
|
918
|
+
let s0, s1, s2;
|
|
865
919
|
|
|
866
920
|
s0 = peg$currPos;
|
|
867
921
|
s1 = [];
|
|
868
|
-
|
|
869
|
-
|
|
922
|
+
s2 = input.charAt(peg$currPos);
|
|
923
|
+
if (peg$r5.test(s2)) {
|
|
870
924
|
peg$currPos++;
|
|
871
925
|
} else {
|
|
872
926
|
s2 = peg$FAILED;
|
|
873
927
|
if (peg$silentFails === 0) {
|
|
874
|
-
peg$fail(peg$
|
|
928
|
+
peg$fail(peg$e11);
|
|
875
929
|
}
|
|
876
930
|
}
|
|
877
931
|
if (s2 !== peg$FAILED) {
|
|
878
932
|
while (s2 !== peg$FAILED) {
|
|
879
933
|
s1.push(s2);
|
|
880
|
-
|
|
881
|
-
|
|
934
|
+
s2 = input.charAt(peg$currPos);
|
|
935
|
+
if (peg$r5.test(s2)) {
|
|
882
936
|
peg$currPos++;
|
|
883
937
|
} else {
|
|
884
938
|
s2 = peg$FAILED;
|
|
885
939
|
if (peg$silentFails === 0) {
|
|
886
|
-
peg$fail(peg$
|
|
940
|
+
peg$fail(peg$e11);
|
|
887
941
|
}
|
|
888
942
|
}
|
|
889
943
|
}
|
|
@@ -892,7 +946,7 @@ function peg$parse(input, options) {
|
|
|
892
946
|
}
|
|
893
947
|
if (s1 !== peg$FAILED) {
|
|
894
948
|
peg$savedPos = s0;
|
|
895
|
-
s1 = peg$
|
|
949
|
+
s1 = peg$f10(s1);
|
|
896
950
|
}
|
|
897
951
|
s0 = s1;
|
|
898
952
|
|
|
@@ -901,24 +955,40 @@ function peg$parse(input, options) {
|
|
|
901
955
|
|
|
902
956
|
peg$result = peg$startRuleFunction();
|
|
903
957
|
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
} else {
|
|
958
|
+
const peg$success = peg$result !== peg$FAILED && peg$currPos === input.length;
|
|
959
|
+
function peg$throw() {
|
|
907
960
|
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
908
961
|
peg$fail(peg$endExpectation());
|
|
909
962
|
}
|
|
910
963
|
|
|
911
964
|
throw peg$buildStructuredError(
|
|
912
965
|
peg$maxFailExpected,
|
|
913
|
-
peg$maxFailPos < input.length ?
|
|
966
|
+
peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
|
|
914
967
|
peg$maxFailPos < input.length
|
|
915
968
|
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
|
916
969
|
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos),
|
|
917
970
|
);
|
|
918
971
|
}
|
|
972
|
+
if (options.peg$library) {
|
|
973
|
+
return /** @type {any} */ ({
|
|
974
|
+
peg$result,
|
|
975
|
+
peg$currPos,
|
|
976
|
+
peg$FAILED,
|
|
977
|
+
peg$maxFailExpected,
|
|
978
|
+
peg$maxFailPos,
|
|
979
|
+
peg$success,
|
|
980
|
+
peg$throw: peg$success ? undefined : peg$throw,
|
|
981
|
+
});
|
|
982
|
+
}
|
|
983
|
+
if (peg$success) {
|
|
984
|
+
return peg$result;
|
|
985
|
+
} else {
|
|
986
|
+
peg$throw();
|
|
987
|
+
}
|
|
919
988
|
}
|
|
920
989
|
|
|
921
990
|
module.exports = {
|
|
991
|
+
StartRules: ['start'],
|
|
922
992
|
SyntaxError: peg$SyntaxError,
|
|
923
993
|
parse: peg$parse,
|
|
924
994
|
};
|