MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / parseFile

Method parseFile

Engine/source/console/persistenceManager.cpp:568–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566}
567
568bool PersistenceManager::parseFile(const char* fileName)
569{
570 // Read the file into the line buffer
571 if (!readFile(fileName))
572 return false;
573
574 // Load it into our Tokenizer parser
575 if (!mParser.openFile(fileName))
576 {
577 // Handle an object writing out to a new file
578 if ( !Torque::FS::IsFile( fileName ) )
579 return true;
580
581 return false;
582 }
583
584 // Set our reserved "single" tokens
585 mParser.setSingleTokens("(){};=:");
586
587 // Search object declarations
588 while (mParser.advanceToken(true))
589 {
590 if (mParser.tokenICmp("new") ||
591 mParser.tokenICmp("singleton") ||
592 mParser.tokenICmp("datablock"))
593 {
594 parseObject();
595 }
596 }
597
598 // If we had an object that didn't end properly
599 // then we could have objects on the stack
600 while (mCurrentObject)
601 saveObject();
602
603 //Con::errorf("Parsed Results:");
604
605 //for (U32 i = 0; i < mObjectBuffer.size(); i++)
606 //{
607 // ParsedObject* parsedObject = mObjectBuffer[i];
608
609 // Con::warnf(" mObjectBuffer[%d]:", i);
610 // Con::warnf(" name = %s", parsedObject->name);
611 // Con::warnf(" className = %s", parsedObject->className);
612 // Con::warnf(" startLine = %d", parsedObject->startLine + 1);
613 // Con::warnf(" endLine = %d", parsedObject->endLine + 1);
614
615 // //if (mObjectBuffer[i]->properties.size() > 0)
616 // //{
617 // // Con::warnf(" properties:");
618 // // for (U32 j = 0; j < mObjectBuffer[i]->properties.size(); j++)
619 // // Con::warnf(" %s = %s;", mObjectBuffer[i]->properties[j].name,
620 // // mObjectBuffer[i]->properties[j].value);
621 // //}
622
623 // if (!parsedObject->simObject.isNull())
624 // {
625 // SimObject* simObject = parsedObject->simObject;

Callers

nothing calls this directly

Calls 6

IsFileFunction · 0.85
saveObjectFunction · 0.85
setSingleTokensMethod · 0.80
advanceTokenMethod · 0.80
tokenICmpMethod · 0.80
openFileMethod · 0.45

Tested by

no test coverage detected