From 407fbe26b0d56f57ccc4d5542119e1402957cce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 31 Dec 2022 14:27:20 +0100 Subject: [PATCH] AST - Moved dumper trait out of the way --- src/ast.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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 {