@jetstreamapp/soql-parser-js 6.1.0 → 6.2.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 +2 -3
- package/dist/cjs/index.js +143 -2
- package/dist/cli/index.js +148 -113
- package/dist/esm/index.js +143 -4
- package/dist/{cjs/src → types}/index.d.ts +1 -1
- package/package.json +12 -20
- package/dist/cjs/index.js.LICENSE.txt +0 -1
- package/dist/cjs/main.licenses.txt +0 -898
- package/dist/cjs/src/api/api-models.js +0 -2
- package/dist/cjs/src/api/public-utils.js +0 -175
- package/dist/cjs/src/composer/composer.js +0 -295
- package/dist/cjs/src/formatter/formatter.js +0 -236
- package/dist/cjs/src/index.js +0 -23
- package/dist/cjs/src/models.js +0 -2
- package/dist/cjs/src/parser/lexer.js +0 -954
- package/dist/cjs/src/parser/parser.js +0 -697
- package/dist/cjs/src/parser/visitor.js +0 -856
- package/dist/cjs/src/utils.js +0 -245
- package/dist/esm/api/api-models.js +0 -1
- package/dist/esm/api/public-utils.js +0 -153
- package/dist/esm/composer/composer.js +0 -273
- package/dist/esm/formatter/formatter.js +0 -223
- package/dist/esm/models.js +0 -1
- package/dist/esm/parser/lexer.js +0 -947
- package/dist/esm/parser/parser.js +0 -667
- package/dist/esm/parser/visitor.js +0 -823
- package/dist/esm/utils.js +0 -200
- package/dist/src/api/api-models.js +0 -2
- package/dist/src/api/public-utils.js +0 -203
- package/dist/src/composer/composer.js +0 -358
- package/dist/src/formatter/formatter.js +0 -263
- package/dist/src/index.js +0 -28
- package/dist/src/models.js +0 -2
- package/dist/src/parser/lexer.js +0 -997
- package/dist/src/parser/parser.js +0 -711
- package/dist/src/parser/visitor.js +0 -862
- package/dist/src/utils.js +0 -251
- /package/dist/{cjs/src → types}/api/api-models.d.ts +0 -0
- /package/dist/{cjs/src → types}/api/public-utils.d.ts +0 -0
- /package/dist/{cjs/src → types}/composer/composer.d.ts +0 -0
- /package/dist/{cjs/src → types}/formatter/formatter.d.ts +0 -0
- /package/dist/{cjs/src → types}/models.d.ts +0 -0
- /package/dist/{cjs/src → types}/parser/lexer.d.ts +0 -0
- /package/dist/{cjs/src → types}/parser/parser.d.ts +0 -0
- /package/dist/{cjs/src → types}/parser/visitor.d.ts +0 -0
- /package/dist/{cjs/src → types}/utils.d.ts +0 -0
|
@@ -1,667 +0,0 @@
|
|
|
1
|
-
import { CstParser } from 'chevrotain';
|
|
2
|
-
import * as lexer from './lexer';
|
|
3
|
-
class LexingError extends Error {
|
|
4
|
-
constructor(lexingError) {
|
|
5
|
-
super(`${lexingError.message} (${lexingError.line}:${lexingError.column})`);
|
|
6
|
-
this.name = 'LexingError';
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
class ParsingError extends Error {
|
|
10
|
-
constructor(parsingError) {
|
|
11
|
-
super(parsingError.message);
|
|
12
|
-
this.name = parsingError.name;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export class SoqlParser extends CstParser {
|
|
16
|
-
$_dateFunctionOr = undefined;
|
|
17
|
-
$_aggregateFunction = undefined;
|
|
18
|
-
$_otherFunction = undefined;
|
|
19
|
-
$_atomicExpression = undefined;
|
|
20
|
-
$_apexBindVariableExpression = undefined;
|
|
21
|
-
$_arrayExpression = undefined;
|
|
22
|
-
$_relationalOperator = undefined;
|
|
23
|
-
$_selectClause = undefined;
|
|
24
|
-
$_selectClauseFunctionIdentifier = undefined;
|
|
25
|
-
$_withDataCategoryArr = undefined;
|
|
26
|
-
allowApexBindVariables = false;
|
|
27
|
-
ignoreParseErrors = false;
|
|
28
|
-
constructor({ ignoreParseErrors } = { ignoreParseErrors: false }) {
|
|
29
|
-
super(lexer.allTokens, {
|
|
30
|
-
skipValidations: false,
|
|
31
|
-
recoveryEnabled: !!ignoreParseErrors,
|
|
32
|
-
});
|
|
33
|
-
this.ignoreParseErrors = !!ignoreParseErrors;
|
|
34
|
-
this.performSelfAnalysis();
|
|
35
|
-
}
|
|
36
|
-
selectStatement = this.RULE('selectStatement', () => {
|
|
37
|
-
this.SUBRULE(this.selectClause);
|
|
38
|
-
this.SUBRULE(this.fromClause);
|
|
39
|
-
this.SUBRULE(this.clauseStatements);
|
|
40
|
-
});
|
|
41
|
-
selectStatementPartial = this.RULE('selectStatementPartial', () => {
|
|
42
|
-
this.OPTION(() => {
|
|
43
|
-
this.SUBRULE(this.selectClause);
|
|
44
|
-
});
|
|
45
|
-
this.OPTION1(() => {
|
|
46
|
-
this.SUBRULE(this.fromClause);
|
|
47
|
-
});
|
|
48
|
-
this.SUBRULE(this.clauseStatements);
|
|
49
|
-
});
|
|
50
|
-
clauseStatements = this.RULE('clauseStatements', () => {
|
|
51
|
-
this.OPTION(() => {
|
|
52
|
-
this.SUBRULE(this.usingScopeClause);
|
|
53
|
-
});
|
|
54
|
-
this.OPTION1(() => {
|
|
55
|
-
this.SUBRULE(this.whereClause);
|
|
56
|
-
});
|
|
57
|
-
this.OPTION2(() => {
|
|
58
|
-
this.MANY({
|
|
59
|
-
DEF: () => {
|
|
60
|
-
this.SUBRULE(this.withClause);
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
this.OPTION3(() => {
|
|
65
|
-
this.SUBRULE(this.groupByClause);
|
|
66
|
-
this.OPTION4(() => {
|
|
67
|
-
this.SUBRULE(this.havingClause);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
this.OPTION5(() => {
|
|
71
|
-
this.SUBRULE(this.orderByClause);
|
|
72
|
-
});
|
|
73
|
-
this.OPTION6(() => {
|
|
74
|
-
this.SUBRULE(this.limitClause);
|
|
75
|
-
});
|
|
76
|
-
this.OPTION7(() => {
|
|
77
|
-
this.SUBRULE(this.offsetClause);
|
|
78
|
-
});
|
|
79
|
-
this.OPTION8(() => {
|
|
80
|
-
this.SUBRULE(this.forViewOrReference);
|
|
81
|
-
});
|
|
82
|
-
this.OPTION9(() => {
|
|
83
|
-
this.SUBRULE(this.updateTrackingViewstat);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
$_checkBalancedParens(parenCount) {
|
|
87
|
-
if (!this.RECORDING_PHASE && parenCount) {
|
|
88
|
-
const parenMatch = parenCount.left - parenCount.right;
|
|
89
|
-
if (parenMatch !== 0) {
|
|
90
|
-
this.CONSUME(lexer.RParenMismatch, { ERR_MSG: `Expecting a token type of --> RParen <-- but found --> '' <--` });
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
selectClause = this.RULE('selectClause', () => {
|
|
95
|
-
this.CONSUME(lexer.Select);
|
|
96
|
-
this.AT_LEAST_ONE_SEP({
|
|
97
|
-
SEP: lexer.Comma,
|
|
98
|
-
DEF: () => {
|
|
99
|
-
this.OR(this.$_selectClause ||
|
|
100
|
-
(this.$_selectClause = [
|
|
101
|
-
{ ALT: () => this.SUBRULE(this.selectClauseFunctionIdentifier, { LABEL: 'field' }) },
|
|
102
|
-
{ ALT: () => this.SUBRULE(this.selectClauseSubqueryIdentifier, { LABEL: 'field' }) },
|
|
103
|
-
{ ALT: () => this.SUBRULE(this.selectClauseTypeOf, { LABEL: 'field' }) },
|
|
104
|
-
{ ALT: () => this.SUBRULE(this.selectClauseIdentifier, { LABEL: 'field' }) },
|
|
105
|
-
]));
|
|
106
|
-
},
|
|
107
|
-
});
|
|
108
|
-
}, { resyncEnabled: false });
|
|
109
|
-
selectClauseFunctionIdentifier = this.RULE('selectClauseFunctionIdentifier', () => {
|
|
110
|
-
this.OR(this.$_selectClauseFunctionIdentifier ||
|
|
111
|
-
(this.$_selectClauseFunctionIdentifier = [
|
|
112
|
-
{ ALT: () => this.SUBRULE(this.dateFunction, { LABEL: 'fn' }) },
|
|
113
|
-
{ ALT: () => this.SUBRULE(this.aggregateFunction, { LABEL: 'fn' }) },
|
|
114
|
-
{ ALT: () => this.SUBRULE(this.locationFunction, { LABEL: 'fn' }) },
|
|
115
|
-
{ ALT: () => this.SUBRULE(this.fieldsFunction, { LABEL: 'fn' }) },
|
|
116
|
-
{ ALT: () => this.SUBRULE(this.otherFunction, { LABEL: 'fn' }) },
|
|
117
|
-
]));
|
|
118
|
-
this.OPTION(() => this.CONSUME(lexer.Identifier, { LABEL: 'alias' }));
|
|
119
|
-
}, { resyncEnabled: false });
|
|
120
|
-
selectClauseSubqueryIdentifier = this.RULE('selectClauseSubqueryIdentifier', () => {
|
|
121
|
-
this.CONSUME(lexer.LParen);
|
|
122
|
-
this.SUBRULE(this.selectStatement);
|
|
123
|
-
this.CONSUME(lexer.RParen);
|
|
124
|
-
}, { resyncEnabled: false });
|
|
125
|
-
selectClauseTypeOf = this.RULE('selectClauseTypeOf', () => {
|
|
126
|
-
this.CONSUME(lexer.Typeof);
|
|
127
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'typeOfField' });
|
|
128
|
-
this.AT_LEAST_ONE({
|
|
129
|
-
DEF: () => {
|
|
130
|
-
this.SUBRULE(this.selectClauseTypeOfThen);
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
this.OPTION(() => {
|
|
134
|
-
this.SUBRULE(this.selectClauseTypeOfElse);
|
|
135
|
-
});
|
|
136
|
-
this.CONSUME(lexer.End);
|
|
137
|
-
}, { resyncEnabled: false });
|
|
138
|
-
selectClauseIdentifier = this.RULE('selectClauseIdentifier', () => {
|
|
139
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'field' });
|
|
140
|
-
this.OPTION(() => this.CONSUME1(lexer.Identifier, { LABEL: 'alias' }));
|
|
141
|
-
}, { resyncEnabled: false });
|
|
142
|
-
selectClauseTypeOfThen = this.RULE('selectClauseTypeOfThen', () => {
|
|
143
|
-
this.CONSUME(lexer.When);
|
|
144
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'typeOfField' });
|
|
145
|
-
this.CONSUME(lexer.Then);
|
|
146
|
-
this.AT_LEAST_ONE_SEP({
|
|
147
|
-
SEP: lexer.Comma,
|
|
148
|
-
DEF: () => {
|
|
149
|
-
this.CONSUME1(lexer.Identifier, { LABEL: 'field' });
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
}, { resyncEnabled: false });
|
|
153
|
-
selectClauseTypeOfElse = this.RULE('selectClauseTypeOfElse', () => {
|
|
154
|
-
this.CONSUME(lexer.Else);
|
|
155
|
-
this.AT_LEAST_ONE_SEP({
|
|
156
|
-
SEP: lexer.Comma,
|
|
157
|
-
DEF: () => {
|
|
158
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'field' });
|
|
159
|
-
},
|
|
160
|
-
});
|
|
161
|
-
}, { resyncEnabled: false });
|
|
162
|
-
fromClause = this.RULE('fromClause', () => {
|
|
163
|
-
this.CONSUME(lexer.From);
|
|
164
|
-
this.CONSUME(lexer.Identifier);
|
|
165
|
-
this.OPTION({
|
|
166
|
-
GATE: () => !(this.LA(1).tokenType === lexer.Offset && this.LA(2).tokenType === lexer.UnsignedInteger),
|
|
167
|
-
DEF: () => this.CONSUME1(lexer.Identifier, { LABEL: 'alias' }),
|
|
168
|
-
});
|
|
169
|
-
}, { resyncEnabled: false });
|
|
170
|
-
usingScopeClause = this.RULE('usingScopeClause', () => {
|
|
171
|
-
this.CONSUME(lexer.Using);
|
|
172
|
-
this.CONSUME(lexer.Scope);
|
|
173
|
-
this.CONSUME(lexer.UsingScopeEnumeration);
|
|
174
|
-
});
|
|
175
|
-
whereClause = this.RULE('whereClause', () => {
|
|
176
|
-
this.CONSUME(lexer.Where);
|
|
177
|
-
const parenCount = this.getParenCount();
|
|
178
|
-
this.AT_LEAST_ONE({
|
|
179
|
-
DEF: () => {
|
|
180
|
-
this.SUBRULE(this.conditionExpression, { ARGS: [parenCount, true, true] });
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
|
-
this.$_checkBalancedParens(parenCount);
|
|
184
|
-
});
|
|
185
|
-
whereClauseSubqueryIdentifier = this.RULE('whereClauseSubqueryIdentifier', () => {
|
|
186
|
-
this.CONSUME(lexer.LParen);
|
|
187
|
-
this.SUBRULE(this.selectStatement);
|
|
188
|
-
this.CONSUME(lexer.RParen);
|
|
189
|
-
});
|
|
190
|
-
conditionExpression = this.RULE('conditionExpression', (parenCount, allowAggregateFn, allowLocationFn) => {
|
|
191
|
-
parenCount = this.getParenCount(parenCount);
|
|
192
|
-
this.OPTION(() => {
|
|
193
|
-
this.OR([
|
|
194
|
-
{ ALT: () => this.CONSUME(lexer.And, { LABEL: 'logicalOperator' }) },
|
|
195
|
-
{ ALT: () => this.CONSUME(lexer.Or, { LABEL: 'logicalOperator' }) },
|
|
196
|
-
]);
|
|
197
|
-
});
|
|
198
|
-
this.MANY({
|
|
199
|
-
MAX_LOOKAHEAD: 10,
|
|
200
|
-
DEF: () => this.SUBRULE(this.expressionPartWithNegation, { ARGS: [parenCount], LABEL: 'expressionNegation' }),
|
|
201
|
-
});
|
|
202
|
-
this.OR1({
|
|
203
|
-
MAX_LOOKAHEAD: 10,
|
|
204
|
-
DEF: [{ ALT: () => this.SUBRULE(this.expression, { ARGS: [parenCount, false, allowAggregateFn, allowLocationFn] }) }],
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
withClause = this.RULE('withClause', () => {
|
|
208
|
-
this.CONSUME(lexer.With);
|
|
209
|
-
this.OR([
|
|
210
|
-
{ ALT: () => this.CONSUME(lexer.SecurityEnforced, { LABEL: 'withSecurityEnforced' }) },
|
|
211
|
-
{ ALT: () => this.CONSUME(lexer.UserMode, { LABEL: 'withAccessLevel' }) },
|
|
212
|
-
{ ALT: () => this.CONSUME(lexer.SystemMode, { LABEL: 'withAccessLevel' }) },
|
|
213
|
-
{ ALT: () => this.SUBRULE(this.withDataCategory) },
|
|
214
|
-
]);
|
|
215
|
-
});
|
|
216
|
-
withDataCategory = this.RULE('withDataCategory', () => {
|
|
217
|
-
this.CONSUME(lexer.DataCategory);
|
|
218
|
-
this.AT_LEAST_ONE_SEP({
|
|
219
|
-
SEP: lexer.And,
|
|
220
|
-
DEF: () => {
|
|
221
|
-
this.SUBRULE(this.withDataCategoryArr);
|
|
222
|
-
},
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
withDataCategoryArr = this.RULE('withDataCategoryArr', () => {
|
|
226
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'dataCategoryGroupName' });
|
|
227
|
-
this.OR(this.$_withDataCategoryArr ||
|
|
228
|
-
(this.$_withDataCategoryArr = [
|
|
229
|
-
{ ALT: () => this.CONSUME(lexer.At, { LABEL: 'filteringSelector' }) },
|
|
230
|
-
{ ALT: () => this.CONSUME(lexer.Above, { LABEL: 'filteringSelector' }) },
|
|
231
|
-
{ ALT: () => this.CONSUME(lexer.Below, { LABEL: 'filteringSelector' }) },
|
|
232
|
-
{ ALT: () => this.CONSUME(lexer.AboveOrBelow, { LABEL: 'filteringSelector' }) },
|
|
233
|
-
]));
|
|
234
|
-
this.OPTION(() => {
|
|
235
|
-
this.CONSUME1(lexer.LParen);
|
|
236
|
-
});
|
|
237
|
-
this.AT_LEAST_ONE_SEP1({
|
|
238
|
-
SEP: lexer.Comma,
|
|
239
|
-
DEF: () => {
|
|
240
|
-
this.CONSUME1(lexer.Identifier, { LABEL: 'dataCategoryName' });
|
|
241
|
-
},
|
|
242
|
-
});
|
|
243
|
-
this.OPTION1(() => {
|
|
244
|
-
this.CONSUME2(lexer.RParen);
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
groupByClause = this.RULE('groupByClause', () => {
|
|
248
|
-
this.CONSUME(lexer.GroupBy);
|
|
249
|
-
this.AT_LEAST_ONE_SEP({
|
|
250
|
-
SEP: lexer.Comma,
|
|
251
|
-
DEF: () => {
|
|
252
|
-
this.OR([
|
|
253
|
-
{ ALT: () => this.SUBRULE(this.cubeFunction, { LABEL: 'groupBy' }) },
|
|
254
|
-
{ ALT: () => this.SUBRULE(this.rollupFunction, { LABEL: 'groupBy' }) },
|
|
255
|
-
{ ALT: () => this.SUBRULE(this.dateFunction, { LABEL: 'groupBy' }) },
|
|
256
|
-
{ ALT: () => this.CONSUME(lexer.Identifier, { LABEL: 'groupBy' }) },
|
|
257
|
-
]);
|
|
258
|
-
},
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
havingClause = this.RULE('havingClause', () => {
|
|
262
|
-
this.CONSUME(lexer.Having);
|
|
263
|
-
const parenCount = this.getParenCount();
|
|
264
|
-
this.AT_LEAST_ONE({
|
|
265
|
-
DEF: () => {
|
|
266
|
-
this.SUBRULE(this.conditionExpression, { ARGS: [parenCount, true, false] });
|
|
267
|
-
},
|
|
268
|
-
});
|
|
269
|
-
this.$_checkBalancedParens(parenCount);
|
|
270
|
-
});
|
|
271
|
-
orderByClause = this.RULE('orderByClause', () => {
|
|
272
|
-
this.CONSUME(lexer.OrderBy);
|
|
273
|
-
this.AT_LEAST_ONE_SEP({
|
|
274
|
-
SEP: lexer.Comma,
|
|
275
|
-
DEF: () => {
|
|
276
|
-
this.OR([
|
|
277
|
-
{ ALT: () => this.SUBRULE(this.orderByGroupingFunctionExpression, { LABEL: 'orderByExpressionOrFn' }) },
|
|
278
|
-
{ ALT: () => this.SUBRULE(this.orderBySpecialFunctionExpression, { LABEL: 'orderByExpressionOrFn' }) },
|
|
279
|
-
{ ALT: () => this.SUBRULE(this.orderByExpression, { LABEL: 'orderByExpressionOrFn' }) },
|
|
280
|
-
]);
|
|
281
|
-
},
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
orderByExpression = this.RULE('orderByExpression', () => {
|
|
285
|
-
this.CONSUME(lexer.Identifier);
|
|
286
|
-
this.OPTION(() => {
|
|
287
|
-
this.OR([{ ALT: () => this.CONSUME(lexer.Asc, { LABEL: 'order' }) }, { ALT: () => this.CONSUME(lexer.Desc, { LABEL: 'order' }) }]);
|
|
288
|
-
});
|
|
289
|
-
this.OPTION1(() => {
|
|
290
|
-
this.CONSUME(lexer.Nulls);
|
|
291
|
-
this.OR1([{ ALT: () => this.CONSUME(lexer.First, { LABEL: 'nulls' }) }, { ALT: () => this.CONSUME(lexer.Last, { LABEL: 'nulls' }) }]);
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
orderByGroupingFunctionExpression = this.RULE('orderByGroupingFunctionExpression', () => {
|
|
295
|
-
this.CONSUME(lexer.Grouping, { LABEL: 'fn' });
|
|
296
|
-
this.SUBRULE(this.functionExpression);
|
|
297
|
-
});
|
|
298
|
-
orderBySpecialFunctionExpression = this.RULE('orderBySpecialFunctionExpression', () => {
|
|
299
|
-
this.OR([
|
|
300
|
-
{ ALT: () => this.SUBRULE(this.aggregateFunction) },
|
|
301
|
-
{ ALT: () => this.SUBRULE(this.dateFunction) },
|
|
302
|
-
{ ALT: () => this.SUBRULE(this.locationFunction) },
|
|
303
|
-
]);
|
|
304
|
-
this.OPTION(() => {
|
|
305
|
-
this.OR1([{ ALT: () => this.CONSUME(lexer.Asc, { LABEL: 'order' }) }, { ALT: () => this.CONSUME(lexer.Desc, { LABEL: 'order' }) }]);
|
|
306
|
-
});
|
|
307
|
-
this.OPTION1(() => {
|
|
308
|
-
this.CONSUME(lexer.Nulls);
|
|
309
|
-
this.OR2([{ ALT: () => this.CONSUME(lexer.First, { LABEL: 'nulls' }) }, { ALT: () => this.CONSUME(lexer.Last, { LABEL: 'nulls' }) }]);
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
limitClause = this.RULE('limitClause', () => {
|
|
313
|
-
this.CONSUME(lexer.Limit);
|
|
314
|
-
this.CONSUME(lexer.UnsignedInteger, { LABEL: 'value' });
|
|
315
|
-
});
|
|
316
|
-
offsetClause = this.RULE('offsetClause', () => {
|
|
317
|
-
this.CONSUME(lexer.Offset);
|
|
318
|
-
this.CONSUME(lexer.UnsignedInteger, { LABEL: 'value' });
|
|
319
|
-
});
|
|
320
|
-
dateFunction = this.RULE('dateFunction', () => {
|
|
321
|
-
this.OR(this.$_dateFunctionOr ||
|
|
322
|
-
(this.$_dateFunctionOr = [
|
|
323
|
-
{ ALT: () => this.CONSUME(lexer.CalendarMonth, { LABEL: 'fn' }) },
|
|
324
|
-
{ ALT: () => this.CONSUME(lexer.CalendarQuarter, { LABEL: 'fn' }) },
|
|
325
|
-
{ ALT: () => this.CONSUME(lexer.CalendarYear, { LABEL: 'fn' }) },
|
|
326
|
-
{ ALT: () => this.CONSUME(lexer.DayInMonth, { LABEL: 'fn' }) },
|
|
327
|
-
{ ALT: () => this.CONSUME(lexer.DayInWeek, { LABEL: 'fn' }) },
|
|
328
|
-
{ ALT: () => this.CONSUME(lexer.DayInYear, { LABEL: 'fn' }) },
|
|
329
|
-
{ ALT: () => this.CONSUME(lexer.DayOnly, { LABEL: 'fn' }) },
|
|
330
|
-
{ ALT: () => this.CONSUME(lexer.FiscalMonth, { LABEL: 'fn' }) },
|
|
331
|
-
{ ALT: () => this.CONSUME(lexer.FiscalQuarter, { LABEL: 'fn' }) },
|
|
332
|
-
{ ALT: () => this.CONSUME(lexer.FiscalYear, { LABEL: 'fn' }) },
|
|
333
|
-
{ ALT: () => this.CONSUME(lexer.HourInDay, { LABEL: 'fn' }) },
|
|
334
|
-
{ ALT: () => this.CONSUME(lexer.WeekInMonth, { LABEL: 'fn' }) },
|
|
335
|
-
{ ALT: () => this.CONSUME(lexer.WeekInYear, { LABEL: 'fn' }) },
|
|
336
|
-
]));
|
|
337
|
-
this.SUBRULE(this.functionExpression);
|
|
338
|
-
});
|
|
339
|
-
aggregateFunction = this.RULE('aggregateFunction', () => {
|
|
340
|
-
this.OR(this.$_aggregateFunction ||
|
|
341
|
-
(this.$_aggregateFunction = [
|
|
342
|
-
{ ALT: () => this.CONSUME(lexer.Avg, { LABEL: 'fn' }) },
|
|
343
|
-
{ ALT: () => this.CONSUME(lexer.Count, { LABEL: 'fn' }) },
|
|
344
|
-
{ ALT: () => this.CONSUME(lexer.CountDistinct, { LABEL: 'fn' }) },
|
|
345
|
-
{ ALT: () => this.CONSUME(lexer.Min, { LABEL: 'fn' }) },
|
|
346
|
-
{ ALT: () => this.CONSUME(lexer.Max, { LABEL: 'fn' }) },
|
|
347
|
-
{ ALT: () => this.CONSUME(lexer.Sum, { LABEL: 'fn' }) },
|
|
348
|
-
]));
|
|
349
|
-
this.SUBRULE(this.functionExpression, { ARGS: [true] });
|
|
350
|
-
});
|
|
351
|
-
fieldsFunction = this.RULE('fieldsFunction', () => {
|
|
352
|
-
this.CONSUME(lexer.Fields, { LABEL: 'fn' });
|
|
353
|
-
this.CONSUME(lexer.LParen);
|
|
354
|
-
this.CONSUME(lexer.FieldsFunctionParamIdentifier, { LABEL: 'params' });
|
|
355
|
-
this.CONSUME(lexer.RParen);
|
|
356
|
-
});
|
|
357
|
-
otherFunction = this.RULE('otherFunction', () => {
|
|
358
|
-
this.OR(this.$_otherFunction ||
|
|
359
|
-
(this.$_otherFunction = [
|
|
360
|
-
{ ALT: () => this.CONSUME(lexer.Format, { LABEL: 'fn' }) },
|
|
361
|
-
{ ALT: () => this.CONSUME(lexer.Tolabel, { LABEL: 'fn' }) },
|
|
362
|
-
{ ALT: () => this.CONSUME(lexer.ConvertTimeZone, { LABEL: 'fn' }) },
|
|
363
|
-
{ ALT: () => this.CONSUME(lexer.ConvertCurrency, { LABEL: 'fn' }) },
|
|
364
|
-
{ ALT: () => this.CONSUME(lexer.Grouping, { LABEL: 'fn' }) },
|
|
365
|
-
]));
|
|
366
|
-
this.SUBRULE(this.functionExpression);
|
|
367
|
-
});
|
|
368
|
-
cubeFunction = this.RULE('cubeFunction', () => {
|
|
369
|
-
this.CONSUME(lexer.Cube, { LABEL: 'fn' });
|
|
370
|
-
this.SUBRULE(this.functionExpression);
|
|
371
|
-
});
|
|
372
|
-
rollupFunction = this.RULE('rollupFunction', () => {
|
|
373
|
-
this.CONSUME(lexer.Rollup, { LABEL: 'fn' });
|
|
374
|
-
this.SUBRULE(this.functionExpression);
|
|
375
|
-
});
|
|
376
|
-
functionExpression = this.RULE('functionExpression', (skipAggregate) => {
|
|
377
|
-
this.CONSUME(lexer.LParen);
|
|
378
|
-
this.MANY_SEP({
|
|
379
|
-
SEP: lexer.Comma,
|
|
380
|
-
DEF: () => {
|
|
381
|
-
this.OR([
|
|
382
|
-
{ GATE: () => !skipAggregate, ALT: () => this.SUBRULE(this.aggregateFunction, { LABEL: 'params' }) },
|
|
383
|
-
{ ALT: () => this.SUBRULE(this.otherFunction, { LABEL: 'params' }) },
|
|
384
|
-
{ ALT: () => this.CONSUME(lexer.StringIdentifier, { LABEL: 'params' }) },
|
|
385
|
-
{ ALT: () => this.CONSUME(lexer.NumberIdentifier, { LABEL: 'params' }) },
|
|
386
|
-
{ ALT: () => this.CONSUME(lexer.Identifier, { LABEL: 'params' }) },
|
|
387
|
-
]);
|
|
388
|
-
},
|
|
389
|
-
});
|
|
390
|
-
this.CONSUME(lexer.RParen);
|
|
391
|
-
});
|
|
392
|
-
locationFunction = this.RULE('locationFunction', () => {
|
|
393
|
-
this.CONSUME(lexer.Distance);
|
|
394
|
-
this.CONSUME(lexer.LParen);
|
|
395
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'location1' });
|
|
396
|
-
this.CONSUME(lexer.Comma);
|
|
397
|
-
this.OR([
|
|
398
|
-
{ ALT: () => this.SUBRULE(this.geolocationFunction, { LABEL: 'location2' }) },
|
|
399
|
-
{ ALT: () => this.CONSUME1(lexer.Identifier, { LABEL: 'location2' }) },
|
|
400
|
-
]);
|
|
401
|
-
this.CONSUME1(lexer.Comma);
|
|
402
|
-
this.CONSUME(lexer.GeolocationUnit, { LABEL: 'unit' });
|
|
403
|
-
this.CONSUME(lexer.RParen);
|
|
404
|
-
});
|
|
405
|
-
geolocationFunction = this.RULE('geolocationFunction', () => {
|
|
406
|
-
this.CONSUME(lexer.Geolocation);
|
|
407
|
-
this.CONSUME(lexer.LParen);
|
|
408
|
-
this.CONSUME(lexer.NumberIdentifier, { LABEL: 'latitude' });
|
|
409
|
-
this.CONSUME(lexer.Comma);
|
|
410
|
-
this.CONSUME1(lexer.NumberIdentifier, { LABEL: 'longitude' });
|
|
411
|
-
this.CONSUME(lexer.RParen);
|
|
412
|
-
});
|
|
413
|
-
expressionPartWithNegation = this.RULE('expressionPartWithNegation', (parenCount) => {
|
|
414
|
-
let leftParenCount = 0;
|
|
415
|
-
this.MANY(() => {
|
|
416
|
-
this.CONSUME(lexer.LParen);
|
|
417
|
-
leftParenCount++;
|
|
418
|
-
});
|
|
419
|
-
this.CONSUME(lexer.Not, { LABEL: 'expressionNegation' });
|
|
420
|
-
if (parenCount && leftParenCount) {
|
|
421
|
-
parenCount.left += leftParenCount;
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
expression = this.RULE('expression', (parenCount, allowSubquery, allowAggregateFn, allowLocationFn) => {
|
|
425
|
-
this.OPTION1(() => {
|
|
426
|
-
this.MANY1(() => {
|
|
427
|
-
this.CONSUME(lexer.LParen);
|
|
428
|
-
if (parenCount) {
|
|
429
|
-
parenCount.left++;
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
});
|
|
433
|
-
this.OR1([
|
|
434
|
-
{ GATE: () => !!allowAggregateFn, ALT: () => this.SUBRULE(this.aggregateFunction, { LABEL: 'lhs' }) },
|
|
435
|
-
{ GATE: () => !!allowLocationFn, ALT: () => this.SUBRULE(this.locationFunction, { LABEL: 'lhs' }) },
|
|
436
|
-
{ ALT: () => this.SUBRULE(this.dateFunction, { LABEL: 'lhs' }) },
|
|
437
|
-
{ ALT: () => this.SUBRULE(this.otherFunction, { LABEL: 'lhs' }) },
|
|
438
|
-
{ ALT: () => this.CONSUME(lexer.Identifier, { LABEL: 'lhs' }) },
|
|
439
|
-
]);
|
|
440
|
-
this.OR2([
|
|
441
|
-
{ ALT: () => this.SUBRULE(this.expressionWithRelationalOperator, { LABEL: 'operator' }) },
|
|
442
|
-
{ ALT: () => this.SUBRULE(this.expressionWithSetOperator, { LABEL: 'operator', ARGS: [allowSubquery] }) },
|
|
443
|
-
]);
|
|
444
|
-
this.OPTION3(() => {
|
|
445
|
-
this.MANY2({
|
|
446
|
-
GATE: () => (parenCount ? parenCount.left > parenCount.right : true),
|
|
447
|
-
DEF: () => {
|
|
448
|
-
this.CONSUME(lexer.RParen);
|
|
449
|
-
if (parenCount) {
|
|
450
|
-
parenCount.right++;
|
|
451
|
-
}
|
|
452
|
-
},
|
|
453
|
-
});
|
|
454
|
-
});
|
|
455
|
-
});
|
|
456
|
-
expressionWithRelationalOperator = this.RULE('expressionWithRelationalOperator', () => {
|
|
457
|
-
this.SUBRULE(this.relationalOperator);
|
|
458
|
-
this.SUBRULE(this.atomicExpression, { LABEL: 'rhs' });
|
|
459
|
-
});
|
|
460
|
-
expressionWithSetOperator = this.RULE('expressionWithSetOperator', (allowSubquery) => {
|
|
461
|
-
this.SUBRULE(this.setOperator);
|
|
462
|
-
this.SUBRULE2(this.atomicExpression, { LABEL: 'rhs', ARGS: [true, allowSubquery] });
|
|
463
|
-
});
|
|
464
|
-
atomicExpression = this.RULE('atomicExpression', (isArray, allowSubquery) => {
|
|
465
|
-
this.OR(this.$_atomicExpression ||
|
|
466
|
-
(this.$_atomicExpression = [
|
|
467
|
-
{ GATE: () => this.allowApexBindVariables, ALT: () => this.SUBRULE(this.apexBindVariableExpression) },
|
|
468
|
-
{ GATE: () => isArray, ALT: () => this.SUBRULE(this.arrayExpression) },
|
|
469
|
-
{ GATE: () => isArray && allowSubquery, ALT: () => this.SUBRULE(this.whereClauseSubqueryIdentifier) },
|
|
470
|
-
{ GATE: () => !isArray, ALT: () => this.CONSUME(lexer.DateIdentifier) },
|
|
471
|
-
{ GATE: () => !isArray, ALT: () => this.CONSUME(lexer.CurrencyPrefixedDecimal, { LABEL: 'CurrencyPrefixedDecimal' }) },
|
|
472
|
-
{ GATE: () => !isArray, ALT: () => this.CONSUME(lexer.CurrencyPrefixedInteger, { LABEL: 'CurrencyPrefixedInteger' }) },
|
|
473
|
-
{ GATE: () => !isArray, ALT: () => this.CONSUME(lexer.NumberIdentifier) },
|
|
474
|
-
{ GATE: () => !isArray, ALT: () => this.CONSUME(lexer.Null) },
|
|
475
|
-
{ GATE: () => !isArray, ALT: () => this.SUBRULE(this.booleanValue) },
|
|
476
|
-
{ GATE: () => !isArray, ALT: () => this.CONSUME(lexer.DateLiteral) },
|
|
477
|
-
{ GATE: () => !isArray, ALT: () => this.SUBRULE(this.dateNLiteral) },
|
|
478
|
-
{ GATE: () => !isArray, ALT: () => this.CONSUME(lexer.GeolocationUnit, { LABEL: 'StringIdentifier' }) },
|
|
479
|
-
{ GATE: () => !isArray, ALT: () => this.CONSUME(lexer.StringIdentifier) },
|
|
480
|
-
]));
|
|
481
|
-
});
|
|
482
|
-
apexBindVariableExpression = this.RULE('apexBindVariableExpression', () => {
|
|
483
|
-
this.CONSUME(lexer.Colon);
|
|
484
|
-
this.OPTION(() => {
|
|
485
|
-
this.SUBRULE(this.apexBindVariableNewInstantiation, { LABEL: 'apex' });
|
|
486
|
-
this.OPTION1(() => {
|
|
487
|
-
this.CONSUME(lexer.Decimal);
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
this.MANY_SEP({
|
|
491
|
-
SEP: lexer.Decimal,
|
|
492
|
-
DEF: () => {
|
|
493
|
-
this.OR(this.$_apexBindVariableExpression ||
|
|
494
|
-
(this.$_apexBindVariableExpression = [
|
|
495
|
-
{ ALT: () => this.SUBRULE(this.apexBindVariableFunctionCall, { LABEL: 'apex' }) },
|
|
496
|
-
{ ALT: () => this.SUBRULE(this.apexBindVariableIdentifier, { LABEL: 'apex' }) },
|
|
497
|
-
]));
|
|
498
|
-
},
|
|
499
|
-
});
|
|
500
|
-
});
|
|
501
|
-
apexBindVariableIdentifier = this.RULE('apexBindVariableIdentifier', () => {
|
|
502
|
-
this.CONSUME(lexer.Identifier);
|
|
503
|
-
this.OPTION(() => this.SUBRULE(this.apexBindVariableFunctionArrayAccessor));
|
|
504
|
-
});
|
|
505
|
-
apexBindVariableNewInstantiation = this.RULE('apexBindVariableNewInstantiation', () => {
|
|
506
|
-
this.CONSUME(lexer.ApexNew, { LABEL: 'new' });
|
|
507
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'function' });
|
|
508
|
-
this.OPTION(() => {
|
|
509
|
-
this.SUBRULE(this.apexBindVariableGeneric);
|
|
510
|
-
});
|
|
511
|
-
this.SUBRULE(this.apexBindVariableFunctionParams);
|
|
512
|
-
this.OPTION1(() => this.SUBRULE(this.apexBindVariableFunctionArrayAccessor));
|
|
513
|
-
});
|
|
514
|
-
apexBindVariableFunctionCall = this.RULE('apexBindVariableFunctionCall', () => {
|
|
515
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'function' });
|
|
516
|
-
this.SUBRULE(this.apexBindVariableFunctionParams);
|
|
517
|
-
this.OPTION(() => this.SUBRULE(this.apexBindVariableFunctionArrayAccessor));
|
|
518
|
-
});
|
|
519
|
-
apexBindVariableGeneric = this.RULE('apexBindVariableGeneric', () => {
|
|
520
|
-
this.CONSUME(lexer.LessThan);
|
|
521
|
-
this.AT_LEAST_ONE_SEP({
|
|
522
|
-
SEP: lexer.Comma,
|
|
523
|
-
DEF: () => {
|
|
524
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'parameter' });
|
|
525
|
-
},
|
|
526
|
-
});
|
|
527
|
-
this.CONSUME(lexer.GreaterThan);
|
|
528
|
-
});
|
|
529
|
-
apexBindVariableFunctionParams = this.RULE('apexBindVariableFunctionParams', () => {
|
|
530
|
-
this.CONSUME(lexer.LParen);
|
|
531
|
-
this.MANY_SEP({
|
|
532
|
-
SEP: lexer.Comma,
|
|
533
|
-
DEF: () => {
|
|
534
|
-
this.CONSUME(lexer.Identifier, { LABEL: 'parameter' });
|
|
535
|
-
},
|
|
536
|
-
});
|
|
537
|
-
this.CONSUME(lexer.RParen);
|
|
538
|
-
});
|
|
539
|
-
apexBindVariableFunctionArrayAccessor = this.RULE('apexBindVariableFunctionArrayAccessor', () => {
|
|
540
|
-
this.CONSUME(lexer.LSquareBracket);
|
|
541
|
-
this.OR([
|
|
542
|
-
{ ALT: () => this.CONSUME(lexer.UnsignedInteger, { LABEL: 'value' }) },
|
|
543
|
-
{ ALT: () => this.CONSUME(lexer.Identifier, { LABEL: 'value' }) },
|
|
544
|
-
]);
|
|
545
|
-
this.CONSUME(lexer.RSquareBracket);
|
|
546
|
-
});
|
|
547
|
-
arrayExpression = this.RULE('arrayExpression', () => {
|
|
548
|
-
this.CONSUME(lexer.LParen);
|
|
549
|
-
this.AT_LEAST_ONE_SEP({
|
|
550
|
-
SEP: lexer.Comma,
|
|
551
|
-
DEF: () => {
|
|
552
|
-
this.OR(this.$_arrayExpression ||
|
|
553
|
-
(this.$_arrayExpression = [
|
|
554
|
-
{ ALT: () => this.CONSUME(lexer.CurrencyPrefixedDecimal, { LABEL: 'value' }) },
|
|
555
|
-
{ ALT: () => this.CONSUME(lexer.CurrencyPrefixedInteger, { LABEL: 'value' }) },
|
|
556
|
-
{ ALT: () => this.CONSUME(lexer.NumberIdentifier, { LABEL: 'value' }) },
|
|
557
|
-
{ ALT: () => this.CONSUME(lexer.DateIdentifier, { LABEL: 'value' }) },
|
|
558
|
-
{ ALT: () => this.CONSUME(lexer.Null, { LABEL: 'value' }) },
|
|
559
|
-
{ ALT: () => this.CONSUME(lexer.True, { LABEL: 'value' }) },
|
|
560
|
-
{ ALT: () => this.CONSUME(lexer.False, { LABEL: 'value' }) },
|
|
561
|
-
{ ALT: () => this.CONSUME(lexer.DateLiteral, { LABEL: 'value' }) },
|
|
562
|
-
{ ALT: () => this.SUBRULE(this.dateNLiteral, { LABEL: 'value' }) },
|
|
563
|
-
{ ALT: () => this.CONSUME(lexer.GeolocationUnit, { LABEL: 'value' }) },
|
|
564
|
-
{ ALT: () => this.CONSUME(lexer.StringIdentifier, { LABEL: 'value' }) },
|
|
565
|
-
]));
|
|
566
|
-
},
|
|
567
|
-
});
|
|
568
|
-
this.CONSUME(lexer.RParen);
|
|
569
|
-
});
|
|
570
|
-
relationalOperator = this.RULE('relationalOperator', () => {
|
|
571
|
-
this.OR(this.$_relationalOperator ||
|
|
572
|
-
(this.$_relationalOperator = [
|
|
573
|
-
{ ALT: () => this.CONSUME(lexer.Equal, { LABEL: 'operator' }) },
|
|
574
|
-
{ ALT: () => this.CONSUME(lexer.NotEqual, { LABEL: 'operator' }) },
|
|
575
|
-
{ ALT: () => this.CONSUME(lexer.GreaterThan, { LABEL: 'operator' }) },
|
|
576
|
-
{ ALT: () => this.CONSUME(lexer.GreaterThanOrEqual, { LABEL: 'operator' }) },
|
|
577
|
-
{ ALT: () => this.CONSUME(lexer.LessThan, { LABEL: 'operator' }) },
|
|
578
|
-
{ ALT: () => this.CONSUME(lexer.LessThanOrEqual, { LABEL: 'operator' }) },
|
|
579
|
-
{ ALT: () => this.CONSUME(lexer.Like, { LABEL: 'operator' }) },
|
|
580
|
-
]));
|
|
581
|
-
});
|
|
582
|
-
setOperator = this.RULE('setOperator', () => {
|
|
583
|
-
this.OR([
|
|
584
|
-
{ ALT: () => this.CONSUME(lexer.In, { LABEL: 'operator' }) },
|
|
585
|
-
{ ALT: () => this.SUBRULE(this.notInOperator, { LABEL: 'notIn' }) },
|
|
586
|
-
{ ALT: () => this.CONSUME(lexer.Includes, { LABEL: 'operator' }) },
|
|
587
|
-
{ ALT: () => this.CONSUME(lexer.Excludes, { LABEL: 'operator' }) },
|
|
588
|
-
]);
|
|
589
|
-
});
|
|
590
|
-
notInOperator = this.RULE('notInOperator', () => {
|
|
591
|
-
this.CONSUME(lexer.Not, { LABEL: 'operator' });
|
|
592
|
-
this.CONSUME(lexer.In, { LABEL: 'operator' });
|
|
593
|
-
});
|
|
594
|
-
booleanValue = this.RULE('booleanValue', () => {
|
|
595
|
-
this.OR([
|
|
596
|
-
{ ALT: () => this.CONSUME(lexer.True, { LABEL: 'boolean' }) },
|
|
597
|
-
{ ALT: () => this.CONSUME(lexer.False, { LABEL: 'boolean' }) },
|
|
598
|
-
]);
|
|
599
|
-
});
|
|
600
|
-
dateNLiteral = this.RULE('dateNLiteral', () => {
|
|
601
|
-
this.CONSUME(lexer.DateNLiteral, { LABEL: 'dateNLiteral' });
|
|
602
|
-
this.CONSUME(lexer.Colon);
|
|
603
|
-
this.OR1([
|
|
604
|
-
{ ALT: () => this.CONSUME(lexer.UnsignedInteger, { LABEL: 'variable' }) },
|
|
605
|
-
{ ALT: () => this.CONSUME(lexer.SignedInteger, { LABEL: 'variable' }) },
|
|
606
|
-
]);
|
|
607
|
-
});
|
|
608
|
-
forViewOrReference = this.RULE('forViewOrReference', () => {
|
|
609
|
-
this.CONSUME(lexer.For);
|
|
610
|
-
this.OR([
|
|
611
|
-
{ ALT: () => this.CONSUME(lexer.View, { LABEL: 'value' }) },
|
|
612
|
-
{ ALT: () => this.CONSUME(lexer.Reference, { LABEL: 'value' }) },
|
|
613
|
-
{ ALT: () => this.CONSUME(lexer.Update, { LABEL: 'value' }) },
|
|
614
|
-
]);
|
|
615
|
-
});
|
|
616
|
-
updateTrackingViewstat = this.RULE('updateTrackingViewstat', () => {
|
|
617
|
-
this.CONSUME(lexer.Update);
|
|
618
|
-
this.OR([
|
|
619
|
-
{ ALT: () => this.CONSUME(lexer.Tracking, { LABEL: 'value' }) },
|
|
620
|
-
{ ALT: () => this.CONSUME(lexer.Viewstat, { LABEL: 'value' }) },
|
|
621
|
-
]);
|
|
622
|
-
});
|
|
623
|
-
getParenCount(parenCount) {
|
|
624
|
-
return parenCount || { right: 0, left: 0 };
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
let parser = new SoqlParser();
|
|
628
|
-
export function parse(soql, options) {
|
|
629
|
-
const { allowApexBindVariables, logErrors, ignoreParseErrors, allowPartialQuery } = options || {
|
|
630
|
-
allowApexBindVariables: false,
|
|
631
|
-
logErrors: false,
|
|
632
|
-
ignoreParseErrors: false,
|
|
633
|
-
};
|
|
634
|
-
const lexResult = lexer.lex(soql);
|
|
635
|
-
if (lexResult.errors.length > 0) {
|
|
636
|
-
if (logErrors) {
|
|
637
|
-
console.log('Lexing Errors:');
|
|
638
|
-
console.log(lexResult.errors);
|
|
639
|
-
}
|
|
640
|
-
throw new LexingError(lexResult.errors[0]);
|
|
641
|
-
}
|
|
642
|
-
if (parser.ignoreParseErrors !== ignoreParseErrors) {
|
|
643
|
-
parser = new SoqlParser({ ignoreParseErrors });
|
|
644
|
-
}
|
|
645
|
-
parser.input = lexResult.tokens;
|
|
646
|
-
parser.allowApexBindVariables = allowApexBindVariables || false;
|
|
647
|
-
let cst;
|
|
648
|
-
if (allowPartialQuery) {
|
|
649
|
-
cst = parser.selectStatementPartial();
|
|
650
|
-
}
|
|
651
|
-
else {
|
|
652
|
-
cst = parser.selectStatement();
|
|
653
|
-
}
|
|
654
|
-
if (parser.errors.length > 0) {
|
|
655
|
-
if (logErrors) {
|
|
656
|
-
console.log('Parsing Errors:');
|
|
657
|
-
console.log(parser.errors);
|
|
658
|
-
}
|
|
659
|
-
if (!ignoreParseErrors) {
|
|
660
|
-
throw new ParsingError(parser.errors[0]);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
return {
|
|
664
|
-
cst,
|
|
665
|
-
parseErrors: parser.errors.map(err => new ParsingError(err)),
|
|
666
|
-
};
|
|
667
|
-
}
|