@apexdevtools/apex-parser 3.6.0 → 4.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # apex-parser - Changelog
2
2
 
3
+ ## 4.0.0 - 2023-03-28
4
+
5
+ - Correct trigger body parsing to allow member declarations
6
+ - Add support for TYPEOF in SOQL subqueries
7
+ - Change com.nawforce.apexparser packages to io.github.apexdevtools.apexparser
8
+
3
9
  ## 3.6.0 - 2024-02-15
4
10
 
5
11
  - Add null coalesce operator and expression
package/README.md CHANGED
@@ -48,12 +48,12 @@ Maven
48
48
  <dependency>
49
49
  <groupId>io.github.apex-dev-tools</groupId>
50
50
  <artifactId>apex-parser</artifactId>
51
- <version>3.6.0</version>
51
+ <version>4.0.0</version>
52
52
  </dependency>
53
53
 
54
54
  NPM
55
55
 
56
- "@apexdevtools/apex-parser": "^3.6.0"
56
+ "@apexdevtools/apex-parser": "^4.0.0"
57
57
 
58
58
  ## Building
59
59
 
@@ -259,148 +259,151 @@ export declare class ApexParser extends Parser {
259
259
  static readonly LINE_COMMENT = 248;
260
260
  static readonly RULE_triggerUnit = 0;
261
261
  static readonly RULE_triggerCase = 1;
262
- static readonly RULE_compilationUnit = 2;
263
- static readonly RULE_typeDeclaration = 3;
264
- static readonly RULE_classDeclaration = 4;
265
- static readonly RULE_enumDeclaration = 5;
266
- static readonly RULE_enumConstants = 6;
267
- static readonly RULE_interfaceDeclaration = 7;
268
- static readonly RULE_typeList = 8;
269
- static readonly RULE_classBody = 9;
270
- static readonly RULE_interfaceBody = 10;
271
- static readonly RULE_classBodyDeclaration = 11;
272
- static readonly RULE_modifier = 12;
273
- static readonly RULE_memberDeclaration = 13;
274
- static readonly RULE_methodDeclaration = 14;
275
- static readonly RULE_constructorDeclaration = 15;
276
- static readonly RULE_fieldDeclaration = 16;
277
- static readonly RULE_propertyDeclaration = 17;
278
- static readonly RULE_interfaceMethodDeclaration = 18;
279
- static readonly RULE_variableDeclarators = 19;
280
- static readonly RULE_variableDeclarator = 20;
281
- static readonly RULE_arrayInitializer = 21;
282
- static readonly RULE_typeRef = 22;
283
- static readonly RULE_arraySubscripts = 23;
284
- static readonly RULE_typeName = 24;
285
- static readonly RULE_typeArguments = 25;
286
- static readonly RULE_formalParameters = 26;
287
- static readonly RULE_formalParameterList = 27;
288
- static readonly RULE_formalParameter = 28;
289
- static readonly RULE_qualifiedName = 29;
290
- static readonly RULE_literal = 30;
291
- static readonly RULE_annotation = 31;
292
- static readonly RULE_elementValuePairs = 32;
293
- static readonly RULE_elementValuePair = 33;
294
- static readonly RULE_elementValue = 34;
295
- static readonly RULE_elementValueArrayInitializer = 35;
296
- static readonly RULE_block = 36;
297
- static readonly RULE_localVariableDeclarationStatement = 37;
298
- static readonly RULE_localVariableDeclaration = 38;
299
- static readonly RULE_statement = 39;
300
- static readonly RULE_ifStatement = 40;
301
- static readonly RULE_switchStatement = 41;
302
- static readonly RULE_whenControl = 42;
303
- static readonly RULE_whenValue = 43;
304
- static readonly RULE_whenLiteral = 44;
305
- static readonly RULE_forStatement = 45;
306
- static readonly RULE_whileStatement = 46;
307
- static readonly RULE_doWhileStatement = 47;
308
- static readonly RULE_tryStatement = 48;
309
- static readonly RULE_returnStatement = 49;
310
- static readonly RULE_throwStatement = 50;
311
- static readonly RULE_breakStatement = 51;
312
- static readonly RULE_continueStatement = 52;
313
- static readonly RULE_accessLevel = 53;
314
- static readonly RULE_insertStatement = 54;
315
- static readonly RULE_updateStatement = 55;
316
- static readonly RULE_deleteStatement = 56;
317
- static readonly RULE_undeleteStatement = 57;
318
- static readonly RULE_upsertStatement = 58;
319
- static readonly RULE_mergeStatement = 59;
320
- static readonly RULE_runAsStatement = 60;
321
- static readonly RULE_expressionStatement = 61;
322
- static readonly RULE_propertyBlock = 62;
323
- static readonly RULE_getter = 63;
324
- static readonly RULE_setter = 64;
325
- static readonly RULE_catchClause = 65;
326
- static readonly RULE_finallyBlock = 66;
327
- static readonly RULE_forControl = 67;
328
- static readonly RULE_forInit = 68;
329
- static readonly RULE_enhancedForControl = 69;
330
- static readonly RULE_forUpdate = 70;
331
- static readonly RULE_parExpression = 71;
332
- static readonly RULE_expressionList = 72;
333
- static readonly RULE_expression = 73;
334
- static readonly RULE_primary = 74;
335
- static readonly RULE_methodCall = 75;
336
- static readonly RULE_dotMethodCall = 76;
337
- static readonly RULE_creator = 77;
338
- static readonly RULE_createdName = 78;
339
- static readonly RULE_idCreatedNamePair = 79;
340
- static readonly RULE_noRest = 80;
341
- static readonly RULE_classCreatorRest = 81;
342
- static readonly RULE_arrayCreatorRest = 82;
343
- static readonly RULE_mapCreatorRest = 83;
344
- static readonly RULE_mapCreatorRestPair = 84;
345
- static readonly RULE_setCreatorRest = 85;
346
- static readonly RULE_arguments = 86;
347
- static readonly RULE_soqlLiteral = 87;
348
- static readonly RULE_query = 88;
349
- static readonly RULE_subQuery = 89;
350
- static readonly RULE_selectList = 90;
351
- static readonly RULE_selectEntry = 91;
352
- static readonly RULE_fieldName = 92;
353
- static readonly RULE_fromNameList = 93;
354
- static readonly RULE_subFieldList = 94;
355
- static readonly RULE_subFieldEntry = 95;
356
- static readonly RULE_soqlFieldsParameter = 96;
357
- static readonly RULE_soqlFunction = 97;
358
- static readonly RULE_dateFieldName = 98;
359
- static readonly RULE_locationValue = 99;
360
- static readonly RULE_coordinateValue = 100;
361
- static readonly RULE_typeOf = 101;
362
- static readonly RULE_whenClause = 102;
363
- static readonly RULE_elseClause = 103;
364
- static readonly RULE_fieldNameList = 104;
365
- static readonly RULE_usingScope = 105;
366
- static readonly RULE_whereClause = 106;
367
- static readonly RULE_logicalExpression = 107;
368
- static readonly RULE_conditionalExpression = 108;
369
- static readonly RULE_fieldExpression = 109;
370
- static readonly RULE_comparisonOperator = 110;
371
- static readonly RULE_value = 111;
372
- static readonly RULE_valueList = 112;
373
- static readonly RULE_signedNumber = 113;
374
- static readonly RULE_withClause = 114;
375
- static readonly RULE_filteringExpression = 115;
376
- static readonly RULE_dataCategorySelection = 116;
377
- static readonly RULE_dataCategoryName = 117;
378
- static readonly RULE_filteringSelector = 118;
379
- static readonly RULE_groupByClause = 119;
380
- static readonly RULE_orderByClause = 120;
381
- static readonly RULE_fieldOrderList = 121;
382
- static readonly RULE_fieldOrder = 122;
383
- static readonly RULE_limitClause = 123;
384
- static readonly RULE_offsetClause = 124;
385
- static readonly RULE_allRowsClause = 125;
386
- static readonly RULE_forClauses = 126;
387
- static readonly RULE_boundExpression = 127;
388
- static readonly RULE_dateFormula = 128;
389
- static readonly RULE_signedInteger = 129;
390
- static readonly RULE_soqlId = 130;
391
- static readonly RULE_soslLiteral = 131;
392
- static readonly RULE_soslLiteralAlt = 132;
393
- static readonly RULE_soslClauses = 133;
394
- static readonly RULE_searchGroup = 134;
395
- static readonly RULE_fieldSpecList = 135;
396
- static readonly RULE_fieldSpec = 136;
397
- static readonly RULE_fieldList = 137;
398
- static readonly RULE_updateList = 138;
399
- static readonly RULE_updateType = 139;
400
- static readonly RULE_networkList = 140;
401
- static readonly RULE_soslId = 141;
402
- static readonly RULE_id = 142;
403
- static readonly RULE_anyId = 143;
262
+ static readonly RULE_triggerBlock = 2;
263
+ static readonly RULE_triggerBlockMember = 3;
264
+ static readonly RULE_compilationUnit = 4;
265
+ static readonly RULE_typeDeclaration = 5;
266
+ static readonly RULE_classDeclaration = 6;
267
+ static readonly RULE_enumDeclaration = 7;
268
+ static readonly RULE_enumConstants = 8;
269
+ static readonly RULE_interfaceDeclaration = 9;
270
+ static readonly RULE_typeList = 10;
271
+ static readonly RULE_classBody = 11;
272
+ static readonly RULE_interfaceBody = 12;
273
+ static readonly RULE_classBodyDeclaration = 13;
274
+ static readonly RULE_modifier = 14;
275
+ static readonly RULE_memberDeclaration = 15;
276
+ static readonly RULE_triggerMemberDeclaration = 16;
277
+ static readonly RULE_methodDeclaration = 17;
278
+ static readonly RULE_constructorDeclaration = 18;
279
+ static readonly RULE_fieldDeclaration = 19;
280
+ static readonly RULE_propertyDeclaration = 20;
281
+ static readonly RULE_interfaceMethodDeclaration = 21;
282
+ static readonly RULE_variableDeclarators = 22;
283
+ static readonly RULE_variableDeclarator = 23;
284
+ static readonly RULE_arrayInitializer = 24;
285
+ static readonly RULE_typeRef = 25;
286
+ static readonly RULE_arraySubscripts = 26;
287
+ static readonly RULE_typeName = 27;
288
+ static readonly RULE_typeArguments = 28;
289
+ static readonly RULE_formalParameters = 29;
290
+ static readonly RULE_formalParameterList = 30;
291
+ static readonly RULE_formalParameter = 31;
292
+ static readonly RULE_qualifiedName = 32;
293
+ static readonly RULE_literal = 33;
294
+ static readonly RULE_annotation = 34;
295
+ static readonly RULE_elementValuePairs = 35;
296
+ static readonly RULE_elementValuePair = 36;
297
+ static readonly RULE_elementValue = 37;
298
+ static readonly RULE_elementValueArrayInitializer = 38;
299
+ static readonly RULE_block = 39;
300
+ static readonly RULE_localVariableDeclarationStatement = 40;
301
+ static readonly RULE_localVariableDeclaration = 41;
302
+ static readonly RULE_statement = 42;
303
+ static readonly RULE_ifStatement = 43;
304
+ static readonly RULE_switchStatement = 44;
305
+ static readonly RULE_whenControl = 45;
306
+ static readonly RULE_whenValue = 46;
307
+ static readonly RULE_whenLiteral = 47;
308
+ static readonly RULE_forStatement = 48;
309
+ static readonly RULE_whileStatement = 49;
310
+ static readonly RULE_doWhileStatement = 50;
311
+ static readonly RULE_tryStatement = 51;
312
+ static readonly RULE_returnStatement = 52;
313
+ static readonly RULE_throwStatement = 53;
314
+ static readonly RULE_breakStatement = 54;
315
+ static readonly RULE_continueStatement = 55;
316
+ static readonly RULE_accessLevel = 56;
317
+ static readonly RULE_insertStatement = 57;
318
+ static readonly RULE_updateStatement = 58;
319
+ static readonly RULE_deleteStatement = 59;
320
+ static readonly RULE_undeleteStatement = 60;
321
+ static readonly RULE_upsertStatement = 61;
322
+ static readonly RULE_mergeStatement = 62;
323
+ static readonly RULE_runAsStatement = 63;
324
+ static readonly RULE_expressionStatement = 64;
325
+ static readonly RULE_propertyBlock = 65;
326
+ static readonly RULE_getter = 66;
327
+ static readonly RULE_setter = 67;
328
+ static readonly RULE_catchClause = 68;
329
+ static readonly RULE_finallyBlock = 69;
330
+ static readonly RULE_forControl = 70;
331
+ static readonly RULE_forInit = 71;
332
+ static readonly RULE_enhancedForControl = 72;
333
+ static readonly RULE_forUpdate = 73;
334
+ static readonly RULE_parExpression = 74;
335
+ static readonly RULE_expressionList = 75;
336
+ static readonly RULE_expression = 76;
337
+ static readonly RULE_primary = 77;
338
+ static readonly RULE_methodCall = 78;
339
+ static readonly RULE_dotMethodCall = 79;
340
+ static readonly RULE_creator = 80;
341
+ static readonly RULE_createdName = 81;
342
+ static readonly RULE_idCreatedNamePair = 82;
343
+ static readonly RULE_noRest = 83;
344
+ static readonly RULE_classCreatorRest = 84;
345
+ static readonly RULE_arrayCreatorRest = 85;
346
+ static readonly RULE_mapCreatorRest = 86;
347
+ static readonly RULE_mapCreatorRestPair = 87;
348
+ static readonly RULE_setCreatorRest = 88;
349
+ static readonly RULE_arguments = 89;
350
+ static readonly RULE_soqlLiteral = 90;
351
+ static readonly RULE_query = 91;
352
+ static readonly RULE_subQuery = 92;
353
+ static readonly RULE_selectList = 93;
354
+ static readonly RULE_selectEntry = 94;
355
+ static readonly RULE_fieldName = 95;
356
+ static readonly RULE_fromNameList = 96;
357
+ static readonly RULE_subFieldList = 97;
358
+ static readonly RULE_subFieldEntry = 98;
359
+ static readonly RULE_soqlFieldsParameter = 99;
360
+ static readonly RULE_soqlFunction = 100;
361
+ static readonly RULE_dateFieldName = 101;
362
+ static readonly RULE_locationValue = 102;
363
+ static readonly RULE_coordinateValue = 103;
364
+ static readonly RULE_typeOf = 104;
365
+ static readonly RULE_whenClause = 105;
366
+ static readonly RULE_elseClause = 106;
367
+ static readonly RULE_fieldNameList = 107;
368
+ static readonly RULE_usingScope = 108;
369
+ static readonly RULE_whereClause = 109;
370
+ static readonly RULE_logicalExpression = 110;
371
+ static readonly RULE_conditionalExpression = 111;
372
+ static readonly RULE_fieldExpression = 112;
373
+ static readonly RULE_comparisonOperator = 113;
374
+ static readonly RULE_value = 114;
375
+ static readonly RULE_valueList = 115;
376
+ static readonly RULE_signedNumber = 116;
377
+ static readonly RULE_withClause = 117;
378
+ static readonly RULE_filteringExpression = 118;
379
+ static readonly RULE_dataCategorySelection = 119;
380
+ static readonly RULE_dataCategoryName = 120;
381
+ static readonly RULE_filteringSelector = 121;
382
+ static readonly RULE_groupByClause = 122;
383
+ static readonly RULE_orderByClause = 123;
384
+ static readonly RULE_fieldOrderList = 124;
385
+ static readonly RULE_fieldOrder = 125;
386
+ static readonly RULE_limitClause = 126;
387
+ static readonly RULE_offsetClause = 127;
388
+ static readonly RULE_allRowsClause = 128;
389
+ static readonly RULE_forClauses = 129;
390
+ static readonly RULE_boundExpression = 130;
391
+ static readonly RULE_dateFormula = 131;
392
+ static readonly RULE_signedInteger = 132;
393
+ static readonly RULE_soqlId = 133;
394
+ static readonly RULE_soslLiteral = 134;
395
+ static readonly RULE_soslLiteralAlt = 135;
396
+ static readonly RULE_soslClauses = 136;
397
+ static readonly RULE_searchGroup = 137;
398
+ static readonly RULE_fieldSpecList = 138;
399
+ static readonly RULE_fieldSpec = 139;
400
+ static readonly RULE_fieldList = 140;
401
+ static readonly RULE_updateList = 141;
402
+ static readonly RULE_updateType = 142;
403
+ static readonly RULE_networkList = 143;
404
+ static readonly RULE_soslId = 144;
405
+ static readonly RULE_id = 145;
406
+ static readonly RULE_anyId = 146;
404
407
  static readonly ruleNames: string[];
405
408
  private static readonly _LITERAL_NAMES;
406
409
  private static readonly _SYMBOLIC_NAMES;
@@ -413,6 +416,8 @@ export declare class ApexParser extends Parser {
413
416
  constructor(input: TokenStream);
414
417
  triggerUnit(): TriggerUnitContext;
415
418
  triggerCase(): TriggerCaseContext;
419
+ triggerBlock(): TriggerBlockContext;
420
+ triggerBlockMember(): TriggerBlockMemberContext;
416
421
  compilationUnit(): CompilationUnitContext;
417
422
  typeDeclaration(): TypeDeclarationContext;
418
423
  classDeclaration(): ClassDeclarationContext;
@@ -425,6 +430,7 @@ export declare class ApexParser extends Parser {
425
430
  classBodyDeclaration(): ClassBodyDeclarationContext;
426
431
  modifier(): ModifierContext;
427
432
  memberDeclaration(): MemberDeclarationContext;
433
+ triggerMemberDeclaration(): TriggerMemberDeclarationContext;
428
434
  methodDeclaration(): MethodDeclarationContext;
429
435
  constructorDeclaration(): ConstructorDeclarationContext;
430
436
  fieldDeclaration(): FieldDeclarationContext;
@@ -576,7 +582,7 @@ export declare class TriggerUnitContext extends ParserRuleContext {
576
582
  triggerCase(): TriggerCaseContext[];
577
583
  triggerCase(i: number): TriggerCaseContext;
578
584
  RPAREN(): TerminalNode;
579
- block(): BlockContext;
585
+ triggerBlock(): TriggerBlockContext;
580
586
  EOF(): TerminalNode;
581
587
  COMMA(): TerminalNode[];
582
588
  COMMA(i: number): TerminalNode;
@@ -599,6 +605,28 @@ export declare class TriggerCaseContext extends ParserRuleContext {
599
605
  exitRule(listener: ApexParserListener): void;
600
606
  accept<Result>(visitor: ApexParserVisitor<Result>): Result;
601
607
  }
608
+ export declare class TriggerBlockContext extends ParserRuleContext {
609
+ LBRACE(): TerminalNode;
610
+ RBRACE(): TerminalNode;
611
+ triggerBlockMember(): TriggerBlockMemberContext[];
612
+ triggerBlockMember(i: number): TriggerBlockMemberContext;
613
+ constructor(parent: ParserRuleContext | undefined, invokingState: number);
614
+ get ruleIndex(): number;
615
+ enterRule(listener: ApexParserListener): void;
616
+ exitRule(listener: ApexParserListener): void;
617
+ accept<Result>(visitor: ApexParserVisitor<Result>): Result;
618
+ }
619
+ export declare class TriggerBlockMemberContext extends ParserRuleContext {
620
+ triggerMemberDeclaration(): TriggerMemberDeclarationContext | undefined;
621
+ modifier(): ModifierContext[];
622
+ modifier(i: number): ModifierContext;
623
+ statement(): StatementContext | undefined;
624
+ constructor(parent: ParserRuleContext | undefined, invokingState: number);
625
+ get ruleIndex(): number;
626
+ enterRule(listener: ApexParserListener): void;
627
+ exitRule(listener: ApexParserListener): void;
628
+ accept<Result>(visitor: ApexParserVisitor<Result>): Result;
629
+ }
602
630
  export declare class CompilationUnitContext extends ParserRuleContext {
603
631
  typeDeclaration(): TypeDeclarationContext;
604
632
  EOF(): TerminalNode;
@@ -753,6 +781,19 @@ export declare class MemberDeclarationContext extends ParserRuleContext {
753
781
  exitRule(listener: ApexParserListener): void;
754
782
  accept<Result>(visitor: ApexParserVisitor<Result>): Result;
755
783
  }
784
+ export declare class TriggerMemberDeclarationContext extends ParserRuleContext {
785
+ methodDeclaration(): MethodDeclarationContext | undefined;
786
+ fieldDeclaration(): FieldDeclarationContext | undefined;
787
+ interfaceDeclaration(): InterfaceDeclarationContext | undefined;
788
+ classDeclaration(): ClassDeclarationContext | undefined;
789
+ enumDeclaration(): EnumDeclarationContext | undefined;
790
+ propertyDeclaration(): PropertyDeclarationContext | undefined;
791
+ constructor(parent: ParserRuleContext | undefined, invokingState: number);
792
+ get ruleIndex(): number;
793
+ enterRule(listener: ApexParserListener): void;
794
+ exitRule(listener: ApexParserListener): void;
795
+ accept<Result>(visitor: ApexParserVisitor<Result>): Result;
796
+ }
756
797
  export declare class MethodDeclarationContext extends ParserRuleContext {
757
798
  id(): IdContext;
758
799
  formalParameters(): FormalParametersContext;
@@ -1989,6 +2030,7 @@ export declare class SubFieldEntryContext extends ParserRuleContext {
1989
2030
  fieldName(): FieldNameContext | undefined;
1990
2031
  soqlId(): SoqlIdContext | undefined;
1991
2032
  soqlFunction(): SoqlFunctionContext | undefined;
2033
+ typeOf(): TypeOfContext | undefined;
1992
2034
  constructor(parent: ParserRuleContext | undefined, invokingState: number);
1993
2035
  get ruleIndex(): number;
1994
2036
  enterRule(listener: ApexParserListener): void;