hare

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

commit a52cf502c0e526128acf4ea6e37648ceed2ea9d3
parent a20e952715d8ce171aea568d63cd3909fbb00c3b
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Tue, 16 Feb 2021 20:10:40 -0500

hare::lex::lex_name: use variadic appends

Diffstat:
Mhare/lex/lex.ha | 10++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/hare/lex/lex.ha b/hare/lex/lex.ha @@ -92,10 +92,7 @@ fn lex_name(lex: *lexer) ((token, location) | io::EOF | error) = { match (next(lex)) { r: rune => { assert(is_name(r, false)); - let enc = utf8::encode_rune(r); - for (let i = 0z; i < len(enc); i += 1) { - append(chars, enc[i]); - }; + append(chars, ...utf8::encode_rune(r)); }, (io::EOF | io::error) => abort(), }; @@ -108,10 +105,7 @@ fn lex_name(lex: *lexer) ((token, location) | io::EOF | error) = { unget(lex, r); break; }; - let enc = utf8::encode_rune(r); - for (let i = 0z; i < len(enc); i += 1) { - append(chars, enc[i]); - }; + append(chars, ...utf8::encode_rune(r)); }, };