18 lines
448 B
Rust
18 lines
448 B
Rust
mod ctx;
|
|
mod dsp;
|
|
pub use ctx::*;
|
|
pub use dsp::*;
|
|
|
|
use crate::io::CompilerMsg;
|
|
|
|
pub trait Node: Sized {
|
|
fn parse(ctx: &mut ParseCtx) -> Result<Self, CompilerMsg>;
|
|
fn fmt(&self, f: &mut std::fmt::Formatter, ctx: DisplayCtx) -> std::fmt::Result;
|
|
fn dsp(&self, ctx: DisplayCtx) -> NodeDsp<'_, Self> {
|
|
NodeDsp { node: self, ctx }
|
|
}
|
|
fn new_dsp(&self) -> NodeDsp<'_, Self> {
|
|
self.dsp(DisplayCtx { indent: 0 })
|
|
}
|
|
}
|