work
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
use super::*;
|
||||
|
||||
pub enum Type {
|
||||
Ident(Id<Ident>),
|
||||
}
|
||||
|
||||
impl Parsable for Type {
|
||||
fn parse(ctx: &mut ParseCtx) -> Result<Self, CompilerMsg> {
|
||||
Ok(match ctx.expect_next()? {
|
||||
Token::Ident(s) => Self::Ident(ctx.ident(s)),
|
||||
t => ctx.unexpected(&t, "a type")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl FmtNode for Type {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter, ctx: DisplayCtx) -> std::fmt::Result {
|
||||
match self {
|
||||
Type::Ident(id) => id.fmt(f, ctx),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user