//Final parser, parses node and get data/fields NODE * PARSER::parseNode(char *instring, NODE * node) { string nextwd; NODETYPE ntype; NODE tempnode; int nodeid, curly = 0; char nextstr[MAXSTRSIZE]; stringcopy( nextwd, instring); nodeid = ntype.findNodeType(nextwd); node = parseProtoNode(instring, node);//Check first for PROTO node if(node != NULL){ return node; // If node is PROTO then return pointer to node } if(!nodeid) return NULL; node = tempnode.createNewNode(nodeid, node); getNextWord(nextstr); if(strcmp("{", nextstr) == 0) //Ensure open curly bracket after node name { curly++; }else{ cout << "Experted open curly bracket at " << nextstr << endl; return NULL; } while(getNextWord(nextstr)){ NODE *tnodeptr; if(int n = node->findFieldName(nextstr)){ //Get field for node node->getField(n , node); } if((tnodeptr = parseNodeString(nextstr, tnodeptr))){ //Parse children node and store in scenegraph if(tnodeptr != NULL){ node->children.push_back(tnodeptr); continue; } } if(strcmp("{", nextstr) == 0){ curly++; continue; } if(strcmp("}", nextstr) == 0){ curly--; if(curly == 0){ break; } } } return node; }