Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleect committed Dec 31, 2023
1 parent 106c2c5 commit ccba2f0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions res/grammar.lalrpop
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ Decl = {
Stmt,
}

DeclClass: ast::Stmt =
DeclClass: ast::Stmt = <class:StmtClass> => ast::Stmt::Class(<>);

StmtClass: ast::StmtClass =
"class" <name:identifier> <super_:("extends" <Spanned<ExprIdentifier>>)?> "{"
<fields:(<Spanned<StmtAssign>>)*>
<methods:(<Spanned<StmtFn>>)*>
"}" =>
ast::Stmt::Class(ast::StmtClass { <> });
ast::StmtClass { <> };

DeclFn: ast::Stmt = <function:StmtFn> => ast::Stmt::Fn(<>);

Expand Down

0 comments on commit ccba2f0

Please sign in to comment.