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
5
5
6
6
## [ Unreleased]
7
7
8
+ * Fast fix for #161
9
+
8
10
## [ v0.3.2] 2023-10-01
9
11
10
12
* ` _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> {
570
570
571
571
/// Find left and right indices of enumeration token in specification string
572
572
fn spec_ind ( spec : & str ) -> ( usize , usize ) {
573
+ let spec = spec. split ( ',' ) . next ( ) . unwrap_or ( spec) ;
573
574
let li = spec
574
575
. bytes ( )
575
576
. position ( |b| b == b'*' )
Original file line number Diff line number Diff line change @@ -1120,7 +1120,6 @@ fn collect_in_array(
1120
1120
let mut registers = Vec :: new ( ) ;
1121
1121
let mut place = usize:: MAX ;
1122
1122
let mut i = 0 ;
1123
- let ( li, ri) = spec_ind ( rspec) ;
1124
1123
while i < regs. len ( ) {
1125
1124
match & regs[ i] {
1126
1125
RegisterCluster :: Register ( Register :: Single ( r) ) if matchname ( & r. name , rspec) => {
@@ -1136,6 +1135,7 @@ fn collect_in_array(
1136
1135
return Err ( anyhow ! ( "{path}: registers {rspec} not found" ) ) ;
1137
1136
}
1138
1137
registers. sort_by_key ( |r| r. address_offset ) ;
1138
+ let ( li, ri) = spec_ind ( rspec) ;
1139
1139
let dim = registers. len ( ) ;
1140
1140
let dim_index = if rmod. contains_key ( & "_start_from_zero" . to_yaml ( ) ) {
1141
1141
( 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 {
358
358
let mut fields = Vec :: new ( ) ;
359
359
let mut place = usize:: MAX ;
360
360
let mut i = 0 ;
361
- let ( li, ri) = spec_ind ( fspec) ;
362
361
while i < fs. len ( ) {
363
362
match & fs[ i] {
364
363
Field :: Single ( f) if matchname ( & f. name , fspec) => {
@@ -374,6 +373,7 @@ impl RegisterExt for Register {
374
373
return Err ( anyhow ! ( "{}: fields {fspec} not found" , self . name) ) ;
375
374
}
376
375
fields. sort_by_key ( |f| f. bit_range . offset ) ;
376
+ let ( li, ri) = spec_ind ( fspec) ;
377
377
let dim = fields. len ( ) ;
378
378
let dim_index = if fmod. contains_key ( & "_start_from_zero" . to_yaml ( ) ) {
379
379
( 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):
194
194
"""
195
195
Find left and right indices of enumeration token in specification string.
196
196
"""
197
+ comma = spec .find ("," )
198
+ if comma > - 1 :
199
+ spec = spec [:comma ]
197
200
li1 = spec .find ("*" )
198
201
li2 = spec .find ("?" )
199
202
li3 = spec .find ("[" )
You can’t perform that action at this time.
0 commit comments