summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-10-03 19:20:46 -0400
committerIan Moffett <ian@osmora.org>2025-10-03 19:20:46 -0400
commitb7c88d4a4d9e06a2984eb0812db407e3f49a629a (patch)
tree2eb91b09069c0f61cd1221cbc1065cbf24b3df3b /src
parentaaa5a270cae3be855806ffacca93d76a5b1663b8 (diff)
np: parse: Add symbol list
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src')
-rw-r--r--src/sys/include/os/np.h3
-rw-r--r--src/sys/np/core/np_parse.c9
2 files changed, 11 insertions, 1 deletions
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 <os/vnode.h>
#include <np/lex.h>
#include <np/piir.h>
+#include <np/symbol.h>
#include <lib/ptrbox.h>
/*
@@ -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 <sys/param.h>
#include <np/lex.h>
#include <np/parse.h>
-#include <np/piir.h>
#include <os/np.h>
+#include <np/piir.h>
#include <lib/ptrbox.h>
#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) {