commit 67f02b305e7ae20a24bd6434e6a57bffbdf5e33c
parent cd18e31f80cb5d0d143e728905aac62c96d0ef4a
Author: Eyal Sawady <ecs@d2evs.net>
Date: Sat, 27 Mar 2021 00:10:55 -0400
hare::parse: reimplement void constants
To fix the tests
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/hare/parse/expr.ha b/hare/parse/expr.ha
@@ -20,18 +20,19 @@ export fn compound_expression(lexer: *lex::lexer) (ast::expr | error) = {
btoken::LBRACE => expression_list(lexer),
btoken::BREAK, btoken::CONTINUE, btoken::RETURN =>
control_statement(lexer),
- * => abort(),
+ * => complex_expression(lexer),
};
};
// Parses a simple-expression
export fn simple_expression(lexer: *lex::lexer) (ast::expr | error) = {
- abort(); // TODO
+ want_btoken(lexer, btoken::VOID)?; // TODO
+ return void;
};
// Parses a complex-expression
export fn complex_expression(lexer: *lex::lexer) (ast::expr | error) = {
- abort(); // TODO
+ return simple_expression(lexer); // TODO
};
fn expression_list(lexer: *lex::lexer) (ast::expr | error) = {
@@ -66,7 +67,7 @@ fn expression_list(lexer: *lex::lexer) (ast::expr | error) = {
};
fn scope_expression(lexer: *lex::lexer) (ast::expr | error) = {
- abort(); // TODO
+ return simple_expression(lexer); // TODO
};
fn control_statement(lexer: *lex::lexer) (ast::expr | error) = {