* jump over the leading white space in the current line, * IF the line does not begin a comment or is in a preprocessor definition. */
| 2184 | * IF the line does not begin a comment or is in a preprocessor definition. |
| 2185 | */ |
| 2186 | void ASFormatter::initNewLine() |
| 2187 | { |
| 2188 | size_t len = currentLine.length(); |
| 2189 | size_t tabSize = getTabLength(); |
| 2190 | charNum = 0; |
| 2191 | |
| 2192 | // don't trim these |
| 2193 | if (isInQuoteContinuation |
| 2194 | || (isInPreprocessor && !getPreprocDefineIndent())) |
| 2195 | return; |
| 2196 | |
| 2197 | // SQL continuation lines must be adjusted so the leading spaces |
| 2198 | // is equivalent to the opening EXEC SQL |
| 2199 | if (isInExecSQL) |
| 2200 | { |
| 2201 | // replace leading tabs with spaces |
| 2202 | // so that continuation indent will be spaces |
| 2203 | size_t tabCount_ = 0; |
| 2204 | size_t i; |
| 2205 | for (i = 0; i < currentLine.length(); i++) |
| 2206 | { |
| 2207 | if (!isWhiteSpace(currentLine[i])) // stop at first text |
| 2208 | break; |
| 2209 | if (currentLine[i] == '\t') |
| 2210 | { |
| 2211 | size_t numSpaces = tabSize - ((tabCount_ + i) % tabSize); |
| 2212 | currentLine.replace(i, 1, numSpaces, ' '); |
| 2213 | tabCount_++; |
| 2214 | i += tabSize - 1; |
| 2215 | } |
| 2216 | } |
| 2217 | // this will correct the format if EXEC SQL is not a hanging indent |
| 2218 | trimContinuationLine(); |
| 2219 | return; |
| 2220 | } |
| 2221 | |
| 2222 | // comment continuation lines must be adjusted so the leading spaces |
| 2223 | // is equivalent to the opening comment |
| 2224 | if (isInComment) |
| 2225 | { |
| 2226 | if (noTrimCommentContinuation) |
| 2227 | leadingSpaces = tabIncrementIn = 0; |
| 2228 | trimContinuationLine(); |
| 2229 | return; |
| 2230 | } |
| 2231 | |
| 2232 | // compute leading spaces |
| 2233 | isImmediatelyPostCommentOnly = lineIsLineCommentOnly || lineEndsInCommentOnly; |
| 2234 | lineIsLineCommentOnly = false; |
| 2235 | lineEndsInCommentOnly = false; |
| 2236 | doesLineStartComment = false; |
| 2237 | currentLineBeginsWithBracket = false; |
| 2238 | lineIsEmpty = false; |
| 2239 | currentLineFirstBracketNum = string::npos; |
| 2240 | tabIncrementIn = 0; |
| 2241 | |
| 2242 | // bypass whitespace at the start of a line |
| 2243 | // preprocessor tabs are replaced later in the program |
nothing calls this directly
no outgoing calls
no test coverage detected