node_t -> ast_node_t

Clearer to understand the intent of node_t as a direct result of
parsing source code.
This commit is contained in:
2024-12-24 23:18:52 +00:00
parent fbf2202cfd
commit 9fb9413c45
4 changed files with 11 additions and 11 deletions

View File

@@ -8,7 +8,7 @@
#include "./parser.h"
char *ast_to_str(node_t *ast, size_t size)
char *ast_to_str(ast_node_t *ast, size_t size)
{
char *out = calloc(size + 1, 1);
if (!out)
@@ -54,7 +54,7 @@ char *ast_to_str(node_t *ast, size_t size)
struct PResult parse_buffer(buffer_t *buffer)
{
node_t *nodes = NULL;
ast_node_t *nodes = NULL;
size_t usable = 0, loops = 0, loop_ends = 0;
// First pass: Compute |nodes|
@@ -161,11 +161,11 @@ struct PResult parse_buffer(buffer_t *buffer)
size_t stackptr = 0;
if (loops)
{
node_t *stack[loops];
ast_node_t *stack[loops];
memset(stack, 0, loops);
for (size_t i = 0; i < usable; ++i)
{
node_t *node = nodes + i;
ast_node_t *node = nodes + i;
if (node->type == LIN)
stack[stackptr++] = node;
else if (node->type == LOUT)
@@ -180,7 +180,7 @@ struct PResult parse_buffer(buffer_t *buffer)
if (stackptr > 0)
{
node_t *node = nodes + usable - 1;
ast_node_t *node = nodes + usable - 1;
print_error(buffer->name, node->row, node->col,
"ERROR: Unbalanced square brackets!");
goto error;