* get the next formatted line. * * @return formatted line. */
| 461 | * @return formatted line. |
| 462 | */ |
| 463 | string ASFormatter::nextLine() |
| 464 | { |
| 465 | const string* newHeader = nullptr; |
| 466 | isInVirginLine = isVirgin; |
| 467 | isCharImmediatelyPostComment = false; |
| 468 | isPreviousCharPostComment = false; |
| 469 | isCharImmediatelyPostLineComment = false; |
| 470 | isCharImmediatelyPostOpenBlock = false; |
| 471 | isCharImmediatelyPostCloseBlock = false; |
| 472 | isCharImmediatelyPostTemplate = false; |
| 473 | |
| 474 | while (!isLineReady) |
| 475 | { |
| 476 | if (shouldReparseCurrentChar) |
| 477 | shouldReparseCurrentChar = false; |
| 478 | else if (!getNextChar()) |
| 479 | { |
| 480 | breakLine(); |
| 481 | continue; |
| 482 | } |
| 483 | else // stuff to do when reading a new character... |
| 484 | { |
| 485 | // make sure that a virgin '{' at the beginning of the file will be treated as a block... |
| 486 | if (isInVirginLine && currentChar == '{' |
| 487 | && currentLineBeginsWithBrace |
| 488 | && previousCommandChar == ' ') |
| 489 | previousCommandChar = '{'; |
| 490 | if (isInClassInitializer |
| 491 | && isBraceType(braceTypeStack->back(), COMMAND_TYPE)) |
| 492 | isInClassInitializer = false; |
| 493 | if (isInBraceRunIn) |
| 494 | isInLineBreak = false; |
| 495 | if (!isWhiteSpace(currentChar)) |
| 496 | isInBraceRunIn = false; |
| 497 | isPreviousCharPostComment = isCharImmediatelyPostComment; |
| 498 | isCharImmediatelyPostComment = false; |
| 499 | isCharImmediatelyPostTemplate = false; |
| 500 | isCharImmediatelyPostReturn = false; |
| 501 | isCharImmediatelyPostThrow = false; |
| 502 | isCharImmediatelyPostNewDelete = false; |
| 503 | isCharImmediatelyPostOperator = false; |
| 504 | isCharImmediatelyPostPointerOrReference = false; |
| 505 | isCharImmediatelyPostOpenBlock = false; |
| 506 | isCharImmediatelyPostCloseBlock = false; |
| 507 | } |
| 508 | |
| 509 | if ((lineIsLineCommentOnly || lineIsCommentOnly) |
| 510 | && currentLine.find("*INDENT-ON*", charNum) != string::npos |
| 511 | && isFormattingModeOff) |
| 512 | { |
| 513 | isFormattingModeOff = false; |
| 514 | breakLine(); |
| 515 | formattedLine = currentLine; |
| 516 | charNum = (int) currentLine.length() - 1; |
| 517 | continue; |
| 518 | } |
| 519 | if (isFormattingModeOff) |
| 520 | { |
no test coverage detected