From 6c5c627dd441b0e7ac52cfd05e1923584dd213ae Mon Sep 17 00:00:00 2001 From: Tolmachev Igor Date: Sat, 9 May 2026 18:39:11 +0300 Subject: Add parser tests --- compiler/src/ast/mod.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'compiler/src/ast/mod.rs') diff --git a/compiler/src/ast/mod.rs b/compiler/src/ast/mod.rs index 4587ea7..8e35baf 100644 --- a/compiler/src/ast/mod.rs +++ b/compiler/src/ast/mod.rs @@ -7,7 +7,10 @@ use crate::span::Spanned; pub use error::Error; pub use parser::Parser; -#[derive(Clone, Debug)] +#[cfg(test)] +mod tests; + +#[derive(Clone, Debug, PartialEq)] pub enum Atom { Float(f64), Integer(i64), @@ -17,11 +20,21 @@ pub enum Atom { Nil, } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq)] pub enum Expr { Atom(Atom), List(Vec>), } -#[derive(Clone, Debug)] -pub struct Program(pub Vec>); +#[derive(Clone, Debug, PartialEq)] +pub struct Program(Vec>); + +impl Program { + pub fn inner(&self) -> &[Spanned] { + &self.0 + } + + pub fn into_inner(self) -> Vec> { + self.0 + } +} -- cgit v1.3