work
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
use super::*;
|
||||
|
||||
pub struct Ident {
|
||||
pub inner: String,
|
||||
}
|
||||
|
||||
impl FmtNode for Ident {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter, _: DisplayCtx) -> std::fmt::Result {
|
||||
write!(f, "{}", self.inner)
|
||||
}
|
||||
}
|
||||
|
||||
impl Parsable for Ident {
|
||||
fn parse(ctx: &mut super::ParseCtx) -> Result<Self, crate::io::CompilerMsg> {
|
||||
match ctx.expect_next()? {
|
||||
Token::Ident(ident) => Ok(Self { inner: ident }),
|
||||
t => ctx.unexpected(t, "an identifier"),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user