diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-01 18:36:21 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-01 18:38:36 -0400 |
commit | a3ac3a7b214991e3b555145dfc1348c58bf54349 (patch) | |
tree | d8d32a7139810b75094c9043976ddc032689c1af /src/sys/np/core/np_lex.c | |
parent | e0f16855cb1e5f0465db13405b6524682847688c (diff) |
np: lex: Add the rest of the UINT tokens
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/np/core/np_lex.c')
-rw-r--r-- | src/sys/np/core/np_lex.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/sys/np/core/np_lex.c b/src/sys/np/core/np_lex.c index eb15a52..fffe465 100644 --- a/src/sys/np/core/np_lex.c +++ b/src/sys/np/core/np_lex.c @@ -81,6 +81,37 @@ lex_pop(struct np_work *work) } /* + * Compare a token with existing integer types (used internally) + */ +static void +lex_cmp_itype(const char *tokstr, struct lex_token *res) +{ + switch (*tokstr) { + case 'u': + if (strcmp(tokstr, TOKEN_U8) == 0) { + res->token = TT_U8; + break; + } + + if (strcmp(tokstr, TOKEN_U16) == 0) { + res->token = TT_U16; + break; + } + + if (strcmp(tokstr, TOKEN_U32) == 0) { + res->token = TT_U32; + break; + } + + if (strcmp(tokstr, TOKEN_U64) == 0) { + res->token = TT_U64; + break; + } + break; + } +} + +/* * Compare a token with existing tokens (used internally) */ static int @@ -103,9 +134,8 @@ lex_cmptok(char *tokstr, struct lex_token *res) } return 0; case 'u': - if (strcmp(tokstr, TOKEN_U8) == 0) { - res->token = TT_U8; - } + case 'i': + lex_cmp_itype(tokstr, res); return 0; } |