#include #include #include #include // Parse reference definition fzl_node_t *pa_ref(fzl_parser_t *parser) { if (!parser || !peek(parser)) return NULL; fzl_token_t *tok = consume(parser); if (!tok || tok->type != FZL_TOKTYPE_REFERENCE) { snprintf(plast_err, sizeof(plast_err), "'%s':%zu:%zu => expected 'ref' keyword", last_known_tok->filename, last_known_tok->ln, last_known_tok->cn); return NULL; } fzl_token_t *name = consume(parser); if (!name || name->type != FZL_TOKTYPE_NAME) { snprintf(plast_err, sizeof(plast_err), "'%s':%zu:%zu => expected name after 'ref'", last_known_tok->filename, last_known_tok->ln, last_known_tok->cn); return NULL; } fzl_node_t *node = fzl_mknode(FZL_NODETYPE_REFERENCE, name); if (!node) { snprintf(plast_err, sizeof(plast_err), "out of memory"); return NULL; } return node; }