* 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. */
| 303 | * @return the line index of the colon. |
| 304 | */ |
| 305 | size_t ASEnhancer::findCaseColon(string& line, size_t caseIndex) const |
| 306 | { |
| 307 | size_t i = caseIndex; |
| 308 | bool isInQuote_ = false; |
| 309 | char quoteChar_ = ' '; |
| 310 | for (; i < line.length(); i++) |
| 311 | { |
| 312 | if (isInQuote_) |
| 313 | { |
| 314 | if (line[i] == '\\') |
| 315 | { |
| 316 | i++; |
| 317 | continue; |
| 318 | } |
| 319 | else if (line[i] == quoteChar_) // check ending quote |
| 320 | { |
| 321 | isInQuote_ = false; |
| 322 | quoteChar_ = ' '; |
| 323 | continue; |
| 324 | } |
| 325 | else |
| 326 | { |
| 327 | continue; // must close quote before continuing |
| 328 | } |
| 329 | } |
| 330 | if (line[i] == '\'' || line[i] == '\"') // check opening quote |
| 331 | { |
| 332 | isInQuote_ = true; |
| 333 | quoteChar_ = line[i]; |
| 334 | continue; |
| 335 | } |
| 336 | if (line[i] == ':') |
| 337 | { |
| 338 | if ((i + 1 < line.length()) && (line[i + 1] == ':')) |
| 339 | i++; // bypass scope resolution operator |
| 340 | else |
| 341 | break; // found it |
| 342 | } |
| 343 | } |
| 344 | return i; |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * indent a line by a given number of tabsets |