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;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"I" => Ok(Type::Int),
"F" => Ok(Type::Float),
match s.to_lowercase().as_str() {
"i" => Ok(Type::Int),
"f" => Ok(Type::Float),
_ => Err(SemanticErrorKind::UnknownType(s.to_string())),
}
}