Finish up literal printing
diff --git a/src/lit.rs b/src/lit.rs
index f0b1430..b143a9d 100644
--- a/src/lit.rs
+++ b/src/lit.rs
@@ -184,10 +184,12 @@
escaped.push('"');
tokens.append(&escaped);
}
+ Lit::Byte(b) => tokens.append(&format!("b{:?}", b)),
+ Lit::Char(ch) => ch.to_tokens(tokens),
Lit::Int(value, ty) => tokens.append(&format!("{}{}", value, ty)),
+ Lit::Float(ref value, ty) => tokens.append(&format!("{}{}", value, ty)),
Lit::Bool(true) => tokens.append("true"),
Lit::Bool(false) => tokens.append("false"),
- _ => unimplemented!(),
}
}
}
@@ -209,4 +211,14 @@
}
}
}
+
+ impl Display for FloatTy {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+ match *self {
+ FloatTy::F32 => formatter.write_str("f32"),
+ FloatTy::F64 => formatter.write_str("f64"),
+ FloatTy::Unsuffixed => Ok(()),
+ }
+ }
+ }
}