* get the previous word index for an assignment operator * * @return is the index to the previous word (the in statement indent). */
| 1585 | * @return is the index to the previous word (the in statement indent). |
| 1586 | */ |
| 1587 | int ASBeautifier::getInStatementIndentAssign(const string &line, size_t currPos) const |
| 1588 | { |
| 1589 | assert(line[currPos] == '='); |
| 1590 | |
| 1591 | if (currPos == 0) |
| 1592 | return 0; |
| 1593 | |
| 1594 | // get the last legal word (may be a number) |
| 1595 | size_t end = line.find_last_not_of(" \t", currPos - 1); |
| 1596 | if (end == string::npos || !isLegalNameChar(line[end])) |
| 1597 | return 0; |
| 1598 | |
| 1599 | int start; // start of the previous word |
| 1600 | for (start = end; start > -1; start--) |
| 1601 | { |
| 1602 | if (!isLegalNameChar(line[start]) || line[start] == '.') |
| 1603 | break; |
| 1604 | } |
| 1605 | start++; |
| 1606 | |
| 1607 | return start; |
| 1608 | } |
| 1609 | |
| 1610 | /** |
| 1611 | * get the instatement indent for a comma |
nothing calls this directly
no outgoing calls
no test coverage detected