hare

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

commit 51a44fc92817813fb07ba8a4aadacaaa173cd135
parent b2d50dc9e031fa4bcb8988cec90f3b1ac43ab469
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Sat,  3 Apr 2021 22:56:27 -0400

hare::parse::decls: permit empty subunits

Diffstat:
Mhare/parse/decl.ha | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hare/parse/decl.ha b/hare/parse/decl.ha @@ -155,6 +155,10 @@ fn decl_func(lexer: *lex::lexer) (ast::decl_func | error) = { export fn decls(lexer: *lex::lexer) ([]ast::decl | error) = { let decls: []ast::decl = []; for (true) { + match (lex::lex(lexer)?) { + io::EOF => break, + t: (lex::token, lex::location) => lex::unlex(lexer, t), + }; let exported = match (try_btoken(lexer, btoken::EXPORT)?) { void => false, lex::btoken => true, @@ -185,10 +189,6 @@ export fn decls(lexer: *lex::lexer) ([]ast::decl | error) = { decl = decl, }); want_btoken(lexer, btoken::SEMICOLON)?; - match (lex::lex(lexer)?) { - io::EOF => break, - t: (lex::token, lex::location) => lex::unlex(lexer, t), - }; }; return decls; };