From db61b5925966587717a17d48339bc8fea58a142b Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 1 Oct 2025 15:16:46 -0400 Subject: np: Allocate memory for identifier Signed-off-by: Ian Moffett --- src/sys/include/np/lex.h | 5 ++++- src/sys/np/core/np_lex.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sys/include/np/lex.h b/src/sys/include/np/lex.h index ba4bdb8..9c6e69e 100644 --- a/src/sys/include/np/lex.h +++ b/src/sys/include/np/lex.h @@ -85,7 +85,10 @@ typedef uint64_t tokval_t; */ struct lex_token { tt_t token; - tokval_t val; + union { + tokval_t val; + char *val_str; + }; }; /* diff --git a/src/sys/np/core/np_lex.c b/src/sys/np/core/np_lex.c index cecb425..8eb5039 100644 --- a/src/sys/np/core/np_lex.c +++ b/src/sys/np/core/np_lex.c @@ -147,6 +147,7 @@ lex_matchstr(struct np_work *work, char c, struct lex_token *res) } while ((c = lex_pop(work)) != 0); id[id_idx] = '\0'; + res->val_str = ptrbox_strdup(id, work->work_mem); /* Match the tokens */ error = lex_cmptok(id, res); -- cgit v1.2.3