diff --git a/src/ast.rs b/src/ast.rs index 3d73d33..50707e0 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -27,6 +27,7 @@ pub enum StmtNode { }, /// While loop statement. WhileStmt { + label: Option, condition: ExprNode, body: Box, }, @@ -124,8 +125,21 @@ impl AstDumper for StmtNode { ), }, - Self::WhileStmt { condition, body } => { - format!("( while {} {} )", condition.dump(), body.dump()) + Self::WhileStmt { + label, + condition, + body, + } => { + format!( + "( {}while {} {} )", + if let Some(label) = label { + &format!("@{} ", label.lexeme) + } else { + "" + }, + condition.dump(), + body.dump() + ) } Self::LoopControlStmt {