hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 326fb39fdeda4062dca9abcb268a1d8a56c1af04
parent a7ec0904d08b31115d40bd6960ff7905ac01a55b
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri, 16 Apr 2021 15:17:27 -0400

hare::parse::expression: don't unwrap errors twice

Diffstat:
Mhare/parse/expr.ha | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/hare/parse/expr.ha b/hare/parse/expr.ha @@ -12,13 +12,13 @@ export fn expression(lexer: *lex::lexer) (ast::expr | error) = { tok: lex::token => tok, }; return switch (tok.0) { - ltok::LBRACE => expression_list(lexer)?, + ltok::LBRACE => expression_list(lexer), ltok::MATCH => abort(), // TODO ltok::SWITCH => abort(), // TODO ltok::IF => abort(), // TODO ltok::FOR => abort(), // TODO ltok::BREAK, ltok::CONTINUE, ltok::RETURN => - control_statement(lexer)?, + control_statement(lexer), ltok::LET, ltok::CONST => abort(), // TODO * => abort(), // Invariant }; @@ -233,10 +233,8 @@ fn plain_expression(lexer: *lex::lexer) (ast::expr | error) = { return constant(lexer); }; return switch (tok.0) { - ltok::TRUE, - ltok::FALSE, - ltok::NULL, - ltok::VOID => constant(lexer), + ltok::TRUE, ltok::FALSE, ltok::NULL, ltok::VOID => + constant(lexer), ltok::LBRACKET => abort(), // TODO: Array literal ltok::STRUCT => abort(), // TODO: Struct literal ltok::LPAREN => {