Node* insertStore(char* id, Node* arrayIndex, Node* expression){ Node* thisNode = (Node*) calloc(sizeof(Node),1); if(thisNode == NULL) { if(DEBUG)printf("Error in malloc [insertStore]\n"); assert(thisNode == NULL); } thisNode->value = NULL; thisNode->n1 = createTerminalNode(NODE_ID,id); thisNode->n2 = arrayIndex; if(arrayIndex != NULL) { thisNode->n_type = NODE_STOREARRAY; if(arrayIndex == NULL) thisNode->n2 = createNull(); } else thisNode->n_type = NODE_STORE; thisNode->n3 = expression; if(expression == NULL) thisNode->n3 = createNull(); thisNode->next = NULL; return thisNode; }
GDLNode *GDLNode::createGDLNodes(const TokenLine &tokenLine) { GDLNode *node = 0; switch (tokenLine.getType()) { case TOKEN_LINE_BASE: createBaseNode(tokenLine, &node); break; case TOKEN_LINE_DISTINCT: createDistinctNode(tokenLine, &node); break; case TOKEN_LINE_DOES: createDoesNode(tokenLine, &node); break; case TOKEN_LINE_GOAL: createGoalNode(tokenLine, &node); break; case TOKEN_LINE_IF: createIfNode(tokenLine, &node); break; case TOKEN_LINE_INIT: createInitNode(tokenLine, &node); break; case TOKEN_LINE_INPUT: createInputNode(tokenLine, &node); break; case TOKEN_LINE_LEGAL: createLegalNode(tokenLine, &node); break; case TOKEN_LINE_NEXT: createNextNode(tokenLine, &node); break; case TOKEN_LINE_NOT: createNotNode(tokenLine, &node); break; case TOKEN_LINE_OR: createOrNode(tokenLine, &node); break; case TOKEN_LINE_RELATION: createPropositionNode(tokenLine, &node); break; case TOKEN_LINE_TERMINAL: createTerminalNode(&node); break; case TOKEN_LINE_TRUE: createTrueNode(tokenLine, &node); break; case TOKEN_LINE_ROLE: node = createRoleNode(tokenLine); break; default: throw Exception("Syntax error in line: " + tokenLine.toString()); } return node; }
Node* insertParseInt(char* id, Node* indexExpression){ Node* newParseInt = (Node*) calloc(sizeof(Node),1); if(newParseInt == NULL){ if(DEBUG)printf("Error in malloc insertDotLength"); assert(newParseInt != NULL); } newParseInt->n_type = NODE_PARSEARGS; newParseInt->n1 = createTerminalNode(NODE_ID,id); newParseInt->n2 = indexExpression; if(indexExpression == NULL) newParseInt->n2 = createNull(); newParseInt->next = NULL; return newParseInt; }