* determine if the next line starts a comment * and a header follows the comment or comments. */
| 3779 | * and a header follows the comment or comments. |
| 3780 | */ |
| 3781 | bool ASFormatter::commentAndHeaderFollows() |
| 3782 | { |
| 3783 | // called ONLY IF shouldDeleteEmptyLines and shouldBreakBlocks are TRUE. |
| 3784 | assert(shouldDeleteEmptyLines && shouldBreakBlocks); |
| 3785 | |
| 3786 | // is the next line a comment |
| 3787 | if (!sourceIterator->hasMoreLines()) |
| 3788 | return false; |
| 3789 | string nextLine_ = sourceIterator->peekNextLine(); |
| 3790 | size_t firstChar = nextLine_.find_first_not_of(" \t"); |
| 3791 | if (firstChar == string::npos |
| 3792 | || !(nextLine_.compare(firstChar, 2, "//") == 0 |
| 3793 | || nextLine_.compare(firstChar, 2, "/*") == 0)) |
| 3794 | { |
| 3795 | sourceIterator->peekReset(); |
| 3796 | return false; |
| 3797 | } |
| 3798 | |
| 3799 | // find the next non-comment text, and reset |
| 3800 | string nextText = peekNextText(nextLine_, false, true); |
| 3801 | if (nextText.length() == 0 || !isCharPotentialHeader(nextText, 0)) |
| 3802 | return false; |
| 3803 | |
| 3804 | const string* newHeader = ASBeautifier::findHeader(nextText, 0, headers); |
| 3805 | |
| 3806 | if (newHeader == NULL) |
| 3807 | return false; |
| 3808 | |
| 3809 | // if a closing header, reset break unless break is requested |
| 3810 | if (isClosingHeader(newHeader) && !shouldBreakClosingHeaderBlocks) |
| 3811 | { |
| 3812 | isAppendPostBlockEmptyLineRequested = false; |
| 3813 | return false; |
| 3814 | } |
| 3815 | |
| 3816 | return true; |
| 3817 | } |
| 3818 | |
| 3819 | /** |
| 3820 | * determine if a bracket should be attached or broken |
nothing calls this directly
no test coverage detected