* find the colon following a 'case' statement * * @param line a reference to the line. * @param i the line index of the case statement. * @return the line index of the colon. */
| 196 | * @return the line index of the colon. |
| 197 | */ |
| 198 | size_t ASEnhancer::findCaseColon(string &line, size_t caseIndex) const |
| 199 | { |
| 200 | size_t i = caseIndex; |
| 201 | bool isInQuote_ = false; |
| 202 | char quoteChar_ = ' '; |
| 203 | for (; i < line.length(); i++) |
| 204 | { |
| 205 | if (isInQuote_) |
| 206 | { |
| 207 | if (line[i] == '\\') |
| 208 | { |
| 209 | i++; |
| 210 | continue; |
| 211 | } |
| 212 | else if (line[i] == quoteChar_) // check ending quote |
| 213 | { |
| 214 | isInQuote_ = false; |
| 215 | quoteChar_ = ' '; |
| 216 | continue; |
| 217 | } |
| 218 | else |
| 219 | { |
| 220 | continue; // must close quote before continuing |
| 221 | } |
| 222 | } |
| 223 | if (line[i] == '\'' || line[i] == '\"') // check opening quote |
| 224 | { |
| 225 | isInQuote_ = true; |
| 226 | quoteChar_ = line[i]; |
| 227 | continue; |
| 228 | } |
| 229 | if (line[i] == ':') |
| 230 | { |
| 231 | if ((i + 1 < line.length()) && (line[i + 1] == ':')) |
| 232 | i++; // bypass scope resolution operator |
| 233 | else |
| 234 | break; // found it |
| 235 | } |
| 236 | } |
| 237 | return i; |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * indent a line by a given number of tabsets |
nothing calls this directly
no outgoing calls
no test coverage detected