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
+24
View File
@@ -0,0 +1,24 @@
#include <compiler/fzl_parser.h>
#include <compiler/internals/parser.h>
// Parse unary operations
fzl_node_t *pa_unary(fzl_parser_t *parser)
{
if (!parser)
return NULL;
if (!is(parser, FZL_TOKTYPE_MINUS) && !is(parser, FZL_TOKTYPE_PLUS) &&
!is(parser, FZL_TOKTYPE_NOT))
return pa_postfix(parser);
fzl_token_t *op = consume(parser);
fzl_node_t *operand = pa_unary(parser);
if (!operand)
return NULL;
fzl_node_t *result = fzl_mknode(unary_op_to_type(op->type), op);
result->unary_op.operand = operand;
return result;
}