commit 9b3040e17587e3e60425b00844662d90976de480
parent c196783a54f35016b6b33570690cc5945c6d7621
Author: Eyal Sawady <ecs@d2evs.net>
Date: Fri, 16 Apr 2021 23:15:29 -0400
lex::literal: fix handling of z/i16/u16 suffixes
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hare/lex/lex.ha b/hare/lex/lex.ha
@@ -401,8 +401,8 @@ fn lex_literal(lex: *lexer, loc: location) (token | error) = {
let val = strings::fromutf8(chars[..end]);
let val = switch (suff) {
- ltok::LIT_U8, ltok::LIT_U64, ltok::LIT_U32, ltok::LIT_U64,
- ltok::LIT_UINT => strconv::stou64b(val, base),
+ ltok::LIT_U8, ltok::LIT_U16, ltok::LIT_U32, ltok::LIT_U64,
+ ltok::LIT_UINT, ltok::LIT_SIZE => strconv::stou64b(val, base),
ltok::LIT_ICONST => match (strconv::stoi64b(val, base)) {
i: i64 => i,
strconv::invalid => abort(),
@@ -411,7 +411,7 @@ fn lex_literal(lex: *lexer, loc: location) (token | error) = {
strconv::stou64b(val, base);
} else strconv::overflow,
},
- ltok::LIT_I8, ltok::LIT_I64, ltok::LIT_I32, ltok::LIT_I64,
+ ltok::LIT_I8, ltok::LIT_I16, ltok::LIT_I32, ltok::LIT_I64,
ltok::LIT_INT => strconv::stoi64b(val, base),
ltok::LIT_F32, ltok::LIT_F64, ltok::LIT_FCONST => abort(), // TODO
};