* get the next word on a line * the argument 'currPos' must point to the current position. * * @return is the next word or an empty string if none found. */
| 1646 | * @return is the next word or an empty string if none found. |
| 1647 | */ |
| 1648 | string ASBeautifier::getNextWord(const string &line, size_t currPos) const |
| 1649 | { |
| 1650 | size_t lineLength = line.length(); |
| 1651 | // get the last legal word (may be a number) |
| 1652 | if (currPos == lineLength - 1) |
| 1653 | return string(); |
| 1654 | |
| 1655 | size_t start = line.find_first_not_of(" \t", currPos + 1); |
| 1656 | if (start == string::npos || !isLegalNameChar(line[start])) |
| 1657 | return string(); |
| 1658 | |
| 1659 | size_t end; // end of the current word |
| 1660 | for (end = start + 1; end <= lineLength; end++) |
| 1661 | { |
| 1662 | if (!isLegalNameChar(line[end]) || line[end] == '.') |
| 1663 | break; |
| 1664 | } |
| 1665 | |
| 1666 | return line.substr(start, end - start); |
| 1667 | } |
| 1668 | |
| 1669 | /** |
| 1670 | * Check if a preprocessor directive is always indented. |
nothing calls this directly
no outgoing calls
no test coverage detected