Block/scope parsing.

This commit is contained in:
2026-11-15 12:11:26 +01:00
parent 3002eedbdf
commit 592e476f29
2 changed files with 55 additions and 1 deletions
+13
View File
@@ -5,6 +5,7 @@ pub enum Stmt {
Let(Let),
Assign(Assign),
Expr(Expr),
Block(Block),
Fn(FnDef),
}
@@ -26,6 +27,12 @@ impl From<Expr> for Stmt {
}
}
impl From<Block> for Stmt {
fn from(block: Block) -> Self {
Stmt::Block(block)
}
}
impl From<FnDef> for Stmt {
fn from(fn_def: FnDef) -> Self {
Stmt::Fn(fn_def)
@@ -55,6 +62,12 @@ pub struct FnDef {
pub span: Span,
}
#[derive(Debug, PartialEq)]
pub struct Block {
pub stmts: Vec<Stmt>,
pub span: Span,
}
#[derive(Debug, PartialEq)]
pub struct FnParam {
pub name: Ident,