From 7f1b8e0de568defb342286216f0f9a8afd568bdb Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 1 Oct 2025 03:27:55 -0400 Subject: np: lex: Add left/right bracket tokens Signed-off-by: Ian Moffett --- src/sys/include/np/lex.h | 2 ++ src/sys/np/core/np_lex.c | 6 ++++++ src/sys/np/core/np_parse.c | 2 ++ 3 files changed, 10 insertions(+) (limited to 'src/sys') diff --git a/src/sys/include/np/lex.h b/src/sys/include/np/lex.h index 235e997..8977305 100644 --- a/src/sys/include/np/lex.h +++ b/src/sys/include/np/lex.h @@ -59,6 +59,8 @@ typedef enum { TT_EQUALS, /* '=' */ TT_GT, /* '>' */ TT_LT, /* '<' */ + TT_LBRACK, /* '[' */ + TT_RBRACK, /* ']' */ /* Types */ TT_U8, /* 'u8' */ diff --git a/src/sys/np/core/np_lex.c b/src/sys/np/core/np_lex.c index 620a7ad..787f369 100644 --- a/src/sys/np/core/np_lex.c +++ b/src/sys/np/core/np_lex.c @@ -281,6 +281,12 @@ lex_nom(struct np_work *work, struct lex_token *res) case '=': res->token = TT_EQUALS; break; + case '[': + res->token = TT_LBRACK; + break; + case ']': + res->token = TT_RBRACK; + break; default: if (is_num(c)) { lex_nomnum(work, c, res); diff --git a/src/sys/np/core/np_parse.c b/src/sys/np/core/np_parse.c index 253b017..29079d7 100644 --- a/src/sys/np/core/np_parse.c +++ b/src/sys/np/core/np_parse.c @@ -52,6 +52,8 @@ static const char *stoktab[] = { [TT_EQUALS] = "", [TT_GT] = "", [TT_LT] = "", + [TT_LBRACK] = "", + [TT_RBRACK] = "", /* Types */ [TT_U8] = "", -- cgit v1.2.3