* remove whitespace and add indentation for an array run-in. */
| 5419 | * remove whitespace and add indentation for an array run-in. |
| 5420 | */ |
| 5421 | void ASFormatter::formatArrayRunIn() |
| 5422 | { |
| 5423 | assert(isBraceType(braceTypeStack->back(), ARRAY_TYPE)); |
| 5424 | |
| 5425 | // make sure the brace is broken |
| 5426 | if (formattedLine.find_first_not_of(" \t{") != string::npos) |
| 5427 | return; |
| 5428 | |
| 5429 | size_t lastText = formattedLine.find_last_not_of(" \t"); |
| 5430 | if (lastText == string::npos || formattedLine[lastText] != '{') |
| 5431 | return; |
| 5432 | |
| 5433 | // check for extra whitespace |
| 5434 | if (formattedLine.length() > lastText + 1 |
| 5435 | && formattedLine.find_first_not_of(" \t", lastText + 1) == string::npos) |
| 5436 | formattedLine.erase(lastText + 1); |
| 5437 | |
| 5438 | if (getIndentString() == "\t") |
| 5439 | { |
| 5440 | appendChar('\t', false); |
| 5441 | runInIndentChars = 2; // one for { and one for tab |
| 5442 | } |
| 5443 | else |
| 5444 | { |
| 5445 | int indent = getIndentLength(); |
| 5446 | formattedLine.append(indent - 1, ' '); |
| 5447 | runInIndentChars = indent; |
| 5448 | } |
| 5449 | isInBraceRunIn = true; |
| 5450 | isInLineBreak = false; |
| 5451 | } |
| 5452 | |
| 5453 | /** |
| 5454 | * delete a braceTypeStack vector object |