24 lines
541 B
Rust
24 lines
541 B
Rust
use crate::{
|
|
arch::x86_64::Code,
|
|
parser::{Node, cursor::Token},
|
|
};
|
|
|
|
pub mod x86_64;
|
|
|
|
pub enum AsmBlock {
|
|
X86_64(Code),
|
|
}
|
|
|
|
impl Node for AsmBlock {
|
|
fn parse(ctx: &mut crate::parser::ParseCtx) -> Result<Self, crate::io::CompilerMsg> {
|
|
ctx.expect(Token::OpenCurly)?;
|
|
let asm = ctx.parse()?;
|
|
ctx.expect(Token::CloseCurly)?;
|
|
Ok(Self::X86_64(asm))
|
|
}
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter, ctx: crate::parser::DisplayCtx) -> std::fmt::Result {
|
|
write!(f, "asm {{ ... }}")
|
|
}
|
|
}
|