diff --git a/src/ast.rs b/src/ast.rs index 9f71b31..51e8b18 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -1,11 +1,5 @@ use crate::tokens::Token; -/// This trait should be implemented by nodes to allow AST dumps. -pub trait AstDumper { - /// Dump the node as a string. - fn dump(&self) -> String; -} - /// An AST node that represents an expression. #[derive(Debug, Clone)] pub enum ExprNode { @@ -29,6 +23,16 @@ pub enum ExprNode { Litteral { value: Token }, } +/* -------------------------------- * + * Dumper trait and implementations * + * -------------------------------- */ + +/// This trait should be implemented by nodes to allow AST dumps. +pub trait AstDumper { + /// Dump the node as a string. + fn dump(&self) -> String; +} + impl AstDumper for ExprNode { fn dump(&self) -> String { match self {