summaryrefslogtreecommitdiff
path: root/src/sys/np/core/np_parse.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-01 02:25:49 -0400
committerIan Moffett <ian@osmora.org>2025-10-01 02:25:49 -0400
commite2503def53445f74d37fcbc5d67b956bd795092f (patch)
treedcee8336db27796afef480d78f6d60896152d022 /src/sys/np/core/np_parse.c
parentde12f97c8d41898255c7d9eed2c24b3c567b5747 (diff)
np: lex: Handle digits in the stream
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/np/core/np_parse.c')
-rw-r--r--src/sys/np/core/np_parse.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sys/np/core/np_parse.c b/src/sys/np/core/np_parse.c
index 165fed5..253b017 100644
--- a/src/sys/np/core/np_parse.c
+++ b/src/sys/np/core/np_parse.c
@@ -56,6 +56,9 @@ static const char *stoktab[] = {
/* Types */
[TT_U8] = "<TT_U8>",
+ /* Values */
+ [TT_NUMBER] = "<TT_NUMBER>",
+
/* Keywords */
[TT_BEGIN] = "<TT_BEGIN>",
[TT_PROC] = "<TT_PROC>",
@@ -79,11 +82,17 @@ parse_work(struct np_work *work)
return error;
}
+ /* Don't overflow the table */
if (tok.token > NELEM(stoktab)) {
pr_error("bad token %d\n", tok.token);
return -1;
}
+
+ /* Log the token */
printf("tok.type: %s\n", stoktab[tok.token]);
+ if (tok.token == TT_NUMBER) {
+ printf("tok.val: %d\n", tok.val);
+ }
}
return 0;