| 2291 | } |
| 2292 | |
| 2293 | bool TokenList::isKeyword(const std::string &str) const |
| 2294 | { |
| 2295 | if (isCPP()) { |
| 2296 | const auto &cpp_keywords = Keywords::getAll(mSettings.standards.cpp); |
| 2297 | const bool b = cpp_keywords.find(str) != cpp_keywords.end(); |
| 2298 | if (b) { |
| 2299 | // TODO: integrate into keywords? |
| 2300 | // types and literals are not handled as keywords |
| 2301 | static const std::unordered_set<std::string> cpp_types = {"bool", "false", "true"}; |
| 2302 | if (cpp_types.find(str) != cpp_types.end()) |
| 2303 | return false; |
| 2304 | } |
| 2305 | return b; |
| 2306 | } |
| 2307 | |
| 2308 | const auto &c_keywords = Keywords::getAll(mSettings.standards.c); |
| 2309 | const bool b = c_keywords.find(str) != c_keywords.end(); |
| 2310 | if (b) { |
| 2311 | // TODO: integrate into Keywords? |
| 2312 | // types are not handled as keywords |
| 2313 | static const std::unordered_set<std::string> c_types = {"char", "double", "float", "int", "long", "short"}; |
| 2314 | if (c_types.find(str) != c_types.end()) |
| 2315 | return false; |
| 2316 | } |
| 2317 | return b; |
| 2318 | } |
| 2319 | |
| 2320 | bool TokenList::isC() const |
| 2321 | { |
no test coverage detected