@apexdevtools/apex-parser 5.0.0-beta.1 → 5.0.0-beta.2

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
@@ -18,6 +18,8 @@
18
18
 
19
19
  - Added support for parsing Anonymous Apex via `anonymousUnit` (.apex files) and `anonymousBlock` parser rules.
20
20
 
21
+ - Re-ordered `memberDeclaration` alternate rules to de-prioritise field declarations due to its `typeDef` rule.
22
+
21
23
  ### Java
22
24
 
23
25
  - Added `Check.run` to programmatically run syntax check operation on a path.
@@ -802,12 +802,12 @@ export declare class ModifierContext extends ParserRuleContext {
802
802
  export declare class MemberDeclarationContext extends ParserRuleContext {
803
803
  constructor(parser?: ApexParser, parent?: ParserRuleContext, invokingState?: number);
804
804
  methodDeclaration(): MethodDeclarationContext;
805
- fieldDeclaration(): FieldDeclarationContext;
806
805
  constructorDeclaration(): ConstructorDeclarationContext;
807
806
  interfaceDeclaration(): InterfaceDeclarationContext;
808
807
  classDeclaration(): ClassDeclarationContext;
809
808
  enumDeclaration(): EnumDeclarationContext;
810
809
  propertyDeclaration(): PropertyDeclarationContext;
810
+ fieldDeclaration(): FieldDeclarationContext;
811
811
  get ruleIndex(): number;
812
812
  enterRule(listener: ApexParserListener): void;
813
813
  exitRule(listener: ApexParserListener): void;
@@ -816,11 +816,11 @@ export declare class MemberDeclarationContext extends ParserRuleContext {
816
816
  export declare class TriggerMemberDeclarationContext extends ParserRuleContext {
817
817
  constructor(parser?: ApexParser, parent?: ParserRuleContext, invokingState?: number);
818
818
  methodDeclaration(): MethodDeclarationContext;
819
- fieldDeclaration(): FieldDeclarationContext;
820
819
  interfaceDeclaration(): InterfaceDeclarationContext;
821
820
  classDeclaration(): ClassDeclarationContext;
822
821
  enumDeclaration(): EnumDeclarationContext;
823
822
  propertyDeclaration(): PropertyDeclarationContext;
823
+ fieldDeclaration(): FieldDeclarationContext;
824
824
  get ruleIndex(): number;
825
825
  enterRule(listener: ApexParserListener): void;
826
826
  exitRule(listener: ApexParserListener): void;
@@ -829,11 +829,11 @@ export declare class TriggerMemberDeclarationContext extends ParserRuleContext {
829
829
  export declare class AnonymousMemberDeclarationContext extends ParserRuleContext {
830
830
  constructor(parser?: ApexParser, parent?: ParserRuleContext, invokingState?: number);
831
831
  methodDeclaration(): MethodDeclarationContext;
832
- fieldDeclaration(): FieldDeclarationContext;
833
832
  interfaceDeclaration(): InterfaceDeclarationContext;
834
833
  classDeclaration(): ClassDeclarationContext;
835
834
  enumDeclaration(): EnumDeclarationContext;
836
835
  propertyDeclaration(): PropertyDeclarationContext;
836
+ fieldDeclaration(): FieldDeclarationContext;
837
837
  get ruleIndex(): number;
838
838
  enterRule(listener: ApexParserListener): void;
839
839
  exitRule(listener: ApexParserListener): void;
@@ -1007,42 +1007,42 @@ class ApexParser extends antlr4_1.Parser {
1007
1007
  this.enterOuterAlt(localctx, 2);
1008
1008
  {
1009
1009
  this.state = 486;
1010
- this.fieldDeclaration();
1010
+ this.constructorDeclaration();
1011
1011
  }
1012
1012
  break;
1013
1013
  case 3:
1014
1014
  this.enterOuterAlt(localctx, 3);
1015
1015
  {
1016
1016
  this.state = 487;
1017
- this.constructorDeclaration();
1017
+ this.interfaceDeclaration();
1018
1018
  }
1019
1019
  break;
1020
1020
  case 4:
1021
1021
  this.enterOuterAlt(localctx, 4);
1022
1022
  {
1023
1023
  this.state = 488;
1024
- this.interfaceDeclaration();
1024
+ this.classDeclaration();
1025
1025
  }
1026
1026
  break;
1027
1027
  case 5:
1028
1028
  this.enterOuterAlt(localctx, 5);
1029
1029
  {
1030
1030
  this.state = 489;
1031
- this.classDeclaration();
1031
+ this.enumDeclaration();
1032
1032
  }
1033
1033
  break;
1034
1034
  case 6:
1035
1035
  this.enterOuterAlt(localctx, 6);
1036
1036
  {
1037
1037
  this.state = 490;
1038
- this.enumDeclaration();
1038
+ this.propertyDeclaration();
1039
1039
  }
1040
1040
  break;
1041
1041
  case 7:
1042
1042
  this.enterOuterAlt(localctx, 7);
1043
1043
  {
1044
1044
  this.state = 491;
1045
- this.propertyDeclaration();
1045
+ this.fieldDeclaration();
1046
1046
  }
1047
1047
  break;
1048
1048
  }
@@ -1081,35 +1081,35 @@ class ApexParser extends antlr4_1.Parser {
1081
1081
  this.enterOuterAlt(localctx, 2);
1082
1082
  {
1083
1083
  this.state = 495;
1084
- this.fieldDeclaration();
1084
+ this.interfaceDeclaration();
1085
1085
  }
1086
1086
  break;
1087
1087
  case 3:
1088
1088
  this.enterOuterAlt(localctx, 3);
1089
1089
  {
1090
1090
  this.state = 496;
1091
- this.interfaceDeclaration();
1091
+ this.classDeclaration();
1092
1092
  }
1093
1093
  break;
1094
1094
  case 4:
1095
1095
  this.enterOuterAlt(localctx, 4);
1096
1096
  {
1097
1097
  this.state = 497;
1098
- this.classDeclaration();
1098
+ this.enumDeclaration();
1099
1099
  }
1100
1100
  break;
1101
1101
  case 5:
1102
1102
  this.enterOuterAlt(localctx, 5);
1103
1103
  {
1104
1104
  this.state = 498;
1105
- this.enumDeclaration();
1105
+ this.propertyDeclaration();
1106
1106
  }
1107
1107
  break;
1108
1108
  case 6:
1109
1109
  this.enterOuterAlt(localctx, 6);
1110
1110
  {
1111
1111
  this.state = 499;
1112
- this.propertyDeclaration();
1112
+ this.fieldDeclaration();
1113
1113
  }
1114
1114
  break;
1115
1115
  }
@@ -1148,35 +1148,35 @@ class ApexParser extends antlr4_1.Parser {
1148
1148
  this.enterOuterAlt(localctx, 2);
1149
1149
  {
1150
1150
  this.state = 503;
1151
- this.fieldDeclaration();
1151
+ this.interfaceDeclaration();
1152
1152
  }
1153
1153
  break;
1154
1154
  case 3:
1155
1155
  this.enterOuterAlt(localctx, 3);
1156
1156
  {
1157
1157
  this.state = 504;
1158
- this.interfaceDeclaration();
1158
+ this.classDeclaration();
1159
1159
  }
1160
1160
  break;
1161
1161
  case 4:
1162
1162
  this.enterOuterAlt(localctx, 4);
1163
1163
  {
1164
1164
  this.state = 505;
1165
- this.classDeclaration();
1165
+ this.enumDeclaration();
1166
1166
  }
1167
1167
  break;
1168
1168
  case 5:
1169
1169
  this.enterOuterAlt(localctx, 5);
1170
1170
  {
1171
1171
  this.state = 506;
1172
- this.enumDeclaration();
1172
+ this.propertyDeclaration();
1173
1173
  }
1174
1174
  break;
1175
1175
  case 6:
1176
1176
  this.enterOuterAlt(localctx, 6);
1177
1177
  {
1178
1178
  this.state = 507;
1179
- this.propertyDeclaration();
1179
+ this.fieldDeclaration();
1180
1180
  }
1181
1181
  break;
1182
1182
  }
@@ -11467,32 +11467,32 @@ ApexParser._serializedATN = [4, 1, 251, 2014, 2, 0, 7, 0,
11467
11467
  465, 1, 0, 0, 0, 483, 466, 1, 0, 0, 0, 483, 467, 1, 0, 0, 0, 483, 468, 1, 0, 0, 0, 483, 469, 1, 0,
11468
11468
  0, 0, 483, 470, 1, 0, 0, 0, 483, 471, 1, 0, 0, 0, 483, 472, 1, 0, 0, 0, 483, 473, 1, 0, 0, 0, 483,
11469
11469
  474, 1, 0, 0, 0, 483, 475, 1, 0, 0, 0, 483, 476, 1, 0, 0, 0, 483, 477, 1, 0, 0, 0, 483, 479, 1, 0,
11470
- 0, 0, 483, 481, 1, 0, 0, 0, 484, 35, 1, 0, 0, 0, 485, 493, 3, 42, 21, 0, 486, 493, 3, 46, 23, 0,
11471
- 487, 493, 3, 44, 22, 0, 488, 493, 3, 24, 12, 0, 489, 493, 3, 18, 9, 0, 490, 493, 3, 20, 10, 0,
11472
- 491, 493, 3, 48, 24, 0, 492, 485, 1, 0, 0, 0, 492, 486, 1, 0, 0, 0, 492, 487, 1, 0, 0, 0, 492, 488,
11470
+ 0, 0, 483, 481, 1, 0, 0, 0, 484, 35, 1, 0, 0, 0, 485, 493, 3, 42, 21, 0, 486, 493, 3, 44, 22, 0,
11471
+ 487, 493, 3, 24, 12, 0, 488, 493, 3, 18, 9, 0, 489, 493, 3, 20, 10, 0, 490, 493, 3, 48, 24, 0,
11472
+ 491, 493, 3, 46, 23, 0, 492, 485, 1, 0, 0, 0, 492, 486, 1, 0, 0, 0, 492, 487, 1, 0, 0, 0, 492, 488,
11473
11473
  1, 0, 0, 0, 492, 489, 1, 0, 0, 0, 492, 490, 1, 0, 0, 0, 492, 491, 1, 0, 0, 0, 493, 37, 1, 0, 0, 0,
11474
- 494, 501, 3, 42, 21, 0, 495, 501, 3, 46, 23, 0, 496, 501, 3, 24, 12, 0, 497, 501, 3, 18, 9, 0,
11475
- 498, 501, 3, 20, 10, 0, 499, 501, 3, 48, 24, 0, 500, 494, 1, 0, 0, 0, 500, 495, 1, 0, 0, 0, 500,
11474
+ 494, 501, 3, 42, 21, 0, 495, 501, 3, 24, 12, 0, 496, 501, 3, 18, 9, 0, 497, 501, 3, 20, 10, 0,
11475
+ 498, 501, 3, 48, 24, 0, 499, 501, 3, 46, 23, 0, 500, 494, 1, 0, 0, 0, 500, 495, 1, 0, 0, 0, 500,
11476
11476
  496, 1, 0, 0, 0, 500, 497, 1, 0, 0, 0, 500, 498, 1, 0, 0, 0, 500, 499, 1, 0, 0, 0, 501, 39, 1, 0,
11477
- 0, 0, 502, 509, 3, 42, 21, 0, 503, 509, 3, 46, 23, 0, 504, 509, 3, 24, 12, 0, 505, 509, 3, 18,
11478
- 9, 0, 506, 509, 3, 20, 10, 0, 507, 509, 3, 48, 24, 0, 508, 502, 1, 0, 0, 0, 508, 503, 1, 0, 0, 0,
11479
- 508, 504, 1, 0, 0, 0, 508, 505, 1, 0, 0, 0, 508, 506, 1, 0, 0, 0, 508, 507, 1, 0, 0, 0, 509, 41,
11480
- 1, 0, 0, 0, 510, 513, 3, 58, 29, 0, 511, 513, 5, 49, 0, 0, 512, 510, 1, 0, 0, 0, 512, 511, 1, 0,
11481
- 0, 0, 513, 514, 1, 0, 0, 0, 514, 515, 3, 300, 150, 0, 515, 518, 3, 66, 33, 0, 516, 519, 3, 86,
11482
- 43, 0, 517, 519, 5, 207, 0, 0, 518, 516, 1, 0, 0, 0, 518, 517, 1, 0, 0, 0, 519, 43, 1, 0, 0, 0, 520,
11483
- 521, 3, 72, 36, 0, 521, 522, 3, 66, 33, 0, 522, 523, 3, 86, 43, 0, 523, 45, 1, 0, 0, 0, 524, 525,
11484
- 3, 58, 29, 0, 525, 526, 3, 52, 26, 0, 526, 527, 5, 207, 0, 0, 527, 47, 1, 0, 0, 0, 528, 529, 3,
11485
- 58, 29, 0, 529, 530, 3, 300, 150, 0, 530, 534, 5, 203, 0, 0, 531, 533, 3, 138, 69, 0, 532, 531,
11486
- 1, 0, 0, 0, 533, 536, 1, 0, 0, 0, 534, 532, 1, 0, 0, 0, 534, 535, 1, 0, 0, 0, 535, 537, 1, 0, 0, 0,
11487
- 536, 534, 1, 0, 0, 0, 537, 538, 5, 204, 0, 0, 538, 49, 1, 0, 0, 0, 539, 541, 3, 34, 17, 0, 540,
11488
- 539, 1, 0, 0, 0, 541, 544, 1, 0, 0, 0, 542, 540, 1, 0, 0, 0, 542, 543, 1, 0, 0, 0, 543, 547, 1, 0,
11489
- 0, 0, 544, 542, 1, 0, 0, 0, 545, 548, 3, 58, 29, 0, 546, 548, 5, 49, 0, 0, 547, 545, 1, 0, 0, 0,
11490
- 547, 546, 1, 0, 0, 0, 548, 549, 1, 0, 0, 0, 549, 550, 3, 300, 150, 0, 550, 551, 3, 66, 33, 0, 551,
11491
- 552, 5, 207, 0, 0, 552, 51, 1, 0, 0, 0, 553, 558, 3, 54, 27, 0, 554, 555, 5, 208, 0, 0, 555, 557,
11492
- 3, 54, 27, 0, 556, 554, 1, 0, 0, 0, 557, 560, 1, 0, 0, 0, 558, 556, 1, 0, 0, 0, 558, 559, 1, 0, 0,
11493
- 0, 559, 53, 1, 0, 0, 0, 560, 558, 1, 0, 0, 0, 561, 564, 3, 300, 150, 0, 562, 563, 5, 210, 0, 0,
11494
- 563, 565, 3, 160, 80, 0, 564, 562, 1, 0, 0, 0, 564, 565, 1, 0, 0, 0, 565, 55, 1, 0, 0, 0, 566, 578,
11495
- 5, 203, 0, 0, 567, 572, 3, 160, 80, 0, 568, 569, 5, 208, 0, 0, 569, 571, 3, 160, 80, 0, 570, 568,
11477
+ 0, 0, 502, 509, 3, 42, 21, 0, 503, 509, 3, 24, 12, 0, 504, 509, 3, 18, 9, 0, 505, 509, 3, 20, 10,
11478
+ 0, 506, 509, 3, 48, 24, 0, 507, 509, 3, 46, 23, 0, 508, 502, 1, 0, 0, 0, 508, 503, 1, 0, 0, 0, 508,
11479
+ 504, 1, 0, 0, 0, 508, 505, 1, 0, 0, 0, 508, 506, 1, 0, 0, 0, 508, 507, 1, 0, 0, 0, 509, 41, 1, 0,
11480
+ 0, 0, 510, 513, 3, 58, 29, 0, 511, 513, 5, 49, 0, 0, 512, 510, 1, 0, 0, 0, 512, 511, 1, 0, 0, 0,
11481
+ 513, 514, 1, 0, 0, 0, 514, 515, 3, 300, 150, 0, 515, 518, 3, 66, 33, 0, 516, 519, 3, 86, 43, 0,
11482
+ 517, 519, 5, 207, 0, 0, 518, 516, 1, 0, 0, 0, 518, 517, 1, 0, 0, 0, 519, 43, 1, 0, 0, 0, 520, 521,
11483
+ 3, 72, 36, 0, 521, 522, 3, 66, 33, 0, 522, 523, 3, 86, 43, 0, 523, 45, 1, 0, 0, 0, 524, 525, 3,
11484
+ 58, 29, 0, 525, 526, 3, 52, 26, 0, 526, 527, 5, 207, 0, 0, 527, 47, 1, 0, 0, 0, 528, 529, 3, 58,
11485
+ 29, 0, 529, 530, 3, 300, 150, 0, 530, 534, 5, 203, 0, 0, 531, 533, 3, 138, 69, 0, 532, 531, 1,
11486
+ 0, 0, 0, 533, 536, 1, 0, 0, 0, 534, 532, 1, 0, 0, 0, 534, 535, 1, 0, 0, 0, 535, 537, 1, 0, 0, 0, 536,
11487
+ 534, 1, 0, 0, 0, 537, 538, 5, 204, 0, 0, 538, 49, 1, 0, 0, 0, 539, 541, 3, 34, 17, 0, 540, 539,
11488
+ 1, 0, 0, 0, 541, 544, 1, 0, 0, 0, 542, 540, 1, 0, 0, 0, 542, 543, 1, 0, 0, 0, 543, 547, 1, 0, 0, 0,
11489
+ 544, 542, 1, 0, 0, 0, 545, 548, 3, 58, 29, 0, 546, 548, 5, 49, 0, 0, 547, 545, 1, 0, 0, 0, 547,
11490
+ 546, 1, 0, 0, 0, 548, 549, 1, 0, 0, 0, 549, 550, 3, 300, 150, 0, 550, 551, 3, 66, 33, 0, 551, 552,
11491
+ 5, 207, 0, 0, 552, 51, 1, 0, 0, 0, 553, 558, 3, 54, 27, 0, 554, 555, 5, 208, 0, 0, 555, 557, 3,
11492
+ 54, 27, 0, 556, 554, 1, 0, 0, 0, 557, 560, 1, 0, 0, 0, 558, 556, 1, 0, 0, 0, 558, 559, 1, 0, 0, 0,
11493
+ 559, 53, 1, 0, 0, 0, 560, 558, 1, 0, 0, 0, 561, 564, 3, 300, 150, 0, 562, 563, 5, 210, 0, 0, 563,
11494
+ 565, 3, 160, 80, 0, 564, 562, 1, 0, 0, 0, 564, 565, 1, 0, 0, 0, 565, 55, 1, 0, 0, 0, 566, 578, 5,
11495
+ 203, 0, 0, 567, 572, 3, 160, 80, 0, 568, 569, 5, 208, 0, 0, 569, 571, 3, 160, 80, 0, 570, 568,
11496
11496
  1, 0, 0, 0, 571, 574, 1, 0, 0, 0, 572, 570, 1, 0, 0, 0, 572, 573, 1, 0, 0, 0, 573, 576, 1, 0, 0, 0,
11497
11497
  574, 572, 1, 0, 0, 0, 575, 577, 5, 208, 0, 0, 576, 575, 1, 0, 0, 0, 576, 577, 1, 0, 0, 0, 577, 579,
11498
11498
  1, 0, 0, 0, 578, 567, 1, 0, 0, 0, 578, 579, 1, 0, 0, 0, 579, 580, 1, 0, 0, 0, 580, 581, 5, 204, 0,
@@ -12782,9 +12782,6 @@ class MemberDeclarationContext extends antlr4_1.ParserRuleContext {
12782
12782
  methodDeclaration() {
12783
12783
  return this.getTypedRuleContext(MethodDeclarationContext, 0);
12784
12784
  }
12785
- fieldDeclaration() {
12786
- return this.getTypedRuleContext(FieldDeclarationContext, 0);
12787
- }
12788
12785
  constructorDeclaration() {
12789
12786
  return this.getTypedRuleContext(ConstructorDeclarationContext, 0);
12790
12787
  }
@@ -12800,6 +12797,9 @@ class MemberDeclarationContext extends antlr4_1.ParserRuleContext {
12800
12797
  propertyDeclaration() {
12801
12798
  return this.getTypedRuleContext(PropertyDeclarationContext, 0);
12802
12799
  }
12800
+ fieldDeclaration() {
12801
+ return this.getTypedRuleContext(FieldDeclarationContext, 0);
12802
+ }
12803
12803
  get ruleIndex() {
12804
12804
  return ApexParser.RULE_memberDeclaration;
12805
12805
  }
@@ -12832,9 +12832,6 @@ class TriggerMemberDeclarationContext extends antlr4_1.ParserRuleContext {
12832
12832
  methodDeclaration() {
12833
12833
  return this.getTypedRuleContext(MethodDeclarationContext, 0);
12834
12834
  }
12835
- fieldDeclaration() {
12836
- return this.getTypedRuleContext(FieldDeclarationContext, 0);
12837
- }
12838
12835
  interfaceDeclaration() {
12839
12836
  return this.getTypedRuleContext(InterfaceDeclarationContext, 0);
12840
12837
  }
@@ -12847,6 +12844,9 @@ class TriggerMemberDeclarationContext extends antlr4_1.ParserRuleContext {
12847
12844
  propertyDeclaration() {
12848
12845
  return this.getTypedRuleContext(PropertyDeclarationContext, 0);
12849
12846
  }
12847
+ fieldDeclaration() {
12848
+ return this.getTypedRuleContext(FieldDeclarationContext, 0);
12849
+ }
12850
12850
  get ruleIndex() {
12851
12851
  return ApexParser.RULE_triggerMemberDeclaration;
12852
12852
  }
@@ -12879,9 +12879,6 @@ class AnonymousMemberDeclarationContext extends antlr4_1.ParserRuleContext {
12879
12879
  methodDeclaration() {
12880
12880
  return this.getTypedRuleContext(MethodDeclarationContext, 0);
12881
12881
  }
12882
- fieldDeclaration() {
12883
- return this.getTypedRuleContext(FieldDeclarationContext, 0);
12884
- }
12885
12882
  interfaceDeclaration() {
12886
12883
  return this.getTypedRuleContext(InterfaceDeclarationContext, 0);
12887
12884
  }
@@ -12894,6 +12891,9 @@ class AnonymousMemberDeclarationContext extends antlr4_1.ParserRuleContext {
12894
12891
  propertyDeclaration() {
12895
12892
  return this.getTypedRuleContext(PropertyDeclarationContext, 0);
12896
12893
  }
12894
+ fieldDeclaration() {
12895
+ return this.getTypedRuleContext(FieldDeclarationContext, 0);
12896
+ }
12897
12897
  get ruleIndex() {
12898
12898
  return ApexParser.RULE_anonymousMemberDeclaration;
12899
12899
  }