diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-01 15:16:46 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-01 15:16:46 -0400 |
commit | db61b5925966587717a17d48339bc8fea58a142b (patch) | |
tree | a87c300f4124f5c5e62a581208c3d9e0c7c68f05 /src | |
parent | 6c9d36725286e159ed6a04e79ea215789a52c29f (diff) |
np: Allocate memory for identifier
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/sys/include/np/lex.h | 5 | ||||
-rw-r--r-- | src/sys/np/core/np_lex.c | 1 |
2 files changed, 5 insertions, 1 deletions
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); |