File tree Expand file tree Collapse file tree 5 files changed +8
-2
lines changed Expand file tree Collapse file tree 5 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ This changelog tracks the Rust `svdtools` project. See
55
66## [ Unreleased]
77
8+ * Fast fix for #161
9+
810## [ v0.3.2] 2023-10-01
911
1012* ` _modify ` ` derivedFrom ` for peripherals, clusters, registers and fields
Original file line number Diff line number Diff line change @@ -570,6 +570,7 @@ fn make_cpu(cmod: &Hash) -> Result<CpuBuilder> {
570570
571571/// Find left and right indices of enumeration token in specification string
572572fn spec_ind ( spec : & str ) -> ( usize , usize ) {
573+ let spec = spec. split ( ',' ) . next ( ) . unwrap_or ( spec) ;
573574 let li = spec
574575 . bytes ( )
575576 . position ( |b| b == b'*' )
Original file line number Diff line number Diff line change @@ -1120,7 +1120,6 @@ fn collect_in_array(
11201120 let mut registers = Vec :: new ( ) ;
11211121 let mut place = usize:: MAX ;
11221122 let mut i = 0 ;
1123- let ( li, ri) = spec_ind ( rspec) ;
11241123 while i < regs. len ( ) {
11251124 match & regs[ i] {
11261125 RegisterCluster :: Register ( Register :: Single ( r) ) if matchname ( & r. name , rspec) => {
@@ -1136,6 +1135,7 @@ fn collect_in_array(
11361135 return Err ( anyhow ! ( "{path}: registers {rspec} not found" ) ) ;
11371136 }
11381137 registers. sort_by_key ( |r| r. address_offset ) ;
1138+ let ( li, ri) = spec_ind ( rspec) ;
11391139 let dim = registers. len ( ) ;
11401140 let dim_index = if rmod. contains_key ( & "_start_from_zero" . to_yaml ( ) ) {
11411141 ( 0 ..dim) . map ( |v| v. to_string ( ) ) . collect :: < Vec < _ > > ( )
Original file line number Diff line number Diff line change @@ -358,7 +358,6 @@ impl RegisterExt for Register {
358358 let mut fields = Vec :: new ( ) ;
359359 let mut place = usize:: MAX ;
360360 let mut i = 0 ;
361- let ( li, ri) = spec_ind ( fspec) ;
362361 while i < fs. len ( ) {
363362 match & fs[ i] {
364363 Field :: Single ( f) if matchname ( & f. name , fspec) => {
@@ -374,6 +373,7 @@ impl RegisterExt for Register {
374373 return Err ( anyhow ! ( "{}: fields {fspec} not found" , self . name) ) ;
375374 }
376375 fields. sort_by_key ( |f| f. bit_range . offset ) ;
376+ let ( li, ri) = spec_ind ( fspec) ;
377377 let dim = fields. len ( ) ;
378378 let dim_index = if fmod. contains_key ( & "_start_from_zero" . to_yaml ( ) ) {
379379 ( 0 ..dim) . map ( |v| v. to_string ( ) ) . collect :: < Vec < _ > > ( )
Original file line number Diff line number Diff line change @@ -194,6 +194,9 @@ def spec_ind(spec):
194194 """
195195 Find left and right indices of enumeration token in specification string.
196196 """
197+ comma = spec .find ("," )
198+ if comma > - 1 :
199+ spec = spec [:comma ]
197200 li1 = spec .find ("*" )
198201 li2 = spec .find ("?" )
199202 li3 = spec .find ("[" )
You can’t perform that action at this time.
0 commit comments