hare

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

commit 00cb3797fb9c4f4be58f2d9dc24c70b1661e4fd3
parent 6819be4ca17e4ba60baf222f30274462761ff665
Author: Armin Weigl <tb46305@gmail.com>
Date:   Thu, 25 Feb 2021 18:15:13 +0100

fix trailing comma in member import

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

diff --git a/hare/parse/+test.ha b/hare/parse/+test.ha @@ -135,7 +135,7 @@ use strings; const in = "use foo::{bar};\n" "use baz::{bat, qux};\n" - "use quux::corge::{grault, garply};\n" + "use quux::corge::{grault, garply,};\n" "export fn main() void = void;"; let buf = bufio::fixed(strings::to_utf8(in), mode::READ); let lexer = lex::lexer_init(buf, "<test>"); diff --git a/hare/parse/parse.ha b/hare/parse/parse.ha @@ -35,7 +35,10 @@ fn parse_name_list(lexer: *lex::lexer) ([]str | error) = { for (true) { append(names, want_name(lexer)?: str); switch (want_btoken(lexer, btoken::COMMA, btoken::RBRACE)?) { - btoken::COMMA => void, + btoken::COMMA => match (try_btoken(lexer, btoken::RBRACE)?) { + void => void, + * => return names, + }, btoken::RBRACE => return names, * => abort(), // Unreachable };