diff --git a/examples/wip.rs b/examples/wip.rs index 4e7015b3b744b8150fff2ba06d10a4091786e380..cc3412ec5e8f4630cb155f7816609bd8f29fdcbe 100644 --- a/examples/wip.rs +++ b/examples/wip.rs @@ -1,3 +1,4 @@ fn main() { + {} a; } diff --git a/src/grammar.lalrpop b/src/grammar.lalrpop index 0ad634c853ba18109d4298f078d2bac9322c3888..843bb45b96dcbda8f36853713dcc64a6114037a3 100644 --- a/src/grammar.lalrpop +++ b/src/grammar.lalrpop @@ -155,29 +155,15 @@ pub Block: Stmts = { StmtSeq: Stmt = { <Stmt> ";" => <>, - StmtBlock => panic!(), + StmtBlock => Stmt::Block(<>), } StmtBlock: Stmts = { "while" Expr Block => panic!(), "if" Expr Block ("else" Block)? => panic!(), - Block => panic!(), + Block, } -// Stmt: Stmt = { - // ";" => Stmt::Semi, -// "let" "mut"? Id "=" Expr ";" => (), -// ExprNoBlock "=" Expr => (), -// "while" Expr Block => (), -// "if" Expr Block ("else" Block)? => (), -// ExprNoBlock => (), -// Block => (), -// } - - - - - Stmt: Stmt = { ";" => Stmt::Semi, //"let" <m: "mut"?> <id: Id> <t: (":" <Type>)?> <e: ("=" <Expr>)?> => Stmt::Let(id, m.is_some(), t, e),