From ef82689edd12da051c8a715f871c3dc00743803e Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 1 Oct 2025 21:42:58 -0400 Subject: np: parse: Allocate new PIIR stack into work desc Signed-off-by: Ian Moffett --- src/sys/include/os/np.h | 3 +++ src/sys/np/core/np_parse.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/sys/include/os/np.h b/src/sys/include/os/np.h index 9b04f0e..6671e10 100644 --- a/src/sys/include/os/np.h +++ b/src/sys/include/os/np.h @@ -38,6 +38,7 @@ #include #include #include +#include #include /* @@ -46,6 +47,7 @@ * @source: Source input file * @source_size: Source size in bytes * @line_no: Current line number + * @piir_stack: Bytecode stack * @lex_st: Lexer state * @ast_root: Parse tree * @ccache: Character cache (temporary store for lexer) @@ -56,6 +58,7 @@ struct np_work { char *source; size_t source_size; size_t line_no; + struct piir_stack *piir_stack; struct lexer_state lex_st; struct ptrbox *work_mem; struct ast_node *ast_root; diff --git a/src/sys/np/core/np_parse.c b/src/sys/np/core/np_parse.c index 81c5a8d..fd35e3c 100644 --- a/src/sys/np/core/np_parse.c +++ b/src/sys/np/core/np_parse.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -348,6 +349,13 @@ parse_work(struct np_work *work) return -ENOMEM; } + /* Initialize PIIR */ + error = piir_stack_new(work, &work->piir_stack); + if (error < 0) { + pr_error("failed to alloc PIIR stack\n"); + return error; + } + while (error == 0) { error = lex_nom(work, &tok); if (error == LEX_EOF) { -- cgit v1.2.3