class def

This commit is contained in:
bronku 2025-11-30 11:32:47 +01:00
parent 5f560f079b
commit 878dfe74e0
4 changed files with 14 additions and 6 deletions

View file

@ -94,9 +94,18 @@ stmt:
| KW_RETURN expr NEWLINE {
$$ = std::make_unique<Return>(std::move($2));
}
| KW_RETURN NEWLINE {
$$ = std::make_unique<Return>(nullptr);
}
| KW_PASS NEWLINE {
$$ = std::make_unique<Pass>();
}
| KW_WHILE expr COLON NEWLINE INDENT stmt_list DEDENT {
$$ = std::make_unique<While>(std::move($2), std::move($6));
}
| KW_CLASS IDENTIFIER COLON NEWLINE INDENT stmt_list DEDENT {
$$ = std::make_unique<ClassDef>(std::move($2), std::move($6));
}
;
expr: