summaryrefslogtreecommitdiff
path: root/src/ast.rs
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-09-27 18:22:50 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-09-27 18:22:50 +0800
commitb120e413d21a9d4d1961bb814dff88531a7a4855 (patch)
treee599417c385ff00ac15c48d727a3588462972208 /src/ast.rs
parent76af2f9a4a06140d7e00706817b59678c4468d1a (diff)
fix(parser): EndScope not preserved
chore(parser): simplify
Diffstat (limited to 'src/ast.rs')
-rw-r--r--src/ast.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ast.rs b/src/ast.rs
index 8b13789..9777d4e 100644
--- a/src/ast.rs
+++ b/src/ast.rs
@@ -1 +1,27 @@
+use crate::parser::{self, Expr, ExprT, Scope};
+pub enum DepthExpr<'a> {
+ Decision {
+ cond: Box<DepthExpr<'a>>,
+ t: Scope,
+ else_branch: Option<Box<DepthExpr<'a>>>,
+ },
+ IO(&'a str),
+ Process(&'a str),
+}
+
+fn parse(vec: Vec<Expr>) -> Vec<DepthExpr> {
+ let exprs = Vec::new();
+
+ let mut it = vec
+ .iter()
+ .peekable();
+
+ while let Some(e) = it.next() {
+ if let ExprT::Decision((cond, scope)) = e.expr {
+ let cond = parser::parse(cond);
+ }
+ }
+
+ exprs
+}