static PakfireParser make_if_stmt(PakfireParser parser, const enum operator op,
const char* val1, const char* val2, PakfireParser if_block, PakfireParser else_block);
+static PakfireParser make_child(PakfireParser parent, const char* namespace);
+
%}
%token T_APPEND
if : T_IF
{
// Open a new block
- parser = pakfire_parser_create_child(parser, NULL);
+ parser = make_child(parser, NULL);
};
else : T_ELSE T_EOL
parser = pakfire_parser_get_parent(parser);
// Open a new else block
- parser = pakfire_parser_create_child(parser, NULL);
+ parser = make_child(parser, NULL);
};
end : T_END T_EOL;
block_opening : variable T_EOL
{
// Create a new sub-parser which opens a new namespace
- parser = pakfire_parser_create_child(parser, $1);
+ parser = make_child(parser, $1);
};
statement : variable T_ASSIGN value T_EOL
return result;
}
+
+static PakfireParser make_child(PakfireParser parent, const char* namespace) {
+ PakfireParser parser = pakfire_parser_create_child(parent, namespace);
+ pakfire_parser_unref(parent);
+
+ return parser;
+}