ref: split parser into separate files

This commit is contained in:
samsonium
2026-10-29 00:08:44 +03:00
parent 62b0030e4a
commit 8c90d54782
27 changed files with 1444 additions and 1307 deletions
+33
View File
@@ -0,0 +1,33 @@
#include <compiler/fzl_parser.h>
#include <compiler/internals/parser.h>
// Parse conditional &&
fzl_node_t *pa_and(fzl_parser_t *parser)
{
if (!parser)
return NULL;
fzl_node_t *left = pa_cond(parser);
fzl_node_t *right = NULL;
if (!left)
return NULL;
while (is(parser, FZL_TOKTYPE_DAMPERSAND))
{
fzl_token_t * or = consume(parser);
right = pa_cond(parser);
if (!right)
{
fzl_freeast(left);
return NULL;
}
fzl_node_t *node = fzl_mknode(FZL_NODETYPE_AND, or);
node->binary_op.left = left;
node->binary_op.right = right;
left = node;
}
return left;
}