@@ -45,14 +45,14 @@ export class SoqlParser extends CstParser {
4545 public allowApexBindVariables = false ;
4646 public ignoreParseErrors = false ;
4747
48- constructor ( { ignoreParseErrors } : { ignoreParseErrors : boolean } = { ignoreParseErrors : false } ) {
48+ constructor ( { ignoreParseErrors } : { ignoreParseErrors ? : boolean | null } = { ignoreParseErrors : false } ) {
4949 super ( lexer . allTokens , {
5050 // true in production (webpack replaces this string)
5151 skipValidations : false ,
52- recoveryEnabled : ignoreParseErrors ,
52+ recoveryEnabled : ! ! ignoreParseErrors ,
5353 // nodeLocationTracking: 'full', // not sure if needed, could look at
5454 } ) ;
55- this . ignoreParseErrors = ignoreParseErrors ;
55+ this . ignoreParseErrors = ! ! ignoreParseErrors ;
5656 this . performSelfAnalysis ( ) ;
5757 }
5858
@@ -157,7 +157,7 @@ export class SoqlParser extends CstParser {
157157 this . $_selectClauseFunctionIdentifier ||
158158 ( this . $_selectClauseFunctionIdentifier = [
159159 { ALT : ( ) => this . SUBRULE ( this . dateFunction , { LABEL : 'fn' } ) } ,
160- { ALT : ( ) => this . SUBRULE ( this . aggregateFunction , { LABEL : 'fn' , ARGS : [ true ] } ) } ,
160+ { ALT : ( ) => this . SUBRULE ( this . aggregateFunction , { LABEL : 'fn' } ) } ,
161161 { ALT : ( ) => this . SUBRULE ( this . locationFunction , { LABEL : 'fn' } ) } ,
162162 { ALT : ( ) => this . SUBRULE ( this . fieldsFunction , { LABEL : 'fn' } ) } ,
163163 { ALT : ( ) => this . SUBRULE ( this . otherFunction , { LABEL : 'fn' } ) } ,
@@ -261,7 +261,7 @@ export class SoqlParser extends CstParser {
261261 const parenCount = this . getParenCount ( ) ;
262262 this . AT_LEAST_ONE ( {
263263 DEF : ( ) => {
264- this . SUBRULE ( this . conditionExpression , { ARGS : [ parenCount , false , true , true ] } ) ;
264+ this . SUBRULE ( this . conditionExpression , { ARGS : [ parenCount , true , true ] } ) ;
265265 } ,
266266 } ) ;
267267
@@ -280,7 +280,7 @@ export class SoqlParser extends CstParser {
280280
281281 private conditionExpression = this . RULE (
282282 'conditionExpression' ,
283- ( parenCount ?: ParenCount , allowSubquery ?: boolean , allowAggregateFn ?: boolean , allowLocationFn ?: boolean ) => {
283+ ( parenCount ?: ParenCount , allowAggregateFn ?: boolean , allowLocationFn ?: boolean ) => {
284284 // argument is undefined during self-analysis, need to initialize to avoid exception
285285 parenCount = this . getParenCount ( parenCount ) ;
286286 this . OPTION ( ( ) => {
@@ -292,15 +292,15 @@ export class SoqlParser extends CstParser {
292292
293293 // MAX_LOOKAHEAD -> this is increased because an arbitrary number of parens could be used causing a parsing error
294294 // this does not allow infinite parentheses, but is more than enough for any real use-cases
295- // Under no circumstances would large numbers of nested expressions not be expressable with fewer conditions
295+ // Under no circumstances would large numbers of nested expressions not be expressible with fewer conditions
296296 this . MANY ( {
297297 MAX_LOOKAHEAD : 10 ,
298298 DEF : ( ) => this . SUBRULE ( this . expressionPartWithNegation , { ARGS : [ parenCount ] , LABEL : 'expressionNegation' } ) ,
299299 } ) ;
300300
301301 this . OR1 ( {
302302 MAX_LOOKAHEAD : 10 ,
303- DEF : [ { ALT : ( ) => this . SUBRULE ( this . expression , { ARGS : [ parenCount , allowSubquery , allowAggregateFn , allowLocationFn ] } ) } ] ,
303+ DEF : [ { ALT : ( ) => this . SUBRULE ( this . expression , { ARGS : [ parenCount , false , allowAggregateFn , allowLocationFn ] } ) } ] ,
304304 } ) ;
305305 } ,
306306 ) ;
@@ -372,7 +372,7 @@ export class SoqlParser extends CstParser {
372372 const parenCount = this . getParenCount ( ) ;
373373 this . AT_LEAST_ONE ( {
374374 DEF : ( ) => {
375- this . SUBRULE ( this . conditionExpression , { ARGS : [ parenCount , true , undefined , undefined ] } ) ;
375+ this . SUBRULE ( this . conditionExpression , { ARGS : [ parenCount , true , false ] } ) ;
376376 } ,
377377 } ) ;
378378
@@ -575,8 +575,8 @@ export class SoqlParser extends CstParser {
575575 } ) ;
576576
577577 this . OR1 ( [
578- { GATE : ( ) => allowAggregateFn , ALT : ( ) => this . SUBRULE ( this . aggregateFunction , { LABEL : 'lhs' } ) } ,
579- { GATE : ( ) => allowLocationFn , ALT : ( ) => this . SUBRULE ( this . locationFunction , { LABEL : 'lhs' } ) } ,
578+ { GATE : ( ) => ! ! allowAggregateFn , ALT : ( ) => this . SUBRULE ( this . aggregateFunction , { LABEL : 'lhs' } ) } ,
579+ { GATE : ( ) => ! ! allowLocationFn , ALT : ( ) => this . SUBRULE ( this . locationFunction , { LABEL : 'lhs' } ) } ,
580580 { ALT : ( ) => this . SUBRULE ( this . dateFunction , { LABEL : 'lhs' } ) } ,
581581 { ALT : ( ) => this . SUBRULE ( this . otherFunction , { LABEL : 'lhs' } ) } ,
582582 { ALT : ( ) => this . CONSUME ( lexer . Identifier , { LABEL : 'lhs' } ) } ,
@@ -757,12 +757,17 @@ export class SoqlParser extends CstParser {
757757 private setOperator = this . RULE ( 'setOperator' , ( ) => {
758758 this . OR ( [
759759 { ALT : ( ) => this . CONSUME ( lexer . In , { LABEL : 'operator' } ) } ,
760- { ALT : ( ) => this . CONSUME ( lexer . NotIn , { LABEL : 'operator ' } ) } ,
760+ { ALT : ( ) => this . SUBRULE ( this . notInOperator , { LABEL : 'notIn ' } ) } ,
761761 { ALT : ( ) => this . CONSUME ( lexer . Includes , { LABEL : 'operator' } ) } ,
762762 { ALT : ( ) => this . CONSUME ( lexer . Excludes , { LABEL : 'operator' } ) } ,
763763 ] ) ;
764764 } ) ;
765765
766+ private notInOperator = this . RULE ( 'notInOperator' , ( ) => {
767+ this . CONSUME ( lexer . Not , { LABEL : 'operator' } ) ;
768+ this . CONSUME ( lexer . In , { LABEL : 'operator' } ) ;
769+ } ) ;
770+
766771 private booleanValue = this . RULE ( 'booleanValue' , ( ) => {
767772 this . OR ( [
768773 { ALT : ( ) => this . CONSUME ( lexer . True , { LABEL : 'boolean' } ) } ,
0 commit comments