Skip to content

Commit 4a03b42

Browse files
committed
Merge #50
50: Parse <register><alternateRegister> elements r=Emilgardis a=wez In looking at rust-embedded/svd2rust#191 and rust-embedded/svd2rust#16 I thought that this might help, so here's the trivial patch.
2 parents 2be903c + 211ae3e commit 4a03b42

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.rs.bk
2+
[._]*.sw[a-p]
23
Cargo.lock
34
target
45
tests/

src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ pub struct ClusterInfo {
239239
#[derive(Clone, Debug)]
240240
pub struct RegisterInfo {
241241
pub name: String,
242+
pub alternate_group: Option<String>,
243+
pub alternate_register: Option<String>,
244+
pub derived_from: Option<String>,
242245
pub description: String,
243246
pub address_offset: u32,
244247
pub size: Option<u32>,
@@ -351,6 +354,9 @@ impl RegisterInfo {
351354
fn parse(tree: &Element) -> RegisterInfo {
352355
RegisterInfo {
353356
name: try!(tree.get_child_text("name")),
357+
alternate_group: tree.get_child_text("alternateGroup"),
358+
alternate_register: tree.get_child_text("alternateRegister"),
359+
derived_from: tree.attributes.get("derivedFrom").map(|s| s.to_owned()),
354360
description: try!(tree.get_child_text("description")),
355361
address_offset: {
356362
try!(parse::u32(try!(tree.get_child("addressOffset"))))

0 commit comments

Comments
 (0)