From 8426f3bb40dd2391e26cd087a0d6510fe21fdcbc Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Thu, 14 Nov 2024 21:15:35 +0100 Subject: [PATCH] Make access parsing case-insensitive. SVDs from Nordic are using `read-writeonce` instead of `read-writeOnce`. --- svd-rs/src/access.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/svd-rs/src/access.rs b/svd-rs/src/access.rs index 09a60ba1..dc4d4946 100644 --- a/svd-rs/src/access.rs +++ b/svd-rs/src/access.rs @@ -48,12 +48,12 @@ impl Default for Access { impl Access { /// Parse a string into an [`Access`] value, returning [`Option::None`] if the string is not valid. pub fn parse_str(s: &str) -> Option { - match s { + match s.to_ascii_lowercase().as_str() { "read-only" => Some(Self::ReadOnly), "read-write" => Some(Self::ReadWrite), - "read-writeOnce" => Some(Self::ReadWriteOnce), + "read-writeonce" => Some(Self::ReadWriteOnce), "write-only" => Some(Self::WriteOnly), - "writeOnce" => Some(Self::WriteOnce), + "writeonce" => Some(Self::WriteOnce), _ => None, } }