mirror of
https://github.com/Noratrieb/crapderive.git
synced 2026-01-14 16:45:08 +01:00
improve ast debug pls
This commit is contained in:
parent
e6ea89b754
commit
5ca4cff1ca
1 changed files with 14 additions and 2 deletions
|
|
@ -46,12 +46,18 @@ pub fn lex(src: &str) -> Lexer<'_, Token<'_>> {
|
|||
<Token as Logos>::lexer(src)
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, DebugPls)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Stmt {
|
||||
pub kind: StmtKind,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl DebugPls for Stmt {
|
||||
fn fmt(&self, f: dbg_pls::Formatter<'_>) {
|
||||
DebugPls::fmt(&self.kind, f)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, DebugPls)]
|
||||
pub enum StmtKind {
|
||||
Mov { to: Expr, from: Expr },
|
||||
|
|
@ -65,12 +71,18 @@ pub enum StmtKind {
|
|||
Label { name: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, DebugPls)]
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Expr {
|
||||
pub kind: ExprKind,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl DebugPls for Expr {
|
||||
fn fmt(&self, f: dbg_pls::Formatter<'_>) {
|
||||
DebugPls::fmt(&self.kind, f)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, DebugPls)]
|
||||
pub enum ExprKind {
|
||||
Register(u8),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue