@abedmurrar/objection 4.0.0-alpha.0 → 4.0.0-beta.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 +103 -67
- package/lib/index.mjs +6 -0
- package/lib/initialize.js +6 -9
- package/lib/model/AjvValidator.js +235 -282
- package/lib/model/Model.js +653 -823
- package/lib/model/ModifierNotFoundError.js +5 -7
- package/lib/model/NotFoundError.js +14 -18
- package/lib/model/RelationDoesNotExistError.js +6 -9
- package/lib/model/ValidationError.js +33 -41
- package/lib/model/Validator.js +15 -21
- package/lib/model/getModel.js +1 -3
- package/lib/model/graph/ModelGraph.js +44 -64
- package/lib/model/graph/ModelGraphBuilder.js +164 -217
- package/lib/model/graph/ModelGraphEdge.js +31 -43
- package/lib/model/graph/ModelGraphNode.js +192 -231
- package/lib/model/inheritModel.js +9 -18
- package/lib/model/modelBindKnex.js +48 -62
- package/lib/model/modelClone.js +79 -98
- package/lib/model/modelColPropMap.js +16 -26
- package/lib/model/modelConcurrency.js +24 -0
- package/lib/model/modelId.js +44 -49
- package/lib/model/modelJsonAttributes.js +56 -76
- package/lib/model/modelParseRelations.js +68 -67
- package/lib/model/modelQueryProps.js +76 -107
- package/lib/model/modelSet.js +92 -112
- package/lib/model/modelTableMetadata.js +60 -72
- package/lib/model/modelToJson.js +120 -150
- package/lib/model/modelUtils.js +30 -37
- package/lib/model/modelValidate.js +34 -42
- package/lib/model/modelValues.js +78 -91
- package/lib/model/modelVisitor.js +22 -29
- package/lib/objection.js +42 -67
- package/lib/queryBuilder/FunctionBuilder.js +231 -279
- package/lib/queryBuilder/InternalOptions.js +19 -24
- package/lib/queryBuilder/JoinBuilder.js +116 -149
- package/lib/queryBuilder/QueryBuilder.js +1009 -1271
- package/lib/queryBuilder/QueryBuilderBase.js +647 -865
- package/lib/queryBuilder/QueryBuilderContext.js +14 -21
- package/lib/queryBuilder/QueryBuilderContextBase.js +20 -29
- package/lib/queryBuilder/QueryBuilderOperationSupport.js +462 -536
- package/lib/queryBuilder/QueryBuilderUserContext.js +19 -25
- package/lib/queryBuilder/RawBuilder.js +58 -73
- package/lib/queryBuilder/ReferenceBuilder.js +232 -270
- package/lib/queryBuilder/RelationExpression.js +322 -380
- package/lib/queryBuilder/StaticHookArguments.js +94 -106
- package/lib/queryBuilder/ValueBuilder.js +100 -112
- package/lib/queryBuilder/expressions.js +86 -116
- package/lib/queryBuilder/functions/mysql.js +642 -697
- package/lib/queryBuilder/graph/GraphAction.js +44 -59
- package/lib/queryBuilder/graph/GraphData.js +7 -9
- package/lib/queryBuilder/graph/GraphFetcher.js +115 -151
- package/lib/queryBuilder/graph/GraphNodeDbExistence.js +114 -152
- package/lib/queryBuilder/graph/GraphOperation.js +16 -22
- package/lib/queryBuilder/graph/GraphOptions.js +143 -185
- package/lib/queryBuilder/graph/GraphUpsert.js +167 -241
- package/lib/queryBuilder/graph/delete/GraphDelete.js +8 -13
- package/lib/queryBuilder/graph/delete/GraphDeleteAction.js +44 -62
- package/lib/queryBuilder/graph/insert/GraphInsert.js +99 -128
- package/lib/queryBuilder/graph/insert/GraphInsertAction.js +151 -193
- package/lib/queryBuilder/graph/insert/JoinRowGraphInsertAction.js +57 -79
- package/lib/queryBuilder/graph/patch/GraphPatch.js +8 -13
- package/lib/queryBuilder/graph/patch/GraphPatchAction.js +181 -234
- package/lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsert.js +16 -21
- package/lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsertAction.js +80 -110
- package/lib/queryBuilder/join/JoinResultColumn.js +14 -18
- package/lib/queryBuilder/join/JoinResultParser.js +88 -101
- package/lib/queryBuilder/join/RelationJoiner.js +205 -288
- package/lib/queryBuilder/join/TableNode.js +117 -144
- package/lib/queryBuilder/join/TableTree.js +60 -76
- package/lib/queryBuilder/join/utils.js +10 -16
- package/lib/queryBuilder/operations/DelegateOperation.js +93 -133
- package/lib/queryBuilder/operations/DeleteOperation.js +33 -37
- package/lib/queryBuilder/operations/FindByIdOperation.js +20 -28
- package/lib/queryBuilder/operations/FindByIdsOperation.js +17 -23
- package/lib/queryBuilder/operations/FindOperation.js +114 -131
- package/lib/queryBuilder/operations/FirstOperation.js +14 -19
- package/lib/queryBuilder/operations/FromOperation.js +69 -88
- package/lib/queryBuilder/operations/InsertAndFetchOperation.js +28 -39
- package/lib/queryBuilder/operations/InsertGraphAndFetchOperation.js +25 -35
- package/lib/queryBuilder/operations/InsertGraphOperation.js +77 -98
- package/lib/queryBuilder/operations/InsertOperation.js +132 -165
- package/lib/queryBuilder/operations/InstanceDeleteOperation.js +27 -36
- package/lib/queryBuilder/operations/InstanceFindOperation.js +9 -13
- package/lib/queryBuilder/operations/InstanceInsertOperation.js +13 -17
- package/lib/queryBuilder/operations/InstanceUpdateOperation.js +32 -46
- package/lib/queryBuilder/operations/JoinRelatedOperation.js +66 -86
- package/lib/queryBuilder/operations/KnexOperation.js +4 -7
- package/lib/queryBuilder/operations/MergeOperation.js +32 -45
- package/lib/queryBuilder/operations/ObjectionToKnexConvertingOperation.js +131 -150
- package/lib/queryBuilder/operations/OnBuildKnexOperation.js +17 -23
- package/lib/queryBuilder/operations/OnBuildOperation.js +17 -23
- package/lib/queryBuilder/operations/OnErrorOperation.js +17 -23
- package/lib/queryBuilder/operations/QueryBuilderOperation.js +231 -270
- package/lib/queryBuilder/operations/RangeOperation.js +30 -40
- package/lib/queryBuilder/operations/RelateOperation.js +14 -21
- package/lib/queryBuilder/operations/ReturningOperation.js +12 -18
- package/lib/queryBuilder/operations/RunAfterOperation.js +17 -23
- package/lib/queryBuilder/operations/RunBeforeOperation.js +17 -23
- package/lib/queryBuilder/operations/UnrelateOperation.js +12 -17
- package/lib/queryBuilder/operations/UpdateAndFetchOperation.js +48 -65
- package/lib/queryBuilder/operations/UpdateOperation.js +104 -129
- package/lib/queryBuilder/operations/UpsertGraphAndFetchOperation.js +25 -35
- package/lib/queryBuilder/operations/UpsertGraphOperation.js +36 -55
- package/lib/queryBuilder/operations/WhereCompositeOperation.js +30 -39
- package/lib/queryBuilder/operations/WhereInOperation.js +34 -36
- package/lib/queryBuilder/operations/eager/EagerOperation.js +37 -52
- package/lib/queryBuilder/operations/eager/JoinEagerOperation.js +34 -44
- package/lib/queryBuilder/operations/eager/NaiveEagerOperation.js +4 -7
- package/lib/queryBuilder/operations/eager/WhereInEagerOperation.js +193 -251
- package/lib/queryBuilder/operations/jsonApi/WhereJsonHasOperation.js +18 -25
- package/lib/queryBuilder/operations/jsonApi/WhereJsonNotObjectOperation.js +25 -41
- package/lib/queryBuilder/operations/jsonApi/WhereJsonOperation.js +19 -20
- package/lib/queryBuilder/operations/jsonApi/WhereJsonOverlapsOperation.js +23 -21
- package/lib/queryBuilder/operations/jsonApi/mysqlJsonApi.js +106 -118
- package/lib/queryBuilder/operations/jsonApi/postgresJsonApi.js +79 -108
- package/lib/queryBuilder/operations/select/SelectOperation.js +37 -53
- package/lib/queryBuilder/operations/select/Selection.js +94 -105
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeMsSqlOperation.js +68 -101
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeOperation.js +65 -75
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeSqliteOperation.js +75 -84
- package/lib/queryBuilder/parsers/jsonFieldExpressionParser.js +760 -859
- package/lib/queryBuilder/parsers/relationExpressionParser.js +840 -952
- package/lib/queryBuilder/transformations/CompositeQueryTransformation.js +10 -15
- package/lib/queryBuilder/transformations/QueryTransformation.js +4 -6
- package/lib/queryBuilder/transformations/WrapMysqlModifySubqueryTransformation.js +35 -49
- package/lib/queryBuilder/transformations/index.js +3 -9
- package/lib/queryBuilder/whereScopes.js +158 -186
- package/lib/relations/Relation.js +279 -363
- package/lib/relations/RelationDeleteOperation.js +16 -22
- package/lib/relations/RelationFindOperation.js +100 -133
- package/lib/relations/RelationInsertOperation.js +19 -27
- package/lib/relations/RelationOwner.js +167 -204
- package/lib/relations/RelationProperty.js +177 -217
- package/lib/relations/RelationUpdateOperation.js +16 -23
- package/lib/relations/belongsToOne/BelongsToOneDeleteOperation.js +11 -16
- package/lib/relations/belongsToOne/BelongsToOneInsertOperation.js +24 -35
- package/lib/relations/belongsToOne/BelongsToOneRelateOperation.js +30 -41
- package/lib/relations/belongsToOne/BelongsToOneRelation.js +33 -41
- package/lib/relations/belongsToOne/BelongsToOneUnrelateOperation.js +38 -53
- package/lib/relations/hasMany/HasManyInsertOperation.js +35 -51
- package/lib/relations/hasMany/HasManyRelateOperation.js +38 -54
- package/lib/relations/hasMany/HasManyRelation.js +30 -38
- package/lib/relations/hasMany/HasManyUnrelateOperation.js +19 -26
- package/lib/relations/hasOne/HasOneRelation.js +4 -7
- package/lib/relations/hasOneThrough/HasOneThroughRelation.js +4 -7
- package/lib/relations/manyToMany/ManyToManyModifyMixin.js +67 -90
- package/lib/relations/manyToMany/ManyToManyRelation.js +349 -451
- package/lib/relations/manyToMany/ManyToManySqliteModifyMixin.js +19 -26
- package/lib/relations/manyToMany/delete/ManyToManyDeleteOperation.js +3 -5
- package/lib/relations/manyToMany/delete/ManyToManyDeleteOperationBase.js +14 -20
- package/lib/relations/manyToMany/delete/ManyToManyDeleteSqliteOperation.js +3 -7
- package/lib/relations/manyToMany/find/ManyToManyFindOperation.js +71 -94
- package/lib/relations/manyToMany/insert/ManyToManyInsertOperation.js +31 -43
- package/lib/relations/manyToMany/relate/ManyToManyRelateOperation.js +50 -67
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperation.js +4 -7
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperationBase.js +20 -27
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateSqliteOperation.js +5 -10
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperation.js +3 -5
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperationBase.js +55 -72
- package/lib/relations/manyToMany/update/ManyToManyUpdateSqliteOperation.js +3 -7
- package/lib/transaction.js +53 -83
- package/lib/utils/assert.js +15 -21
- package/lib/utils/buildUtils.js +17 -19
- package/lib/utils/classUtils.js +7 -11
- package/lib/utils/cloneDeep.js +365 -0
- package/lib/utils/createModifier.js +36 -41
- package/lib/utils/deprecate.js +8 -12
- package/lib/utils/identifierMapping.js +153 -192
- package/lib/utils/internalPropUtils.js +4 -8
- package/lib/utils/knexUtils.js +61 -56
- package/lib/utils/mixin.js +16 -23
- package/lib/utils/mysqlJsonPath.js +55 -40
- package/lib/utils/normalizeIds.js +110 -127
- package/lib/utils/objectUtils.js +236 -338
- package/lib/utils/parseFieldExpression.js +66 -44
- package/lib/utils/postgresJsonPath.js +48 -62
- package/lib/utils/promiseUtils/after.js +10 -13
- package/lib/utils/promiseUtils/afterReturn.js +10 -13
- package/lib/utils/promiseUtils/index.js +15 -17
- package/lib/utils/promiseUtils/isPromise.js +6 -9
- package/lib/utils/promiseUtils/map.js +75 -89
- package/lib/utils/promiseUtils/mapAfterAllReturn.js +17 -23
- package/lib/utils/promiseUtils/try.js +15 -18
- package/lib/utils/resolveModel.js +91 -94
- package/lib/utils/tmpColumnUtils.js +4 -13
- package/package.json +50 -23
- package/typings/objection/index.d.mts +362 -0
- package/typings/objection/index.d.ts +36 -9
- package/lib/.eslintrc.json +0 -8
- package/lib/queryBuilder/parsers/jsonFieldExpressionParser.pegjs +0 -97
- package/lib/queryBuilder/parsers/relationExpressionParser.pegjs +0 -141
- package/lib/utils/clone.js +0 -2329
|
@@ -3,1040 +3,928 @@
|
|
|
3
3
|
*
|
|
4
4
|
* http://pegjs.org/
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
6
|
'use strict';
|
|
8
|
-
|
|
9
7
|
function peg$subclass(child, parent) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
function ctor() {
|
|
9
|
+
this.constructor = child;
|
|
10
|
+
}
|
|
11
|
+
ctor.prototype = parent.prototype;
|
|
12
|
+
child.prototype = new ctor();
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
function peg$SyntaxError(message, expected, found, location) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
15
|
+
this.message = message;
|
|
16
|
+
this.expected = expected;
|
|
17
|
+
this.found = found;
|
|
18
|
+
this.location = location;
|
|
19
|
+
this.name = 'SyntaxError';
|
|
20
|
+
if (typeof Error.captureStackTrace === 'function') {
|
|
21
|
+
Error.captureStackTrace(this, peg$SyntaxError);
|
|
22
|
+
}
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
peg$subclass(peg$SyntaxError, Error);
|
|
30
|
-
|
|
31
25
|
peg$SyntaxError.buildMessage = function (expected, found) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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]);
|
|
26
|
+
var DESCRIBE_EXPECTATION_FNS = {
|
|
27
|
+
literal: function (expectation) {
|
|
28
|
+
return '"' + literalEscape(expectation.text) + '"';
|
|
29
|
+
},
|
|
30
|
+
class: function (expectation) {
|
|
31
|
+
var escapedParts = '', i;
|
|
32
|
+
for (i = 0; i < expectation.parts.length; i++) {
|
|
33
|
+
escapedParts +=
|
|
34
|
+
expectation.parts[i] instanceof Array
|
|
35
|
+
? classEscape(expectation.parts[i][0]) + '-' + classEscape(expectation.parts[i][1])
|
|
36
|
+
: classEscape(expectation.parts[i]);
|
|
37
|
+
}
|
|
38
|
+
return '[' + (expectation.inverted ? '^' : '') + escapedParts + ']';
|
|
39
|
+
},
|
|
40
|
+
any: function (expectation) {
|
|
41
|
+
return 'any character';
|
|
42
|
+
},
|
|
43
|
+
end: function (expectation) {
|
|
44
|
+
return 'end of input';
|
|
45
|
+
},
|
|
46
|
+
other: function (expectation) {
|
|
47
|
+
return expectation.description;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
function hex(ch) {
|
|
51
|
+
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
52
|
+
}
|
|
53
|
+
function literalEscape(s) {
|
|
54
|
+
return s
|
|
55
|
+
.replace(/\\/g, '\\\\')
|
|
56
|
+
.replace(/"/g, '\\"')
|
|
57
|
+
.replace(/\0/g, '\\0')
|
|
58
|
+
.replace(/\t/g, '\\t')
|
|
59
|
+
.replace(/\n/g, '\\n')
|
|
60
|
+
.replace(/\r/g, '\\r')
|
|
61
|
+
.replace(/[\x00-\x0F]/g, function (ch) {
|
|
62
|
+
return '\\x0' + hex(ch);
|
|
63
|
+
})
|
|
64
|
+
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
|
|
65
|
+
return '\\x' + hex(ch);
|
|
66
|
+
});
|
|
113
67
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
68
|
+
function classEscape(s) {
|
|
69
|
+
return s
|
|
70
|
+
.replace(/\\/g, '\\\\')
|
|
71
|
+
.replace(/\]/g, '\\]')
|
|
72
|
+
.replace(/\^/g, '\\^')
|
|
73
|
+
.replace(/-/g, '\\-')
|
|
74
|
+
.replace(/\0/g, '\\0')
|
|
75
|
+
.replace(/\t/g, '\\t')
|
|
76
|
+
.replace(/\n/g, '\\n')
|
|
77
|
+
.replace(/\r/g, '\\r')
|
|
78
|
+
.replace(/[\x00-\x0F]/g, function (ch) {
|
|
79
|
+
return '\\x0' + hex(ch);
|
|
80
|
+
})
|
|
81
|
+
.replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) {
|
|
82
|
+
return '\\x' + hex(ch);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function describeExpectation(expectation) {
|
|
86
|
+
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
87
|
+
}
|
|
88
|
+
function describeExpected(expected) {
|
|
89
|
+
var descriptions = new Array(expected.length), i, j;
|
|
90
|
+
for (i = 0; i < expected.length; i++) {
|
|
91
|
+
descriptions[i] = describeExpectation(expected[i]);
|
|
92
|
+
}
|
|
93
|
+
descriptions.sort();
|
|
94
|
+
if (descriptions.length > 0) {
|
|
95
|
+
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
96
|
+
if (descriptions[i - 1] !== descriptions[i]) {
|
|
97
|
+
descriptions[j] = descriptions[i];
|
|
98
|
+
j++;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
descriptions.length = j;
|
|
102
|
+
}
|
|
103
|
+
switch (descriptions.length) {
|
|
104
|
+
case 1:
|
|
105
|
+
return descriptions[0];
|
|
106
|
+
case 2:
|
|
107
|
+
return descriptions[0] + ' or ' + descriptions[1];
|
|
108
|
+
default:
|
|
109
|
+
return (descriptions.slice(0, -1).join(', ') + ', or ' + descriptions[descriptions.length - 1]);
|
|
122
110
|
}
|
|
123
|
-
}
|
|
124
|
-
descriptions.length = j;
|
|
125
111
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
case 1:
|
|
129
|
-
return descriptions[0];
|
|
130
|
-
|
|
131
|
-
case 2:
|
|
132
|
-
return descriptions[0] + ' or ' + descriptions[1];
|
|
133
|
-
|
|
134
|
-
default:
|
|
135
|
-
return (
|
|
136
|
-
descriptions.slice(0, -1).join(', ') + ', or ' + descriptions[descriptions.length - 1]
|
|
137
|
-
);
|
|
112
|
+
function describeFound(found) {
|
|
113
|
+
return found ? '"' + literalEscape(found) + '"' : 'end of input';
|
|
138
114
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
function describeFound(found) {
|
|
142
|
-
return found ? '"' + literalEscape(found) + '"' : 'end of input';
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return 'Expected ' + describeExpected(expected) + ' but ' + describeFound(found) + ' found.';
|
|
115
|
+
return 'Expected ' + describeExpected(expected) + ' but ' + describeFound(found) + ' found.';
|
|
146
116
|
};
|
|
147
|
-
|
|
148
117
|
function peg$parse(input, options) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
peg$c0 = function (expr) {
|
|
155
|
-
const node = newNode();
|
|
156
|
-
|
|
157
|
-
if (expr.$name === '*') {
|
|
158
|
-
node.$allRecursive = true;
|
|
159
|
-
} else {
|
|
160
|
-
assertDuplicateRelation(node, expr);
|
|
161
|
-
node[expr.$name] = expr;
|
|
162
|
-
node.$childNames.push(expr.$name);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
return node;
|
|
166
|
-
},
|
|
167
|
-
peg$c1 = function (list) {
|
|
168
|
-
const node = newNode();
|
|
169
|
-
|
|
170
|
-
list.forEach((expr) => {
|
|
171
|
-
assertDuplicateRelation(node, expr);
|
|
172
|
-
node[expr.$name] = expr;
|
|
173
|
-
node.$childNames.push(expr.$name);
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
return node;
|
|
177
|
-
},
|
|
178
|
-
peg$c2 = function (name, args, alias, list) {
|
|
179
|
-
const node = newNode();
|
|
180
|
-
|
|
181
|
-
node.$name = alias || name;
|
|
182
|
-
node.$relation = name;
|
|
183
|
-
node.$modify = args || [];
|
|
184
|
-
|
|
185
|
-
list.forEach((expr) => {
|
|
186
|
-
assertDuplicateRelation(node, expr);
|
|
187
|
-
node[expr.$name] = expr;
|
|
188
|
-
node.$childNames.push(expr.$name);
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
return node;
|
|
192
|
-
},
|
|
193
|
-
peg$c3 = function (name, args, alias, expr) {
|
|
194
|
-
const node = newNode();
|
|
195
|
-
|
|
196
|
-
node.$name = alias || name;
|
|
197
|
-
node.$relation = name;
|
|
198
|
-
node.$modify = args || [];
|
|
199
|
-
|
|
200
|
-
if (expr) {
|
|
201
|
-
const match = /^\^(\d*)$/.exec(expr.$name);
|
|
202
|
-
|
|
203
|
-
if (match) {
|
|
204
|
-
if (match[1]) {
|
|
205
|
-
node.$recursive = parseInt(match[1], 10);
|
|
206
|
-
} else {
|
|
207
|
-
node.$recursive = true;
|
|
208
|
-
}
|
|
209
|
-
} else if (expr.$name === '*') {
|
|
210
|
-
node.$allRecursive = true;
|
|
211
|
-
} else {
|
|
212
|
-
assertDuplicateRelation(node, expr);
|
|
213
|
-
node[expr.$name] = expr;
|
|
214
|
-
node.$childNames.push(expr.$name);
|
|
118
|
+
options = options !== void 0 ? options : {};
|
|
119
|
+
var peg$FAILED = {}, peg$startRuleFunctions = { start: peg$parsestart }, peg$startRuleFunction = peg$parsestart, peg$c0 = function (expr) {
|
|
120
|
+
const node = newNode();
|
|
121
|
+
if (expr.$name === '*') {
|
|
122
|
+
node.$allRecursive = true;
|
|
215
123
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
peg$c4 = 'as',
|
|
221
|
-
peg$c5 = peg$literalExpectation('as', false),
|
|
222
|
-
peg$c6 = function (alias) {
|
|
223
|
-
return alias;
|
|
224
|
-
},
|
|
225
|
-
peg$c7 = function (name) {
|
|
226
|
-
return name.join('');
|
|
227
|
-
},
|
|
228
|
-
peg$c8 = /^[^[\](),. \t\r\n]/,
|
|
229
|
-
peg$c9 = peg$classExpectation(
|
|
230
|
-
['[', ']', '(', ')', ',', '.', ' ', '\t', '\r', '\n'],
|
|
231
|
-
true,
|
|
232
|
-
false,
|
|
233
|
-
),
|
|
234
|
-
peg$c10 = '(',
|
|
235
|
-
peg$c11 = peg$literalExpectation('(', false),
|
|
236
|
-
peg$c12 = ')',
|
|
237
|
-
peg$c13 = peg$literalExpectation(')', false),
|
|
238
|
-
peg$c14 = function (args) {
|
|
239
|
-
return args;
|
|
240
|
-
},
|
|
241
|
-
peg$c15 = ',',
|
|
242
|
-
peg$c16 = peg$literalExpectation(',', false),
|
|
243
|
-
peg$c17 = function (arg) {
|
|
244
|
-
return arg;
|
|
245
|
-
},
|
|
246
|
-
peg$c18 = /^[ \t\r\n]/,
|
|
247
|
-
peg$c19 = peg$classExpectation([' ', '\t', '\r', '\n'], false, false),
|
|
248
|
-
peg$c20 = '.',
|
|
249
|
-
peg$c21 = peg$literalExpectation('.', false),
|
|
250
|
-
peg$c22 = function (list) {
|
|
251
|
-
return list;
|
|
252
|
-
},
|
|
253
|
-
peg$c23 = '[',
|
|
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) {
|
|
275
|
-
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
276
|
-
throw new Error('Can\'t start parsing from rule "' + options.startRule + '".');
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
function text() {
|
|
283
|
-
return input.substring(peg$savedPos, peg$currPos);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
function location() {
|
|
287
|
-
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
function expected(description, location) {
|
|
291
|
-
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
292
|
-
|
|
293
|
-
throw peg$buildStructuredError(
|
|
294
|
-
[peg$otherExpectation(description)],
|
|
295
|
-
input.substring(peg$savedPos, peg$currPos),
|
|
296
|
-
location,
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function error(message, location) {
|
|
301
|
-
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
302
|
-
|
|
303
|
-
throw peg$buildSimpleError(message, location);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
function peg$literalExpectation(text, ignoreCase) {
|
|
307
|
-
return { type: 'literal', text: text, ignoreCase: ignoreCase };
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
311
|
-
return { type: 'class', parts: parts, inverted: inverted, ignoreCase: ignoreCase };
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
function peg$anyExpectation() {
|
|
315
|
-
return { type: 'any' };
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function peg$endExpectation() {
|
|
319
|
-
return { type: 'end' };
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
function peg$otherExpectation(description) {
|
|
323
|
-
return { type: 'other', description: description };
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
function peg$computePosDetails(pos) {
|
|
327
|
-
var details = peg$posDetailsCache[pos],
|
|
328
|
-
p;
|
|
329
|
-
|
|
330
|
-
if (details) {
|
|
331
|
-
return details;
|
|
332
|
-
} else {
|
|
333
|
-
p = pos - 1;
|
|
334
|
-
while (!peg$posDetailsCache[p]) {
|
|
335
|
-
p--;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
details = peg$posDetailsCache[p];
|
|
339
|
-
details = {
|
|
340
|
-
line: details.line,
|
|
341
|
-
column: details.column,
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
while (p < pos) {
|
|
345
|
-
if (input.charCodeAt(p) === 10) {
|
|
346
|
-
details.line++;
|
|
347
|
-
details.column = 1;
|
|
348
|
-
} else {
|
|
349
|
-
details.column++;
|
|
124
|
+
else {
|
|
125
|
+
assertDuplicateRelation(node, expr);
|
|
126
|
+
node[expr.$name] = expr;
|
|
127
|
+
node.$childNames.push(expr.$name);
|
|
350
128
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
129
|
+
return node;
|
|
130
|
+
}, peg$c1 = function (list) {
|
|
131
|
+
const node = newNode();
|
|
132
|
+
list.forEach((expr) => {
|
|
133
|
+
assertDuplicateRelation(node, expr);
|
|
134
|
+
node[expr.$name] = expr;
|
|
135
|
+
node.$childNames.push(expr.$name);
|
|
136
|
+
});
|
|
137
|
+
return node;
|
|
138
|
+
}, peg$c2 = function (name, args, alias, list) {
|
|
139
|
+
const node = newNode();
|
|
140
|
+
node.$name = alias || name;
|
|
141
|
+
node.$relation = name;
|
|
142
|
+
node.$modify = args || [];
|
|
143
|
+
list.forEach((expr) => {
|
|
144
|
+
assertDuplicateRelation(node, expr);
|
|
145
|
+
node[expr.$name] = expr;
|
|
146
|
+
node.$childNames.push(expr.$name);
|
|
147
|
+
});
|
|
148
|
+
return node;
|
|
149
|
+
}, peg$c3 = function (name, args, alias, expr) {
|
|
150
|
+
const node = newNode();
|
|
151
|
+
node.$name = alias || name;
|
|
152
|
+
node.$relation = name;
|
|
153
|
+
node.$modify = args || [];
|
|
154
|
+
if (expr) {
|
|
155
|
+
const match = /^\^(\d*)$/.exec(expr.$name);
|
|
156
|
+
if (match) {
|
|
157
|
+
if (match[1]) {
|
|
158
|
+
node.$recursive = parseInt(match[1], 10);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
node.$recursive = true;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else if (expr.$name === '*') {
|
|
165
|
+
node.$allRecursive = true;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
assertDuplicateRelation(node, expr);
|
|
169
|
+
node[expr.$name] = expr;
|
|
170
|
+
node.$childNames.push(expr.$name);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return node;
|
|
174
|
+
}, peg$c4 = 'as', peg$c5 = peg$literalExpectation('as', false), peg$c6 = function (alias) {
|
|
175
|
+
return alias;
|
|
176
|
+
}, peg$c7 = function (name) {
|
|
177
|
+
return name.join('');
|
|
178
|
+
}, peg$c8 = /^[^[\](),. \t\r\n]/, peg$c9 = peg$classExpectation(['[', ']', '(', ')', ',', '.', ' ', '\t', '\r', '\n'], true, false), peg$c10 = '(', peg$c11 = peg$literalExpectation('(', false), peg$c12 = ')', peg$c13 = peg$literalExpectation(')', false), peg$c14 = function (args) {
|
|
179
|
+
return args;
|
|
180
|
+
}, peg$c15 = ',', peg$c16 = peg$literalExpectation(',', false), peg$c17 = function (arg) {
|
|
181
|
+
return arg;
|
|
182
|
+
}, peg$c18 = /^[ \t\r\n]/, peg$c19 = peg$classExpectation([' ', '\t', '\r', '\n'], false, false), peg$c20 = '.', peg$c21 = peg$literalExpectation('.', false), peg$c22 = function (list) {
|
|
183
|
+
return list;
|
|
184
|
+
}, peg$c23 = '[', peg$c24 = peg$literalExpectation('[', false), peg$c25 = ']', peg$c26 = peg$literalExpectation(']', false), peg$c27 = function (items) {
|
|
185
|
+
return items;
|
|
186
|
+
}, peg$c28 = function (expr) {
|
|
187
|
+
return expr;
|
|
188
|
+
}, peg$c29 = function (sub) {
|
|
189
|
+
return sub;
|
|
190
|
+
}, peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result;
|
|
191
|
+
if ('startRule' in options) {
|
|
192
|
+
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
193
|
+
throw new Error('Can\'t start parsing from rule "' + options.startRule + '".');
|
|
194
|
+
}
|
|
195
|
+
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
357
196
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
return {
|
|
365
|
-
start: {
|
|
366
|
-
offset: startPos,
|
|
367
|
-
line: startPosDetails.line,
|
|
368
|
-
column: startPosDetails.column,
|
|
369
|
-
},
|
|
370
|
-
end: {
|
|
371
|
-
offset: endPos,
|
|
372
|
-
line: endPosDetails.line,
|
|
373
|
-
column: endPosDetails.column,
|
|
374
|
-
},
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
function peg$fail(expected) {
|
|
379
|
-
if (peg$currPos < peg$maxFailPos) {
|
|
380
|
-
return;
|
|
197
|
+
function text() {
|
|
198
|
+
return input.substring(peg$savedPos, peg$currPos);
|
|
199
|
+
}
|
|
200
|
+
function location() {
|
|
201
|
+
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
381
202
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
peg$maxFailExpected = [];
|
|
203
|
+
function expected(description, location) {
|
|
204
|
+
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
205
|
+
throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location);
|
|
386
206
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
function peg$buildSimpleError(message, location) {
|
|
392
|
-
return new peg$SyntaxError(message, null, null, location);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
function peg$buildStructuredError(expected, found, location) {
|
|
396
|
-
return new peg$SyntaxError(
|
|
397
|
-
peg$SyntaxError.buildMessage(expected, found),
|
|
398
|
-
expected,
|
|
399
|
-
found,
|
|
400
|
-
location,
|
|
401
|
-
);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function peg$parsestart() {
|
|
405
|
-
var s0, s1;
|
|
406
|
-
|
|
407
|
-
s0 = peg$currPos;
|
|
408
|
-
s1 = peg$parseexpression();
|
|
409
|
-
if (s1 !== peg$FAILED) {
|
|
410
|
-
peg$savedPos = s0;
|
|
411
|
-
s1 = peg$c0(s1);
|
|
207
|
+
function error(message, location) {
|
|
208
|
+
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos);
|
|
209
|
+
throw peg$buildSimpleError(message, location);
|
|
412
210
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
s0 = peg$currPos;
|
|
416
|
-
s1 = peg$parselistExpression();
|
|
417
|
-
if (s1 !== peg$FAILED) {
|
|
418
|
-
peg$savedPos = s0;
|
|
419
|
-
s1 = peg$c1(s1);
|
|
420
|
-
}
|
|
421
|
-
s0 = s1;
|
|
211
|
+
function peg$literalExpectation(text, ignoreCase) {
|
|
212
|
+
return { type: 'literal', text: text, ignoreCase: ignoreCase };
|
|
422
213
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (s3 === peg$FAILED) {
|
|
440
|
-
s3 = null;
|
|
214
|
+
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
215
|
+
return { type: 'class', parts: parts, inverted: inverted, ignoreCase: ignoreCase };
|
|
216
|
+
}
|
|
217
|
+
function peg$anyExpectation() {
|
|
218
|
+
return { type: 'any' };
|
|
219
|
+
}
|
|
220
|
+
function peg$endExpectation() {
|
|
221
|
+
return { type: 'end' };
|
|
222
|
+
}
|
|
223
|
+
function peg$otherExpectation(description) {
|
|
224
|
+
return { type: 'other', description: description };
|
|
225
|
+
}
|
|
226
|
+
function peg$computePosDetails(pos) {
|
|
227
|
+
var details = peg$posDetailsCache[pos], p;
|
|
228
|
+
if (details) {
|
|
229
|
+
return details;
|
|
441
230
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
231
|
+
else {
|
|
232
|
+
p = pos - 1;
|
|
233
|
+
while (!peg$posDetailsCache[p]) {
|
|
234
|
+
p--;
|
|
235
|
+
}
|
|
236
|
+
details = peg$posDetailsCache[p];
|
|
237
|
+
details = {
|
|
238
|
+
line: details.line,
|
|
239
|
+
column: details.column,
|
|
240
|
+
};
|
|
241
|
+
while (p < pos) {
|
|
242
|
+
if (input.charCodeAt(p) === 10) {
|
|
243
|
+
details.line++;
|
|
244
|
+
details.column = 1;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
details.column++;
|
|
248
|
+
}
|
|
249
|
+
p++;
|
|
250
|
+
}
|
|
251
|
+
peg$posDetailsCache[pos] = details;
|
|
252
|
+
return details;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function peg$computeLocation(startPos, endPos) {
|
|
256
|
+
var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos);
|
|
257
|
+
return {
|
|
258
|
+
start: {
|
|
259
|
+
offset: startPos,
|
|
260
|
+
line: startPosDetails.line,
|
|
261
|
+
column: startPosDetails.column,
|
|
262
|
+
},
|
|
263
|
+
end: {
|
|
264
|
+
offset: endPos,
|
|
265
|
+
line: endPosDetails.line,
|
|
266
|
+
column: endPosDetails.column,
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function peg$fail(expected) {
|
|
271
|
+
if (peg$currPos < peg$maxFailPos) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (peg$currPos > peg$maxFailPos) {
|
|
275
|
+
peg$maxFailPos = peg$currPos;
|
|
276
|
+
peg$maxFailExpected = [];
|
|
277
|
+
}
|
|
278
|
+
peg$maxFailExpected.push(expected);
|
|
279
|
+
}
|
|
280
|
+
function peg$buildSimpleError(message, location) {
|
|
281
|
+
return new peg$SyntaxError(message, null, null, location);
|
|
282
|
+
}
|
|
283
|
+
function peg$buildStructuredError(expected, found, location) {
|
|
284
|
+
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location);
|
|
285
|
+
}
|
|
286
|
+
function peg$parsestart() {
|
|
287
|
+
var s0, s1;
|
|
288
|
+
s0 = peg$currPos;
|
|
289
|
+
s1 = peg$parseexpression();
|
|
290
|
+
if (s1 !== peg$FAILED) {
|
|
445
291
|
peg$savedPos = s0;
|
|
446
|
-
s1 = peg$
|
|
292
|
+
s1 = peg$c0(s1);
|
|
293
|
+
}
|
|
294
|
+
s0 = s1;
|
|
295
|
+
if (s0 === peg$FAILED) {
|
|
296
|
+
s0 = peg$currPos;
|
|
297
|
+
s1 = peg$parselistExpression();
|
|
298
|
+
if (s1 !== peg$FAILED) {
|
|
299
|
+
peg$savedPos = s0;
|
|
300
|
+
s1 = peg$c1(s1);
|
|
301
|
+
}
|
|
447
302
|
s0 = s1;
|
|
448
|
-
} else {
|
|
449
|
-
peg$currPos = s0;
|
|
450
|
-
s0 = peg$FAILED;
|
|
451
|
-
}
|
|
452
|
-
} else {
|
|
453
|
-
peg$currPos = s0;
|
|
454
|
-
s0 = peg$FAILED;
|
|
455
303
|
}
|
|
456
|
-
|
|
457
|
-
peg$currPos = s0;
|
|
458
|
-
s0 = peg$FAILED;
|
|
459
|
-
}
|
|
460
|
-
} else {
|
|
461
|
-
peg$currPos = s0;
|
|
462
|
-
s0 = peg$FAILED;
|
|
304
|
+
return s0;
|
|
463
305
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
if (s2 !== peg$FAILED) {
|
|
473
|
-
s3 = peg$parsealias();
|
|
474
|
-
if (s3 === peg$FAILED) {
|
|
475
|
-
s3 = null;
|
|
476
|
-
}
|
|
477
|
-
if (s3 !== peg$FAILED) {
|
|
478
|
-
s4 = peg$parsesubExpression();
|
|
479
|
-
if (s4 === peg$FAILED) {
|
|
480
|
-
s4 = null;
|
|
306
|
+
function peg$parseexpression() {
|
|
307
|
+
var s0, s1, s2, s3, s4;
|
|
308
|
+
s0 = peg$currPos;
|
|
309
|
+
s1 = peg$parsename();
|
|
310
|
+
if (s1 !== peg$FAILED) {
|
|
311
|
+
s2 = peg$parseargs();
|
|
312
|
+
if (s2 === peg$FAILED) {
|
|
313
|
+
s2 = null;
|
|
481
314
|
}
|
|
482
|
-
if (
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
315
|
+
if (s2 !== peg$FAILED) {
|
|
316
|
+
s3 = peg$parsealias();
|
|
317
|
+
if (s3 === peg$FAILED) {
|
|
318
|
+
s3 = null;
|
|
319
|
+
}
|
|
320
|
+
if (s3 !== peg$FAILED) {
|
|
321
|
+
s4 = peg$parsesubListExpression();
|
|
322
|
+
if (s4 !== peg$FAILED) {
|
|
323
|
+
peg$savedPos = s0;
|
|
324
|
+
s1 = peg$c2(s1, s2, s3, s4);
|
|
325
|
+
s0 = s1;
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
peg$currPos = s0;
|
|
329
|
+
s0 = peg$FAILED;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
peg$currPos = s0;
|
|
334
|
+
s0 = peg$FAILED;
|
|
335
|
+
}
|
|
489
336
|
}
|
|
490
|
-
|
|
337
|
+
else {
|
|
338
|
+
peg$currPos = s0;
|
|
339
|
+
s0 = peg$FAILED;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
491
343
|
peg$currPos = s0;
|
|
492
344
|
s0 = peg$FAILED;
|
|
493
|
-
}
|
|
494
|
-
} else {
|
|
495
|
-
peg$currPos = s0;
|
|
496
|
-
s0 = peg$FAILED;
|
|
497
345
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
346
|
+
if (s0 === peg$FAILED) {
|
|
347
|
+
s0 = peg$currPos;
|
|
348
|
+
s1 = peg$parsename();
|
|
349
|
+
if (s1 !== peg$FAILED) {
|
|
350
|
+
s2 = peg$parseargs();
|
|
351
|
+
if (s2 === peg$FAILED) {
|
|
352
|
+
s2 = null;
|
|
353
|
+
}
|
|
354
|
+
if (s2 !== peg$FAILED) {
|
|
355
|
+
s3 = peg$parsealias();
|
|
356
|
+
if (s3 === peg$FAILED) {
|
|
357
|
+
s3 = null;
|
|
358
|
+
}
|
|
359
|
+
if (s3 !== peg$FAILED) {
|
|
360
|
+
s4 = peg$parsesubExpression();
|
|
361
|
+
if (s4 === peg$FAILED) {
|
|
362
|
+
s4 = null;
|
|
363
|
+
}
|
|
364
|
+
if (s4 !== peg$FAILED) {
|
|
365
|
+
peg$savedPos = s0;
|
|
366
|
+
s1 = peg$c3(s1, s2, s3, s4);
|
|
367
|
+
s0 = s1;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
peg$currPos = s0;
|
|
371
|
+
s0 = peg$FAILED;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
peg$currPos = s0;
|
|
376
|
+
s0 = peg$FAILED;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
peg$currPos = s0;
|
|
381
|
+
s0 = peg$FAILED;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
peg$currPos = s0;
|
|
386
|
+
s0 = peg$FAILED;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return s0;
|
|
502
390
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
function peg$parsealias() {
|
|
508
|
-
var s0, s1, s2, s3, s4;
|
|
509
|
-
|
|
510
|
-
s0 = peg$currPos;
|
|
511
|
-
s1 = [];
|
|
512
|
-
s2 = peg$parsews();
|
|
513
|
-
if (s2 !== peg$FAILED) {
|
|
514
|
-
while (s2 !== peg$FAILED) {
|
|
515
|
-
s1.push(s2);
|
|
391
|
+
function peg$parsealias() {
|
|
392
|
+
var s0, s1, s2, s3, s4;
|
|
393
|
+
s0 = peg$currPos;
|
|
394
|
+
s1 = [];
|
|
516
395
|
s2 = peg$parsews();
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
if (input.substr(peg$currPos, 2) === peg$c4) {
|
|
523
|
-
s2 = peg$c4;
|
|
524
|
-
peg$currPos += 2;
|
|
525
|
-
} else {
|
|
526
|
-
s2 = peg$FAILED;
|
|
527
|
-
if (peg$silentFails === 0) {
|
|
528
|
-
peg$fail(peg$c5);
|
|
396
|
+
if (s2 !== peg$FAILED) {
|
|
397
|
+
while (s2 !== peg$FAILED) {
|
|
398
|
+
s1.push(s2);
|
|
399
|
+
s2 = peg$parsews();
|
|
400
|
+
}
|
|
529
401
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
s3 = [];
|
|
533
|
-
s4 = peg$parsews();
|
|
534
|
-
if (s4 !== peg$FAILED) {
|
|
535
|
-
while (s4 !== peg$FAILED) {
|
|
536
|
-
s3.push(s4);
|
|
537
|
-
s4 = peg$parsews();
|
|
538
|
-
}
|
|
539
|
-
} else {
|
|
540
|
-
s3 = peg$FAILED;
|
|
402
|
+
else {
|
|
403
|
+
s1 = peg$FAILED;
|
|
541
404
|
}
|
|
542
|
-
if (
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
405
|
+
if (s1 !== peg$FAILED) {
|
|
406
|
+
if (input.substr(peg$currPos, 2) === peg$c4) {
|
|
407
|
+
s2 = peg$c4;
|
|
408
|
+
peg$currPos += 2;
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
s2 = peg$FAILED;
|
|
412
|
+
if (peg$silentFails === 0) {
|
|
413
|
+
peg$fail(peg$c5);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (s2 !== peg$FAILED) {
|
|
417
|
+
s3 = [];
|
|
418
|
+
s4 = peg$parsews();
|
|
419
|
+
if (s4 !== peg$FAILED) {
|
|
420
|
+
while (s4 !== peg$FAILED) {
|
|
421
|
+
s3.push(s4);
|
|
422
|
+
s4 = peg$parsews();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
s3 = peg$FAILED;
|
|
427
|
+
}
|
|
428
|
+
if (s3 !== peg$FAILED) {
|
|
429
|
+
s4 = peg$parsename();
|
|
430
|
+
if (s4 !== peg$FAILED) {
|
|
431
|
+
peg$savedPos = s0;
|
|
432
|
+
s1 = peg$c6(s4);
|
|
433
|
+
s0 = s1;
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
peg$currPos = s0;
|
|
437
|
+
s0 = peg$FAILED;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
peg$currPos = s0;
|
|
442
|
+
s0 = peg$FAILED;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
peg$currPos = s0;
|
|
447
|
+
s0 = peg$FAILED;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
549
451
|
peg$currPos = s0;
|
|
550
452
|
s0 = peg$FAILED;
|
|
551
|
-
}
|
|
552
|
-
} else {
|
|
553
|
-
peg$currPos = s0;
|
|
554
|
-
s0 = peg$FAILED;
|
|
555
453
|
}
|
|
556
|
-
|
|
557
|
-
peg$currPos = s0;
|
|
558
|
-
s0 = peg$FAILED;
|
|
559
|
-
}
|
|
560
|
-
} else {
|
|
561
|
-
peg$currPos = s0;
|
|
562
|
-
s0 = peg$FAILED;
|
|
454
|
+
return s0;
|
|
563
455
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
function peg$parsename() {
|
|
569
|
-
var s0, s1, s2;
|
|
570
|
-
|
|
571
|
-
s0 = peg$currPos;
|
|
572
|
-
s1 = [];
|
|
573
|
-
s2 = peg$parsechar();
|
|
574
|
-
if (s2 !== peg$FAILED) {
|
|
575
|
-
while (s2 !== peg$FAILED) {
|
|
576
|
-
s1.push(s2);
|
|
456
|
+
function peg$parsename() {
|
|
457
|
+
var s0, s1, s2;
|
|
458
|
+
s0 = peg$currPos;
|
|
459
|
+
s1 = [];
|
|
577
460
|
s2 = peg$parsechar();
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
if (peg$c8.test(input.charAt(peg$currPos))) {
|
|
595
|
-
s0 = input.charAt(peg$currPos);
|
|
596
|
-
peg$currPos++;
|
|
597
|
-
} else {
|
|
598
|
-
s0 = peg$FAILED;
|
|
599
|
-
if (peg$silentFails === 0) {
|
|
600
|
-
peg$fail(peg$c9);
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
return s0;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
function peg$parseargs() {
|
|
608
|
-
var s0, s1, s2, s3, s4, s5;
|
|
609
|
-
|
|
610
|
-
s0 = peg$currPos;
|
|
611
|
-
s1 = [];
|
|
612
|
-
s2 = peg$parsews();
|
|
613
|
-
while (s2 !== peg$FAILED) {
|
|
614
|
-
s1.push(s2);
|
|
615
|
-
s2 = peg$parsews();
|
|
461
|
+
if (s2 !== peg$FAILED) {
|
|
462
|
+
while (s2 !== peg$FAILED) {
|
|
463
|
+
s1.push(s2);
|
|
464
|
+
s2 = peg$parsechar();
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
s1 = peg$FAILED;
|
|
469
|
+
}
|
|
470
|
+
if (s1 !== peg$FAILED) {
|
|
471
|
+
peg$savedPos = s0;
|
|
472
|
+
s1 = peg$c7(s1);
|
|
473
|
+
}
|
|
474
|
+
s0 = s1;
|
|
475
|
+
return s0;
|
|
616
476
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
s2 = peg$FAILED;
|
|
623
|
-
if (peg$silentFails === 0) {
|
|
624
|
-
peg$fail(peg$c11);
|
|
477
|
+
function peg$parsechar() {
|
|
478
|
+
var s0;
|
|
479
|
+
if (peg$c8.test(input.charAt(peg$currPos))) {
|
|
480
|
+
s0 = input.charAt(peg$currPos);
|
|
481
|
+
peg$currPos++;
|
|
625
482
|
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
s3.push(s4);
|
|
632
|
-
s4 = peg$parseargListItem();
|
|
483
|
+
else {
|
|
484
|
+
s0 = peg$FAILED;
|
|
485
|
+
if (peg$silentFails === 0) {
|
|
486
|
+
peg$fail(peg$c9);
|
|
487
|
+
}
|
|
633
488
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
peg$
|
|
649
|
-
|
|
489
|
+
return s0;
|
|
490
|
+
}
|
|
491
|
+
function peg$parseargs() {
|
|
492
|
+
var s0, s1, s2, s3, s4, s5;
|
|
493
|
+
s0 = peg$currPos;
|
|
494
|
+
s1 = [];
|
|
495
|
+
s2 = peg$parsews();
|
|
496
|
+
while (s2 !== peg$FAILED) {
|
|
497
|
+
s1.push(s2);
|
|
498
|
+
s2 = peg$parsews();
|
|
499
|
+
}
|
|
500
|
+
if (s1 !== peg$FAILED) {
|
|
501
|
+
if (input.charCodeAt(peg$currPos) === 40) {
|
|
502
|
+
s2 = peg$c10;
|
|
503
|
+
peg$currPos++;
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
s2 = peg$FAILED;
|
|
507
|
+
if (peg$silentFails === 0) {
|
|
508
|
+
peg$fail(peg$c11);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
if (s2 !== peg$FAILED) {
|
|
512
|
+
s3 = [];
|
|
513
|
+
s4 = peg$parseargListItem();
|
|
514
|
+
while (s4 !== peg$FAILED) {
|
|
515
|
+
s3.push(s4);
|
|
516
|
+
s4 = peg$parseargListItem();
|
|
517
|
+
}
|
|
518
|
+
if (s3 !== peg$FAILED) {
|
|
519
|
+
s4 = [];
|
|
520
|
+
s5 = peg$parsews();
|
|
521
|
+
while (s5 !== peg$FAILED) {
|
|
522
|
+
s4.push(s5);
|
|
523
|
+
s5 = peg$parsews();
|
|
524
|
+
}
|
|
525
|
+
if (s4 !== peg$FAILED) {
|
|
526
|
+
if (input.charCodeAt(peg$currPos) === 41) {
|
|
527
|
+
s5 = peg$c12;
|
|
528
|
+
peg$currPos++;
|
|
529
|
+
}
|
|
530
|
+
else {
|
|
531
|
+
s5 = peg$FAILED;
|
|
532
|
+
if (peg$silentFails === 0) {
|
|
533
|
+
peg$fail(peg$c13);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (s5 !== peg$FAILED) {
|
|
537
|
+
peg$savedPos = s0;
|
|
538
|
+
s1 = peg$c14(s3);
|
|
539
|
+
s0 = s1;
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
peg$currPos = s0;
|
|
543
|
+
s0 = peg$FAILED;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
peg$currPos = s0;
|
|
548
|
+
s0 = peg$FAILED;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
peg$currPos = s0;
|
|
553
|
+
s0 = peg$FAILED;
|
|
554
|
+
}
|
|
650
555
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
s0 = s1;
|
|
655
|
-
} else {
|
|
656
|
-
peg$currPos = s0;
|
|
657
|
-
s0 = peg$FAILED;
|
|
556
|
+
else {
|
|
557
|
+
peg$currPos = s0;
|
|
558
|
+
s0 = peg$FAILED;
|
|
658
559
|
}
|
|
659
|
-
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
660
562
|
peg$currPos = s0;
|
|
661
563
|
s0 = peg$FAILED;
|
|
662
|
-
}
|
|
663
|
-
} else {
|
|
664
|
-
peg$currPos = s0;
|
|
665
|
-
s0 = peg$FAILED;
|
|
666
564
|
}
|
|
667
|
-
|
|
668
|
-
peg$currPos = s0;
|
|
669
|
-
s0 = peg$FAILED;
|
|
670
|
-
}
|
|
671
|
-
} else {
|
|
672
|
-
peg$currPos = s0;
|
|
673
|
-
s0 = peg$FAILED;
|
|
565
|
+
return s0;
|
|
674
566
|
}
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
s1 = [];
|
|
684
|
-
s2 = peg$parsews();
|
|
685
|
-
while (s2 !== peg$FAILED) {
|
|
686
|
-
s1.push(s2);
|
|
687
|
-
s2 = peg$parsews();
|
|
688
|
-
}
|
|
689
|
-
if (s1 !== peg$FAILED) {
|
|
690
|
-
s2 = peg$parsename();
|
|
691
|
-
if (s2 !== peg$FAILED) {
|
|
692
|
-
s3 = [];
|
|
693
|
-
s4 = peg$parsews();
|
|
694
|
-
while (s4 !== peg$FAILED) {
|
|
695
|
-
s3.push(s4);
|
|
696
|
-
s4 = peg$parsews();
|
|
567
|
+
function peg$parseargListItem() {
|
|
568
|
+
var s0, s1, s2, s3, s4;
|
|
569
|
+
s0 = peg$currPos;
|
|
570
|
+
s1 = [];
|
|
571
|
+
s2 = peg$parsews();
|
|
572
|
+
while (s2 !== peg$FAILED) {
|
|
573
|
+
s1.push(s2);
|
|
574
|
+
s2 = peg$parsews();
|
|
697
575
|
}
|
|
698
|
-
if (
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
576
|
+
if (s1 !== peg$FAILED) {
|
|
577
|
+
s2 = peg$parsename();
|
|
578
|
+
if (s2 !== peg$FAILED) {
|
|
579
|
+
s3 = [];
|
|
580
|
+
s4 = peg$parsews();
|
|
581
|
+
while (s4 !== peg$FAILED) {
|
|
582
|
+
s3.push(s4);
|
|
583
|
+
s4 = peg$parsews();
|
|
584
|
+
}
|
|
585
|
+
if (s3 !== peg$FAILED) {
|
|
586
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
587
|
+
s4 = peg$c15;
|
|
588
|
+
peg$currPos++;
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
s4 = peg$FAILED;
|
|
592
|
+
if (peg$silentFails === 0) {
|
|
593
|
+
peg$fail(peg$c16);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (s4 === peg$FAILED) {
|
|
597
|
+
s4 = null;
|
|
598
|
+
}
|
|
599
|
+
if (s4 !== peg$FAILED) {
|
|
600
|
+
peg$savedPos = s0;
|
|
601
|
+
s1 = peg$c17(s2);
|
|
602
|
+
s0 = s1;
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
peg$currPos = s0;
|
|
606
|
+
s0 = peg$FAILED;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
else {
|
|
610
|
+
peg$currPos = s0;
|
|
611
|
+
s0 = peg$FAILED;
|
|
612
|
+
}
|
|
706
613
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
s1 = peg$c17(s2);
|
|
714
|
-
s0 = s1;
|
|
715
|
-
} else {
|
|
614
|
+
else {
|
|
615
|
+
peg$currPos = s0;
|
|
616
|
+
s0 = peg$FAILED;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
716
620
|
peg$currPos = s0;
|
|
717
621
|
s0 = peg$FAILED;
|
|
718
|
-
}
|
|
719
|
-
} else {
|
|
720
|
-
peg$currPos = s0;
|
|
721
|
-
s0 = peg$FAILED;
|
|
722
622
|
}
|
|
723
|
-
|
|
724
|
-
peg$currPos = s0;
|
|
725
|
-
s0 = peg$FAILED;
|
|
726
|
-
}
|
|
727
|
-
} else {
|
|
728
|
-
peg$currPos = s0;
|
|
729
|
-
s0 = peg$FAILED;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
return s0;
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
function peg$parsews() {
|
|
736
|
-
var s0;
|
|
737
|
-
|
|
738
|
-
if (peg$c18.test(input.charAt(peg$currPos))) {
|
|
739
|
-
s0 = input.charAt(peg$currPos);
|
|
740
|
-
peg$currPos++;
|
|
741
|
-
} else {
|
|
742
|
-
s0 = peg$FAILED;
|
|
743
|
-
if (peg$silentFails === 0) {
|
|
744
|
-
peg$fail(peg$c19);
|
|
745
|
-
}
|
|
623
|
+
return s0;
|
|
746
624
|
}
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
var s0, s1, s2, s3;
|
|
753
|
-
|
|
754
|
-
s0 = peg$currPos;
|
|
755
|
-
s1 = [];
|
|
756
|
-
s2 = peg$parsews();
|
|
757
|
-
while (s2 !== peg$FAILED) {
|
|
758
|
-
s1.push(s2);
|
|
759
|
-
s2 = peg$parsews();
|
|
760
|
-
}
|
|
761
|
-
if (s1 !== peg$FAILED) {
|
|
762
|
-
if (input.charCodeAt(peg$currPos) === 46) {
|
|
763
|
-
s2 = peg$c20;
|
|
764
|
-
peg$currPos++;
|
|
765
|
-
} else {
|
|
766
|
-
s2 = peg$FAILED;
|
|
767
|
-
if (peg$silentFails === 0) {
|
|
768
|
-
peg$fail(peg$c21);
|
|
625
|
+
function peg$parsews() {
|
|
626
|
+
var s0;
|
|
627
|
+
if (peg$c18.test(input.charAt(peg$currPos))) {
|
|
628
|
+
s0 = input.charAt(peg$currPos);
|
|
629
|
+
peg$currPos++;
|
|
769
630
|
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
s1 = peg$c22(s3);
|
|
776
|
-
s0 = s1;
|
|
777
|
-
} else {
|
|
778
|
-
peg$currPos = s0;
|
|
779
|
-
s0 = peg$FAILED;
|
|
631
|
+
else {
|
|
632
|
+
s0 = peg$FAILED;
|
|
633
|
+
if (peg$silentFails === 0) {
|
|
634
|
+
peg$fail(peg$c19);
|
|
635
|
+
}
|
|
780
636
|
}
|
|
781
|
-
|
|
782
|
-
peg$currPos = s0;
|
|
783
|
-
s0 = peg$FAILED;
|
|
784
|
-
}
|
|
785
|
-
} else {
|
|
786
|
-
peg$currPos = s0;
|
|
787
|
-
s0 = peg$FAILED;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
return s0;
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
function peg$parselistExpression() {
|
|
794
|
-
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
795
|
-
|
|
796
|
-
s0 = peg$currPos;
|
|
797
|
-
s1 = [];
|
|
798
|
-
s2 = peg$parsews();
|
|
799
|
-
while (s2 !== peg$FAILED) {
|
|
800
|
-
s1.push(s2);
|
|
801
|
-
s2 = peg$parsews();
|
|
637
|
+
return s0;
|
|
802
638
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
s2
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
if (s2 !== peg$FAILED) {
|
|
814
|
-
s3 = [];
|
|
815
|
-
s4 = peg$parselistExpressionItem();
|
|
816
|
-
while (s4 !== peg$FAILED) {
|
|
817
|
-
s3.push(s4);
|
|
818
|
-
s4 = peg$parselistExpressionItem();
|
|
639
|
+
function peg$parsesubListExpression() {
|
|
640
|
+
var s0, s1, s2, s3;
|
|
641
|
+
s0 = peg$currPos;
|
|
642
|
+
s1 = [];
|
|
643
|
+
s2 = peg$parsews();
|
|
644
|
+
while (s2 !== peg$FAILED) {
|
|
645
|
+
s1.push(s2);
|
|
646
|
+
s2 = peg$parsews();
|
|
819
647
|
}
|
|
820
|
-
if (
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
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
|
-
}
|
|
648
|
+
if (s1 !== peg$FAILED) {
|
|
649
|
+
if (input.charCodeAt(peg$currPos) === 46) {
|
|
650
|
+
s2 = peg$c20;
|
|
651
|
+
peg$currPos++;
|
|
836
652
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
peg$
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
653
|
+
else {
|
|
654
|
+
s2 = peg$FAILED;
|
|
655
|
+
if (peg$silentFails === 0) {
|
|
656
|
+
peg$fail(peg$c21);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if (s2 !== peg$FAILED) {
|
|
660
|
+
s3 = peg$parselistExpression();
|
|
661
|
+
if (s3 !== peg$FAILED) {
|
|
662
|
+
peg$savedPos = s0;
|
|
663
|
+
s1 = peg$c22(s3);
|
|
664
|
+
s0 = s1;
|
|
665
|
+
}
|
|
666
|
+
else {
|
|
667
|
+
peg$currPos = s0;
|
|
668
|
+
s0 = peg$FAILED;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
849
672
|
peg$currPos = s0;
|
|
850
673
|
s0 = peg$FAILED;
|
|
851
|
-
}
|
|
852
|
-
} else {
|
|
853
|
-
peg$currPos = s0;
|
|
854
|
-
s0 = peg$FAILED;
|
|
855
674
|
}
|
|
856
|
-
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
857
677
|
peg$currPos = s0;
|
|
858
678
|
s0 = peg$FAILED;
|
|
859
|
-
}
|
|
860
|
-
} else {
|
|
861
|
-
peg$currPos = s0;
|
|
862
|
-
s0 = peg$FAILED;
|
|
863
679
|
}
|
|
864
|
-
|
|
865
|
-
peg$currPos = s0;
|
|
866
|
-
s0 = peg$FAILED;
|
|
867
|
-
}
|
|
868
|
-
} else {
|
|
869
|
-
peg$currPos = s0;
|
|
870
|
-
s0 = peg$FAILED;
|
|
680
|
+
return s0;
|
|
871
681
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
s1 = [];
|
|
881
|
-
s2 = peg$parsews();
|
|
882
|
-
while (s2 !== peg$FAILED) {
|
|
883
|
-
s1.push(s2);
|
|
884
|
-
s2 = peg$parsews();
|
|
885
|
-
}
|
|
886
|
-
if (s1 !== peg$FAILED) {
|
|
887
|
-
s2 = peg$parseexpression();
|
|
888
|
-
if (s2 !== peg$FAILED) {
|
|
889
|
-
s3 = [];
|
|
890
|
-
s4 = peg$parsews();
|
|
891
|
-
while (s4 !== peg$FAILED) {
|
|
892
|
-
s3.push(s4);
|
|
893
|
-
s4 = peg$parsews();
|
|
682
|
+
function peg$parselistExpression() {
|
|
683
|
+
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
684
|
+
s0 = peg$currPos;
|
|
685
|
+
s1 = [];
|
|
686
|
+
s2 = peg$parsews();
|
|
687
|
+
while (s2 !== peg$FAILED) {
|
|
688
|
+
s1.push(s2);
|
|
689
|
+
s2 = peg$parsews();
|
|
894
690
|
}
|
|
895
|
-
if (
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
} else {
|
|
900
|
-
s4 = peg$FAILED;
|
|
901
|
-
if (peg$silentFails === 0) {
|
|
902
|
-
peg$fail(peg$c16);
|
|
691
|
+
if (s1 !== peg$FAILED) {
|
|
692
|
+
if (input.charCodeAt(peg$currPos) === 91) {
|
|
693
|
+
s2 = peg$c23;
|
|
694
|
+
peg$currPos++;
|
|
903
695
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
696
|
+
else {
|
|
697
|
+
s2 = peg$FAILED;
|
|
698
|
+
if (peg$silentFails === 0) {
|
|
699
|
+
peg$fail(peg$c24);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
if (s2 !== peg$FAILED) {
|
|
703
|
+
s3 = [];
|
|
704
|
+
s4 = peg$parselistExpressionItem();
|
|
705
|
+
while (s4 !== peg$FAILED) {
|
|
706
|
+
s3.push(s4);
|
|
707
|
+
s4 = peg$parselistExpressionItem();
|
|
708
|
+
}
|
|
709
|
+
if (s3 !== peg$FAILED) {
|
|
710
|
+
s4 = [];
|
|
711
|
+
s5 = peg$parsews();
|
|
712
|
+
while (s5 !== peg$FAILED) {
|
|
713
|
+
s4.push(s5);
|
|
714
|
+
s5 = peg$parsews();
|
|
715
|
+
}
|
|
716
|
+
if (s4 !== peg$FAILED) {
|
|
717
|
+
if (input.charCodeAt(peg$currPos) === 93) {
|
|
718
|
+
s5 = peg$c25;
|
|
719
|
+
peg$currPos++;
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
s5 = peg$FAILED;
|
|
723
|
+
if (peg$silentFails === 0) {
|
|
724
|
+
peg$fail(peg$c26);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
if (s5 !== peg$FAILED) {
|
|
728
|
+
s6 = [];
|
|
729
|
+
s7 = peg$parsews();
|
|
730
|
+
while (s7 !== peg$FAILED) {
|
|
731
|
+
s6.push(s7);
|
|
732
|
+
s7 = peg$parsews();
|
|
733
|
+
}
|
|
734
|
+
if (s6 !== peg$FAILED) {
|
|
735
|
+
peg$savedPos = s0;
|
|
736
|
+
s1 = peg$c27(s3);
|
|
737
|
+
s0 = s1;
|
|
738
|
+
}
|
|
739
|
+
else {
|
|
740
|
+
peg$currPos = s0;
|
|
741
|
+
s0 = peg$FAILED;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
peg$currPos = s0;
|
|
746
|
+
s0 = peg$FAILED;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
else {
|
|
750
|
+
peg$currPos = s0;
|
|
751
|
+
s0 = peg$FAILED;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
peg$currPos = s0;
|
|
756
|
+
s0 = peg$FAILED;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
else {
|
|
760
|
+
peg$currPos = s0;
|
|
761
|
+
s0 = peg$FAILED;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
913
765
|
peg$currPos = s0;
|
|
914
766
|
s0 = peg$FAILED;
|
|
915
|
-
}
|
|
916
|
-
} else {
|
|
917
|
-
peg$currPos = s0;
|
|
918
|
-
s0 = peg$FAILED;
|
|
919
767
|
}
|
|
920
|
-
|
|
921
|
-
peg$currPos = s0;
|
|
922
|
-
s0 = peg$FAILED;
|
|
923
|
-
}
|
|
924
|
-
} else {
|
|
925
|
-
peg$currPos = s0;
|
|
926
|
-
s0 = peg$FAILED;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
return s0;
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
function peg$parsesubExpression() {
|
|
933
|
-
var s0, s1, s2, s3, s4, s5, s6;
|
|
934
|
-
|
|
935
|
-
s0 = peg$currPos;
|
|
936
|
-
s1 = [];
|
|
937
|
-
s2 = peg$parsews();
|
|
938
|
-
while (s2 !== peg$FAILED) {
|
|
939
|
-
s1.push(s2);
|
|
940
|
-
s2 = peg$parsews();
|
|
768
|
+
return s0;
|
|
941
769
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
s2
|
|
948
|
-
|
|
949
|
-
|
|
770
|
+
function peg$parselistExpressionItem() {
|
|
771
|
+
var s0, s1, s2, s3, s4;
|
|
772
|
+
s0 = peg$currPos;
|
|
773
|
+
s1 = [];
|
|
774
|
+
s2 = peg$parsews();
|
|
775
|
+
while (s2 !== peg$FAILED) {
|
|
776
|
+
s1.push(s2);
|
|
777
|
+
s2 = peg$parsews();
|
|
778
|
+
}
|
|
779
|
+
if (s1 !== peg$FAILED) {
|
|
780
|
+
s2 = peg$parseexpression();
|
|
781
|
+
if (s2 !== peg$FAILED) {
|
|
782
|
+
s3 = [];
|
|
783
|
+
s4 = peg$parsews();
|
|
784
|
+
while (s4 !== peg$FAILED) {
|
|
785
|
+
s3.push(s4);
|
|
786
|
+
s4 = peg$parsews();
|
|
787
|
+
}
|
|
788
|
+
if (s3 !== peg$FAILED) {
|
|
789
|
+
if (input.charCodeAt(peg$currPos) === 44) {
|
|
790
|
+
s4 = peg$c15;
|
|
791
|
+
peg$currPos++;
|
|
792
|
+
}
|
|
793
|
+
else {
|
|
794
|
+
s4 = peg$FAILED;
|
|
795
|
+
if (peg$silentFails === 0) {
|
|
796
|
+
peg$fail(peg$c16);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
if (s4 === peg$FAILED) {
|
|
800
|
+
s4 = null;
|
|
801
|
+
}
|
|
802
|
+
if (s4 !== peg$FAILED) {
|
|
803
|
+
peg$savedPos = s0;
|
|
804
|
+
s1 = peg$c28(s2);
|
|
805
|
+
s0 = s1;
|
|
806
|
+
}
|
|
807
|
+
else {
|
|
808
|
+
peg$currPos = s0;
|
|
809
|
+
s0 = peg$FAILED;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
else {
|
|
813
|
+
peg$currPos = s0;
|
|
814
|
+
s0 = peg$FAILED;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
peg$currPos = s0;
|
|
819
|
+
s0 = peg$FAILED;
|
|
820
|
+
}
|
|
950
821
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
s4 = peg$parsews();
|
|
955
|
-
while (s4 !== peg$FAILED) {
|
|
956
|
-
s3.push(s4);
|
|
957
|
-
s4 = peg$parsews();
|
|
822
|
+
else {
|
|
823
|
+
peg$currPos = s0;
|
|
824
|
+
s0 = peg$FAILED;
|
|
958
825
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
826
|
+
return s0;
|
|
827
|
+
}
|
|
828
|
+
function peg$parsesubExpression() {
|
|
829
|
+
var s0, s1, s2, s3, s4, s5, s6;
|
|
830
|
+
s0 = peg$currPos;
|
|
831
|
+
s1 = [];
|
|
832
|
+
s2 = peg$parsews();
|
|
833
|
+
while (s2 !== peg$FAILED) {
|
|
834
|
+
s1.push(s2);
|
|
835
|
+
s2 = peg$parsews();
|
|
836
|
+
}
|
|
837
|
+
if (s1 !== peg$FAILED) {
|
|
838
|
+
if (input.charCodeAt(peg$currPos) === 46) {
|
|
839
|
+
s2 = peg$c20;
|
|
840
|
+
peg$currPos++;
|
|
967
841
|
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
peg$currPos = s0;
|
|
974
|
-
s0 = peg$FAILED;
|
|
842
|
+
else {
|
|
843
|
+
s2 = peg$FAILED;
|
|
844
|
+
if (peg$silentFails === 0) {
|
|
845
|
+
peg$fail(peg$c21);
|
|
846
|
+
}
|
|
975
847
|
}
|
|
976
|
-
|
|
848
|
+
if (s2 !== peg$FAILED) {
|
|
849
|
+
s3 = [];
|
|
850
|
+
s4 = peg$parsews();
|
|
851
|
+
while (s4 !== peg$FAILED) {
|
|
852
|
+
s3.push(s4);
|
|
853
|
+
s4 = peg$parsews();
|
|
854
|
+
}
|
|
855
|
+
if (s3 !== peg$FAILED) {
|
|
856
|
+
s4 = peg$parseexpression();
|
|
857
|
+
if (s4 !== peg$FAILED) {
|
|
858
|
+
s5 = [];
|
|
859
|
+
s6 = peg$parsews();
|
|
860
|
+
while (s6 !== peg$FAILED) {
|
|
861
|
+
s5.push(s6);
|
|
862
|
+
s6 = peg$parsews();
|
|
863
|
+
}
|
|
864
|
+
if (s5 !== peg$FAILED) {
|
|
865
|
+
peg$savedPos = s0;
|
|
866
|
+
s1 = peg$c29(s4);
|
|
867
|
+
s0 = s1;
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
peg$currPos = s0;
|
|
871
|
+
s0 = peg$FAILED;
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
peg$currPos = s0;
|
|
876
|
+
s0 = peg$FAILED;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
else {
|
|
880
|
+
peg$currPos = s0;
|
|
881
|
+
s0 = peg$FAILED;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
else {
|
|
885
|
+
peg$currPos = s0;
|
|
886
|
+
s0 = peg$FAILED;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
else {
|
|
977
890
|
peg$currPos = s0;
|
|
978
891
|
s0 = peg$FAILED;
|
|
979
|
-
}
|
|
980
|
-
} else {
|
|
981
|
-
peg$currPos = s0;
|
|
982
|
-
s0 = peg$FAILED;
|
|
983
892
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
893
|
+
return s0;
|
|
894
|
+
}
|
|
895
|
+
function assertDuplicateRelation(node, expr) {
|
|
896
|
+
if (expr.$name in node) {
|
|
897
|
+
console.warn(`Duplicate relation "${expr.$name}" in a relation expression. You should use "a.[b, c]" instead of "[a.b, a.c]". This will cause an error in objection 2.0`);
|
|
898
|
+
// TODO: enable for v2.0.
|
|
899
|
+
// const err = new Error();
|
|
900
|
+
// err.duplicateRelationName = expr.$name;
|
|
901
|
+
// throw err;
|
|
902
|
+
}
|
|
991
903
|
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
// TODO: enable for v2.0.
|
|
1003
|
-
// const err = new Error();
|
|
1004
|
-
// err.duplicateRelationName = expr.$name;
|
|
1005
|
-
// throw err;
|
|
904
|
+
function newNode() {
|
|
905
|
+
return {
|
|
906
|
+
$name: null,
|
|
907
|
+
$relation: null,
|
|
908
|
+
$modify: [],
|
|
909
|
+
$recursive: false,
|
|
910
|
+
$allRecursive: false,
|
|
911
|
+
$childNames: [],
|
|
912
|
+
};
|
|
1006
913
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
peg$result = peg$startRuleFunction();
|
|
1021
|
-
|
|
1022
|
-
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
|
1023
|
-
return peg$result;
|
|
1024
|
-
} else {
|
|
1025
|
-
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
1026
|
-
peg$fail(peg$endExpectation());
|
|
914
|
+
peg$result = peg$startRuleFunction();
|
|
915
|
+
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
|
916
|
+
return peg$result;
|
|
917
|
+
}
|
|
918
|
+
else {
|
|
919
|
+
if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
|
920
|
+
peg$fail(peg$endExpectation());
|
|
921
|
+
}
|
|
922
|
+
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length
|
|
923
|
+
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
|
924
|
+
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
|
|
1027
925
|
}
|
|
1028
|
-
|
|
1029
|
-
throw peg$buildStructuredError(
|
|
1030
|
-
peg$maxFailExpected,
|
|
1031
|
-
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
|
|
1032
|
-
peg$maxFailPos < input.length
|
|
1033
|
-
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
|
|
1034
|
-
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos),
|
|
1035
|
-
);
|
|
1036
|
-
}
|
|
1037
926
|
}
|
|
1038
|
-
|
|
1039
927
|
module.exports = {
|
|
1040
|
-
|
|
1041
|
-
|
|
928
|
+
SyntaxError: peg$SyntaxError,
|
|
929
|
+
parse: peg$parse,
|
|
1042
930
|
};
|