Skip to content

Commit

Permalink
Merge pull request #232 from maxence-lefebvre/build/bump-chevrotain
Browse files Browse the repository at this point in the history
build(deps): bump chevrotain from 9.0.1 to 10.5.0
  • Loading branch information
paustint authored May 23, 2023
2 parents 16106ed + 1be6e34 commit 4302d73
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 37 deletions.
100 changes: 71 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"README.md"
],
"dependencies": {
"chevrotain": "^9.0.1",
"chevrotain": "^10.5.0",
"commander": "^2.20.3",
"lodash.get": "^4.4.2"
},
Expand Down
12 changes: 6 additions & 6 deletions src/parser/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class SoqlParser extends CstParser {

private conditionExpression = this.RULE(
'conditionExpression',
(parenCount?: ParenCount, allowSubquery?: boolean, alowAggregateFn?: boolean, allowLocationFn?: boolean) => {
(parenCount?: ParenCount, allowSubquery?: boolean, allowAggregateFn?: boolean, allowLocationFn?: boolean) => {
// argument is undefined during self-analysis, need to initialize to avoid exception
parenCount = this.getParenCount(parenCount);
this.OPTION(() => {
Expand All @@ -300,7 +300,7 @@ export class SoqlParser extends CstParser {

this.OR1({
MAX_LOOKAHEAD: 10,
DEF: [{ ALT: () => this.SUBRULE(this.expression, { ARGS: [parenCount, allowSubquery, alowAggregateFn, allowLocationFn] }) }],
DEF: [{ ALT: () => this.SUBRULE(this.expression, { ARGS: [parenCount, allowSubquery, allowAggregateFn, allowLocationFn] }) }],
});
},
);
Expand Down Expand Up @@ -372,7 +372,7 @@ export class SoqlParser extends CstParser {
const parenCount = this.getParenCount();
this.AT_LEAST_ONE({
DEF: () => {
this.SUBRULE(this.conditionExpression, { ARGS: [parenCount, true] });
this.SUBRULE(this.conditionExpression, { ARGS: [parenCount, true, undefined, undefined] });
},
});

Expand Down Expand Up @@ -564,7 +564,7 @@ export class SoqlParser extends CstParser {

private expression = this.RULE(
'expression',
(parenCount?: ParenCount, allowSubquery?: boolean, alowAggregateFn?: boolean, allowLocationFn?: boolean) => {
(parenCount?: ParenCount, allowSubquery?: boolean, allowAggregateFn?: boolean, allowLocationFn?: boolean) => {
this.OPTION1(() => {
this.MANY1(() => {
this.CONSUME(lexer.LParen);
Expand All @@ -575,7 +575,7 @@ export class SoqlParser extends CstParser {
});

this.OR1([
{ GATE: () => alowAggregateFn, ALT: () => this.SUBRULE(this.aggregateFunction, { LABEL: 'lhs' }) },
{ GATE: () => allowAggregateFn, ALT: () => this.SUBRULE(this.aggregateFunction, { LABEL: 'lhs' }) },
{ GATE: () => allowLocationFn, ALT: () => this.SUBRULE(this.locationFunction, { LABEL: 'lhs' }) },
{ ALT: () => this.SUBRULE(this.dateFunction, { LABEL: 'lhs' }) },
{ ALT: () => this.SUBRULE(this.otherFunction, { LABEL: 'lhs' }) },
Expand Down Expand Up @@ -611,7 +611,7 @@ export class SoqlParser extends CstParser {
this.SUBRULE2(this.atomicExpression, { LABEL: 'rhs', ARGS: [true, allowSubquery] });
});

private atomicExpression = this.RULE('atomicExpression', (isArray, allowSubquery?: boolean) => {
private atomicExpression = this.RULE('atomicExpression', (isArray?: boolean, allowSubquery?: boolean) => {
this.OR(
this.$_atomicExpression ||
(this.$_atomicExpression = [
Expand Down
2 changes: 1 addition & 1 deletion test/performance-test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe.skip('parse queries', () => {
for (let i = 0; i < numIterations; i++) {
testCases.forEach(testCase => {
try {
parseQuery(testCase.soql, { allowApexBindVariables: true, logErrors: true });
parseQuery(testCase.soql, { allowApexBindVariables: true, logErrors: true, ...testCase.options });
} catch (ex) {
console.log('Exception on TC', testCase.testCase, testCase.soql);
console.log(ex);
Expand Down

0 comments on commit 4302d73

Please sign in to comment.