#include "../includes/include.h" /* * WARNING! do not use this function, it is old and outdated, and is missing alot of new features! */ node_info *create_logic(int opperation, int expr, node_info *statement_list, node_info *else_false) { node_info *n = malloc(sizeof(node_info)); switch (opperation) { case 1: //if statement n->opperation = 4; logic a; a.opperation = 1; a.expr = expr; while (statement_list->statement_list) statement_list = statement_list->statement_list; node_info *newNode = malloc(sizeof(node_info)); newNode->opperation = 5; newNode->next = copy_linked_list(statement_list); _free_linked_list(statement_list); a.if_true = newNode; statement_list = NULL; n->logicalExpression = a; return n; case 2: //while loop /*n->opperation = 4; logic b; b.opperation = 2; b.expr = expr; b.while_true = if_true; n->logicalExpression = b; return n;*/ break; default: printf("check your yacc file for logical statements\n"); } }