commit f60598635a47af86daabdf828570a2c46b32b5bb
parent 9054651a537765e32aecf53d65be32f12476b871
Author: Eyal Sawady <ecs@d2evs.net>
Date: Mon, 24 May 2021 04:23:35 -0400
hare::lex::next: simplify
Signed-off-by: Eyal Sawady <ecs@d2evs.net>
Diffstat:
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/hare/lex/lex.ha b/hare/lex/lex.ha
@@ -760,17 +760,13 @@ fn next(lex: *lexer) (rune | io::EOF | io::error) = {
},
};
- for (true) {
- return match (bufio::scanrune(lex.in)) {
- e: (io::EOF | io::error) => e,
- r: rune => {
- lexloc(lex, r);
- r;
- },
- };
+ return match (bufio::scanrune(lex.in)) {
+ e: (io::EOF | io::error) => e,
+ r: rune => {
+ lexloc(lex, r);
+ return r;
+ },
};
-
- abort("unreachable");
};
fn nextw(lex: *lexer) ((rune, location) | io::EOF | io::error) = {