@@ -27,6 +27,21 @@ pub trait PeripheralExt: InterruptExt + RegisterBlockExt {
27
27
28
28
/// Collecting methods for processing cluster contents
29
29
pub trait ClusterExt : RegisterBlockExt {
30
+ const KEYWORDS : & ' static [ & ' static str ] = & [
31
+ "_add" ,
32
+ "_copy" ,
33
+ "_delete" ,
34
+ "_derive" ,
35
+ "_modify" ,
36
+ "_strip" ,
37
+ "_strip_end" ,
38
+ "_expand_array" ,
39
+ "_expand_cluster" ,
40
+ "_array" ,
41
+ "_cluster" ,
42
+ "_clusters" ,
43
+ ] ;
44
+
30
45
/// Work through a cluster, handling all registers
31
46
fn process ( & mut self , peripheral : & Hash , pname : & str , config : & Config ) -> PatchResult ;
32
47
@@ -716,7 +731,7 @@ impl RegisterBlockExt for Peripheral {
716
731
}
717
732
718
733
impl ClusterExt for Cluster {
719
- fn pre_process ( & mut self , pmod : & Hash , _pname : & str , config : & Config ) -> PatchResult {
734
+ fn pre_process ( & mut self , pmod : & Hash , _pname : & str , _config : & Config ) -> PatchResult {
720
735
// Handle deletions
721
736
if let Some ( deletions) = pmod. get ( & "_delete" . to_yaml ( ) ) {
722
737
match deletions {
@@ -878,6 +893,12 @@ impl ClusterExt for Cluster {
878
893
}
879
894
}
880
895
896
+ Ok ( ( ) )
897
+ }
898
+
899
+ fn process ( & mut self , pmod : & Hash , pname : & str , config : & Config ) -> PatchResult {
900
+ self . pre_process ( pmod, pname, config) ?;
901
+
881
902
// Handle clusters
882
903
for ( cspec, cluster) in pmod. hash_iter ( "_clusters" ) {
883
904
let cspec = cspec. str ( ) ?;
@@ -887,12 +908,6 @@ impl ClusterExt for Cluster {
887
908
}
888
909
}
889
910
890
- Ok ( ( ) )
891
- }
892
-
893
- fn process ( & mut self , pmod : & Hash , pname : & str , config : & Config ) -> PatchResult {
894
- self . pre_process ( pmod, pname, config) ?;
895
-
896
911
// Handle registers
897
912
for ( rspec, register) in pmod {
898
913
let rspec = rspec. str ( ) ?;
@@ -1381,7 +1396,7 @@ fn collect_in_cluster(
1381
1396
1382
1397
for ( rspec, rmod) in cmod {
1383
1398
let rspec = rspec. str ( ) ?;
1384
- if rspec == "description" || rspec == "dimIncrement" || rspec . starts_with ( '_' ) {
1399
+ if [ "description" , "dimIncrement" ] . contains ( & rspec ) || Cluster :: KEYWORDS . contains ( & rspec ) {
1385
1400
continue ;
1386
1401
}
1387
1402
let mut registers = Vec :: new ( ) ;
0 commit comments