diff options
author | Ian Moffett <ian@osmora.org> | 2025-09-30 22:30:20 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-09-30 22:30:20 -0400 |
commit | 0ec22cf8ffdc4fba512883a006126962f1ee29d9 (patch) | |
tree | 3fb6854675f922d0547b6029a482106a60ab1d59 /src/sys/np | |
parent | 56a20074863641eb994e298afb4b38b27a277406 (diff) |
np: lex: Parse identifiers and commas
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/np')
-rw-r--r-- | src/sys/np/core/np_lex.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/sys/np/core/np_lex.c b/src/sys/np/core/np_lex.c index 639e945..436df16 100644 --- a/src/sys/np/core/np_lex.c +++ b/src/sys/np/core/np_lex.c @@ -102,9 +102,15 @@ lex_cmptok(char *tokstr, struct lex_token *res) res->token = TT_PROC; } return 0; + case 'u': + if (strcmp(tokstr, TOKEN_U8) == 0) { + res->token = TT_U8; + } + return 0; } - return -1; + res->token = TT_IDENT; + return 0; } /* @@ -157,7 +163,7 @@ int lex_nom(struct np_work *work, struct lex_token *res) { struct lexer_state *lex_st; - int error = -1; + int error = 0; char c; if (work == NULL || res == NULL) { @@ -183,6 +189,9 @@ lex_nom(struct np_work *work, struct lex_token *res) case ')': res->token = TT_RPAREN; break; + case ',': + res->token = TT_COMMA; + break; default: /* Stuff like '1var_name' is invalid */ if (!is_alpha(c)) { |