use super::*; pub struct Ident { pub name: String, pub span: Span, } impl Node for Ident { fn parse(ctx: &mut super::ParseCtx) -> Result { match ctx.expect_next()? { Token::Ident(ident) => Ok(ctx.ident(ident)), t => ctx.unexpected(t, "an identifier"), } } fn fmt(&self, f: &mut std::fmt::Formatter, _: DisplayCtx) -> std::fmt::Result { write!(f, "{}", self.name) } } impl std::fmt::Display for Ident { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.name.fmt(f) } }