support lowercase type
This commit is contained in:
@@ -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())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user