| 256 | } |
| 257 | |
| 258 | void PersistenceManager::parseObject() |
| 259 | { |
| 260 | // We *should* already be in position but just in case... |
| 261 | if (!mParser.tokenICmp("new") && |
| 262 | !mParser.tokenICmp("singleton") && |
| 263 | !mParser.tokenICmp("datablock")) |
| 264 | { |
| 265 | Con::errorf("PersistenceManager::parseObject() - handed a position that doesn't point to an object \ |
| 266 | creation keyword (new, singleton, datablock)"); |
| 267 | |
| 268 | return; |
| 269 | } |
| 270 | |
| 271 | // If there is an object already being parsed then |
| 272 | // push it into the stack to finish later |
| 273 | if (mCurrentObject) |
| 274 | mObjectStack.push_back(mCurrentObject); |
| 275 | |
| 276 | mCurrentObject = new ParsedObject; |
| 277 | |
| 278 | //// If this object declaration is being assigned to a variable then |
| 279 | //// consider that the "start" of the declaration (otherwise we could |
| 280 | //// get a script compile error if we delete the object declaration) |
| 281 | mParser.regressToken(true); |
| 282 | |
| 283 | if (mParser.tokenICmp("=")) |
| 284 | { |
| 285 | // Ok, we are at an '='...back up to the beginning of that variable |
| 286 | mParser.regressToken(true); |
| 287 | |
| 288 | // Get the startLine and startPosition |
| 289 | mCurrentObject->startLine = mParser.getCurrentLine(); |
| 290 | mCurrentObject->startPosition = mParser.getTokenLineOffset(); |
| 291 | |
| 292 | // Advance back to the object declaration |
| 293 | mParser.advanceToken(true); |
| 294 | mParser.advanceToken(true); |
| 295 | } |
| 296 | else |
| 297 | { |
| 298 | // Advance back to the object declaration |
| 299 | mParser.advanceToken(true); |
| 300 | |
| 301 | // Get the startLine and startPosition |
| 302 | mCurrentObject->startLine = mParser.getCurrentLine(); |
| 303 | mCurrentObject->startPosition = mParser.getTokenLineOffset(); |
| 304 | } |
| 305 | |
| 306 | if (mObjectStack.size() > 0) |
| 307 | mCurrentObject->parentObject = mObjectStack.last(); |
| 308 | |
| 309 | // The next token should be the className |
| 310 | mCurrentObject->className = StringTable->insert(mParser.getNextToken()); |
| 311 | |
| 312 | // Advance to '(' |
| 313 | mParser.advanceToken(true); |
| 314 | |
| 315 | if (!mParser.tokenICmp("(")) |
nothing calls this directly
no test coverage detected