| 441 | } |
| 442 | |
| 443 | bool Tokenizer::regressToken(const bool crossLine) |
| 444 | { |
| 445 | if (mTokenIsCurrent == true) |
| 446 | { |
| 447 | AssertFatal(mCurrTokenBuffer[0] != '\0', "No token, but marked as current?"); |
| 448 | mTokenIsCurrent = false; |
| 449 | return true; |
| 450 | } |
| 451 | |
| 452 | U32 currPosition = 0; |
| 453 | mCurrTokenBuffer[0] = '\0'; |
| 454 | |
| 455 | mTokenIsQuoted = false; |
| 456 | |
| 457 | // Store the beginning of the previous advance |
| 458 | // and the beginning of the current advance |
| 459 | mCurrPos = mStartPos; |
| 460 | |
| 461 | // Back up to the first character of the previous token |
| 462 | mStartPos--; |
| 463 | |
| 464 | while (mStartPos > 0) |
| 465 | { |
| 466 | char c = mpBuffer[mStartPos]; |
| 467 | |
| 468 | bool cont = true; |
| 469 | |
| 470 | if (mSingleTokens && dStrchr(mSingleTokens, c)) |
| 471 | { |
| 472 | if (currPosition == 0) |
| 473 | { |
| 474 | mCurrTokenBuffer[currPosition++] = c; |
| 475 | mStartPos--; |
| 476 | cont = false; |
| 477 | break; |
| 478 | } |
| 479 | else |
| 480 | { |
| 481 | // End of token |
| 482 | cont = false; |
| 483 | } |
| 484 | } |
| 485 | else |
| 486 | { |
| 487 | switch (c) |
| 488 | { |
| 489 | case ' ': |
| 490 | case '\t': |
| 491 | if (currPosition == 0) |
| 492 | { |
| 493 | // Token hasn't started yet... |
| 494 | mStartPos--; |
| 495 | } |
| 496 | else |
| 497 | { |
| 498 | // End of token |
| 499 | mStartPos--; |
| 500 | cont = false; |
no test coverage detected