| 566 | } |
| 567 | |
| 568 | bool 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; |
nothing calls this directly
no test coverage detected