hare

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

commit 381d598e7a5799757b75f871096011fa899c6556
parent 1e3eccc3ec9aabd16f29bdb148bef3b6eae4c559
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri, 16 Apr 2021 10:32:03 -0400

hare::parse: implement object selectors

Diffstat:
Mhare/parse/+test/expr.ha | 4++--
Mhare/parse/expr.ha | 5++++-
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/hare/parse/+test/expr.ha b/hare/parse/+test/expr.ha @@ -41,10 +41,10 @@ }; @test fn unarithm() void = { - // TODO: object selectors/addr operator roundtrip("export fn main() void = +void;\n" "export fn main() void = -void;\n" "export fn main() void = *void;\n" "export fn main() void = ~void;\n" - "export fn main() void = !void;\n"); + "export fn main() void = !void;\n" + "export fn main() void = &x;\n"); }; diff --git a/hare/parse/expr.ha b/hare/parse/expr.ha @@ -196,7 +196,10 @@ fn indexing(lexer: *lex::lexer, lvalue: ast::expr) (ast::expr | error) = { }; fn objsel(lexer: *lex::lexer) (ast::expr | error) = { - abort(); // TODO + let expr = postfix(lexer, void)?; + synassert(mkloc(lexer), expr is ast::access_expr, + "Expected object selector")?; + return expr; }; fn plain_expression(lexer: *lex::lexer) (ast::expr | error) = {