match *lit {
token::Lit::Byte(val) |
token::Lit::Char(val) |
+ token::Lit::Err(val) |
token::Lit::Integer(val) |
token::Lit::Float(val) |
token::Lit::Str_(val) |
token::Literal(token::Byte(i), suf) => return mk_lit!("Byte", suf, i),
token::Literal(token::Char(i), suf) => return mk_lit!("Char", suf, i),
+ token::Literal(token::Err(i), suf) => return mk_lit!("Err", suf, i),
token::Literal(token::Integer(i), suf) => return mk_lit!("Integer", suf, i),
token::Literal(token::Float(i), suf) => return mk_lit!("Float", suf, i),
token::Literal(token::Str_(i), suf) => return mk_lit!("Str_", suf, i),
match lit {
token::Byte(i) => (true, Some(LitKind::Byte(byte_lit(&i.as_str()).0))),
token::Char(i) => (true, Some(LitKind::Char(char_lit(&i.as_str(), diag).0))),
+ token::Err(i) => (true, Some(LitKind::Char(char_lit(&i.as_str(), diag).0))),
// There are some valid suffixes for integer and float literals,
// so all the handling is done internally.
pub enum Lit {
Byte(ast::Name),
Char(ast::Name),
+ Err(ast::Name),
Integer(ast::Name),
Float(ast::Name),
Str_(ast::Name),
match *self {
Byte(_) => "byte literal",
Char(_) => "char literal",
+ Err(_) => "error literal",
Integer(_) => "integer literal",
Float(_) => "float literal",
Str_(_) | StrRaw(..) => "string literal",
let mut out = match lit {
token::Byte(b) => format!("b'{}'", b),
token::Char(c) => format!("'{}'", c),
+ token::Err(c) => format!("'{}'", c),
token::Float(c) |
token::Integer(c) => c.to_string(),
token::Str_(s) => format!("\"{}\"", s),