hare

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

commit 87e128dec27e8d0c269365ad52a169c5e8375573
parent ed5de1c89cfc1407726c131842e40ebc5512c48a
Author: Sebastian <sebastian@sebsite.pw>
Date:   Sat,  5 Aug 2023 20:26:21 -0400

hare::*: remove unary +

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mhare/ast/expr.ha | 1-
Mhare/parse/+test/expr_test.ha | 3+--
Mhare/parse/expr.ha | 5+----
Mhare/unparse/expr.ha | 2--
4 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/hare/ast/expr.ha b/hare/ast/expr.ha @@ -385,7 +385,6 @@ export type unarithm_op = enum { DEREF, // * LNOT, // ! MINUS, // - - PLUS, // + }; // A unary arithmetic expression. diff --git a/hare/parse/+test/expr_test.ha b/hare/parse/+test/expr_test.ha @@ -292,8 +292,7 @@ }; @test fn unarithm() void = { - roundtrip("export fn main() void = +void;\n\n" - "export fn main() void = -void;\n\n" + roundtrip("export fn main() void = -void;\n\n" "export fn main() void = *void;\n\n" "export fn main() void = ~void;\n\n" "export fn main() void = !void;\n\n" diff --git a/hare/parse/expr.ha b/hare/parse/expr.ha @@ -1227,8 +1227,7 @@ fn match_expr(lexer: *lex::lexer) (ast::expr | error) = { fn unarithm(lexer: *lex::lexer) (ast::expr | error) = { const tok = match (try(lexer, - ltok::PLUS, ltok::MINUS, ltok::BNOT, - ltok::LNOT, ltok::TIMES, ltok::BAND, + ltok::MINUS, ltok::BNOT, ltok::LNOT, ltok::TIMES, ltok::BAND, ltok::SWITCH, ltok::MATCH, ltok::COLON, ltok::LBRACE)?) { case void => return builtin(lexer); @@ -1249,8 +1248,6 @@ fn unarithm(lexer: *lex::lexer) (ast::expr | error) = { }; const op = switch (tok.0) { - case ltok::PLUS => - yield ast::unarithm_op::PLUS; case ltok::MINUS => yield ast::unarithm_op::MINUS; case ltok::BNOT => diff --git a/hare/unparse/expr.ha b/hare/unparse/expr.ha @@ -400,8 +400,6 @@ export fn expr( yield "!"; case ast::unarithm_op::MINUS => yield "-"; - case ast::unarithm_op::PLUS => - yield "+"; })?; z += expr(out, indent, *e.operand)?; return z;