specctra: ignore case of list heads while parsing

This commit is contained in:
Tomasz Cichoń 2024-09-28 03:48:22 +02:00
parent fa298b01ae
commit 2a0b6464ae
1 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ pub enum ListToken {
impl ListToken { impl ListToken {
pub fn expect_start(self, name: &'static str) -> Result<(), ParseError> { pub fn expect_start(self, name: &'static str) -> Result<(), ParseError> {
if let Self::Start { name: actual_name } = self { if let Self::Start { name: actual_name } = self {
if name == actual_name { if name.eq_ignore_ascii_case(&actual_name) {
Ok(()) Ok(())
} else { } else {
Err(ParseError::ExpectedStartOfList(name)) Err(ParseError::ExpectedStartOfList(name))
@ -21,7 +21,7 @@ impl ListToken {
pub fn expect_any_start(self) -> Result<String, ParseError> { pub fn expect_any_start(self) -> Result<String, ParseError> {
if let Self::Start { name } = self { if let Self::Start { name } = self {
Ok(name) Ok(name.to_ascii_lowercase())
} else { } else {
Err(ParseError::ExpectedStartOfList("")) Err(ParseError::ExpectedStartOfList(""))
} }