diff options
| author | Tolmachev Igor <me@igorek.dev> | 2026-05-09 20:47:04 +0300 |
|---|---|---|
| committer | Tolmachev Igor <me@igorek.dev> | 2026-05-09 20:47:04 +0300 |
| commit | 160b64427d79290a59ac48c9babca064232d8dfd (patch) | |
| tree | 0c2cc79f0a266761866ff325abdd4f2f0c7e7301 /compiler/src/ast/mod.rs | |
| parent | 6be28381d6081dfb3a1dc9d1ec15062b67ba1ef9 (diff) | |
| download | crisp-160b64427d79290a59ac48c9babca064232d8dfd.tar.gz crisp-160b64427d79290a59ac48c9babca064232d8dfd.zip | |
Make project structure more consistentdev
Diffstat (limited to 'compiler/src/ast/mod.rs')
| -rw-r--r-- | compiler/src/ast/mod.rs | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/compiler/src/ast/mod.rs b/compiler/src/ast/mod.rs index 8e35baf..2a0be03 100644 --- a/compiler/src/ast/mod.rs +++ b/compiler/src/ast/mod.rs | |||
| @@ -1,40 +1,10 @@ | |||
| 1 | mod error; | 1 | mod error; |
| 2 | mod models; | ||
| 2 | mod parser; | 3 | mod parser; |
| 3 | 4 | ||
| 4 | use std::rc::Rc; | ||
| 5 | |||
| 6 | use crate::span::Spanned; | ||
| 7 | pub use error::Error; | 5 | pub use error::Error; |
| 6 | pub use models::{Ast, Atom, Expr}; | ||
| 8 | pub use parser::Parser; | 7 | pub use parser::Parser; |
| 9 | 8 | ||
| 10 | #[cfg(test)] | 9 | #[cfg(test)] |
| 11 | mod tests; | 10 | mod tests; |
| 12 | |||
| 13 | #[derive(Clone, Debug, PartialEq)] | ||
| 14 | pub enum Atom { | ||
| 15 | Float(f64), | ||
| 16 | Integer(i64), | ||
| 17 | String(Rc<str>), | ||
| 18 | Symbol(Rc<str>), | ||
| 19 | Bool(bool), | ||
| 20 | Nil, | ||
| 21 | } | ||
| 22 | |||
| 23 | #[derive(Clone, Debug, PartialEq)] | ||
| 24 | pub enum Expr { | ||
| 25 | Atom(Atom), | ||
| 26 | List(Vec<Spanned<Expr>>), | ||
| 27 | } | ||
| 28 | |||
| 29 | #[derive(Clone, Debug, PartialEq)] | ||
| 30 | pub struct Program(Vec<Spanned<Expr>>); | ||
| 31 | |||
| 32 | impl Program { | ||
| 33 | pub fn inner(&self) -> &[Spanned<Expr>] { | ||
| 34 | &self.0 | ||
| 35 | } | ||
| 36 | |||
| 37 | pub fn into_inner(self) -> Vec<Spanned<Expr>> { | ||
| 38 | self.0 | ||
| 39 | } | ||
| 40 | } | ||
