| 180 | } |
| 181 | |
| 182 | void simplecpp::Location::adjust(const std::string &str) |
| 183 | { |
| 184 | if (strpbrk(str.c_str(), "\r\n") == nullptr) { |
| 185 | col += str.size(); |
| 186 | return; |
| 187 | } |
| 188 | |
| 189 | for (std::size_t i = 0U; i < str.size(); ++i) { |
| 190 | col++; |
| 191 | if (str[i] == '\n' || str[i] == '\r') { |
| 192 | col = 1; |
| 193 | line++; |
| 194 | if (str[i] == '\r' && (i+1)<str.size() && str[i+1]=='\n') |
| 195 | ++i; |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | bool simplecpp::Token::isOneOf(const char ops[]) const |
| 201 | { |