You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
672 B
27 lines
672 B
#include "logic.h"
|
|
|
|
static plogic create_logic(const logic_type type, const pnode_info stmt_list, const char* var_name)
|
|
{
|
|
if (!stmt_list || !var_name)
|
|
return NULL;
|
|
|
|
plogic new_logic = malloc(sizeof(logic));
|
|
new_logic->type = type;
|
|
new_logic->condition_var = var_name;
|
|
new_logic->stmt_list = stmt_list;
|
|
return new_logic;
|
|
}
|
|
|
|
static pnode_info create_logic_node(const plogic logic_expr)
|
|
{
|
|
if (!logic_expr)
|
|
return NULL;
|
|
|
|
const pnode_info new_node = malloc(sizeof(node_info));
|
|
new_node->operation = LOGIC_OPERATION;
|
|
new_node->logical_expr = logic_expr;
|
|
new_node->statement_list = NULL;
|
|
new_node->next = NULL;
|
|
new_node->scope_map = _var_map;
|
|
return new_node;
|
|
} |