From b7c88d4a4d9e06a2984eb0812db407e3f49a629a Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 3 Oct 2025 19:20:46 -0400 Subject: np: parse: Add symbol list Signed-off-by: Ian Moffett --- src/sys/include/os/np.h | 3 +++ src/sys/np/core/np_parse.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sys/include/os/np.h b/src/sys/include/os/np.h index fb4d58b..02d0a18 100644 --- a/src/sys/include/os/np.h +++ b/src/sys/include/os/np.h @@ -39,6 +39,7 @@ #include #include #include +#include #include /* @@ -64,6 +65,7 @@ typedef enum { * @line_no: Current line number * @piir_stack: Bytecode stack * @lex_st: Lexer state + * @symlist: List of symbols * @ccache: Character cache (temporary store for lexer) * @in_func: Is set if we are inside a function * @begin_depth: How deep in "begin" we are @@ -74,6 +76,7 @@ struct np_work { size_t line_no; struct piir_stack *piir_stack; struct lexer_state lex_st; + struct symlist symlist; struct ptrbox *work_mem; char ccache; uint8_t in_func : 1; diff --git a/src/sys/np/core/np_parse.c b/src/sys/np/core/np_parse.c index b7b854b..0605a64 100644 --- a/src/sys/np/core/np_parse.c +++ b/src/sys/np/core/np_parse.c @@ -38,8 +38,8 @@ #include #include #include -#include #include +#include #include #define MAX_BEGIN_DEPTH 8 @@ -369,6 +369,13 @@ parse_work(struct np_work *work) return error; } + /* Initialize the symbol list */ + error = symlist_init(work, &work->symlist); + if (error < 0) { + pr_error("failed to alloc symlist\n"); + return error; + } + while (error == 0) { error = lex_nom(work, &tok); if (error == LEX_EOF) { -- cgit v1.2.3