1
0

support lowercase type

This commit is contained in:
2024-11-08 13:38:48 +03:00
parent a0c1648b17
commit 3c778abd00

View File

@@ -17,9 +17,9 @@ impl FromStr for Type {
type Err = SemanticErrorKind; type Err = SemanticErrorKind;
fn from_str(s: &str) -> Result<Self, Self::Err> { fn from_str(s: &str) -> Result<Self, Self::Err> {
match s { match s.to_lowercase().as_str() {
"I" => Ok(Type::Int), "i" => Ok(Type::Int),
"F" => Ok(Type::Float), "f" => Ok(Type::Float),
_ => Err(SemanticErrorKind::UnknownType(s.to_string())), _ => Err(SemanticErrorKind::UnknownType(s.to_string())),
} }
} }