summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-01 16:32:58 -0400
committerIan Moffett <ian@osmora.org>2025-10-01 16:32:58 -0400
commitec3f0a41258099b4aa04ce236d062ffe0580f27d (patch)
treedce0bdacf45a68801c48ee7717aeb58bfd464df5 /src/sys
parentdb61b5925966587717a17d48339bc8fea58a142b (diff)
np: lex: Add TT_NONE token for invalid types
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/include/np/lex.h3
-rw-r--r--src/sys/np/core/np_lex.c1
-rw-r--r--src/sys/np/core/np_parse.c3
3 files changed, 7 insertions, 0 deletions
diff --git a/src/sys/include/np/lex.h b/src/sys/include/np/lex.h
index 9c6e69e..cbbc403 100644
--- a/src/sys/include/np/lex.h
+++ b/src/sys/include/np/lex.h
@@ -47,6 +47,9 @@ struct np_work;
* possible
*/
typedef enum {
+ /* Reserved */
+ TT_NONE, /* Always invalid */
+
/* Symbols */
TT_LPAREN, /* '(' */
TT_RPAREN, /* ')' */
diff --git a/src/sys/np/core/np_lex.c b/src/sys/np/core/np_lex.c
index 8eb5039..eb15a52 100644
--- a/src/sys/np/core/np_lex.c
+++ b/src/sys/np/core/np_lex.c
@@ -256,6 +256,7 @@ lex_nom(struct np_work *work, struct lex_token *res)
}
lex_st = &work->lex_st;
+ res->token = TT_NONE;
/* Skip all whitespace */
while ((c = lex_pop(work)) != 0) {
diff --git a/src/sys/np/core/np_parse.c b/src/sys/np/core/np_parse.c
index b894edb..2b52cbe 100644
--- a/src/sys/np/core/np_parse.c
+++ b/src/sys/np/core/np_parse.c
@@ -40,6 +40,9 @@
/* Token to string conversion table */
static const char *stoktab[] = {
+ /* Reserved */
+ [TT_NONE] = "<TT_NONE>",
+
/* Symbols */
[TT_LPAREN] = "<TT_LPAREN>",
[TT_RPAREN] = "<TT_RPAREN>",