Track /* */ comment state
| 1815 | |
| 1816 | // Track /* */ comment state |
| 1817 | void CommentState::submitLine(const std::string& line) { |
| 1818 | std::size_t pos = 0; |
| 1819 | while (pos != std::string::npos) { |
| 1820 | |
| 1821 | // check for a // which would invalidate any other token found |
| 1822 | std::size_t lineCommentPos = line.find("//", pos); |
| 1823 | |
| 1824 | // look for the next token |
| 1825 | std::string token = inComment() ? "*/" : "/*"; |
| 1826 | pos = line.find(token, pos); |
| 1827 | |
| 1828 | // process the comment token if found |
| 1829 | if (pos != std::string::npos) { |
| 1830 | |
| 1831 | // break if the line comment precedes the comment token |
| 1832 | if (lineCommentPos != std::string::npos && lineCommentPos < pos) |
| 1833 | break; // #nocov |
| 1834 | |
| 1835 | inComment_ = !inComment_; |
| 1836 | pos += token.size(); |
| 1837 | } |
| 1838 | } |
| 1839 | } |
| 1840 | |
| 1841 | } // namespace attributes |
| 1842 | } // namespace Rcpp |
no test coverage detected