| 137 | } |
| 138 | |
| 139 | void check(const tsl::ordered_map<std::string, std::string> &conditions) const { |
| 140 | for (const auto &itr : m_v.as_table()) { |
| 141 | const auto &ky = itr.first; |
| 142 | if (m_conditionVisited.contains(ky)) { |
| 143 | if (!conditions.contains(ky) && Project::is_condition_name(ky)) { |
| 144 | throw_key_error("Unknown condition '" + ky + "'", ky, itr.second); |
| 145 | } |
| 146 | |
| 147 | for (const auto &jtr : itr.second.as_table()) { |
| 148 | if (!m_visited.contains(jtr.first)) { |
| 149 | throw_key_error("Unknown key '" + jtr.first + "'", jtr.first, jtr.second); |
| 150 | } |
| 151 | } |
| 152 | } else if (!m_visited.contains(ky)) { |
| 153 | if (itr.second.is_table()) { |
| 154 | for (const auto &jtr : itr.second.as_table()) { |
| 155 | if (!m_visited.contains(jtr.first)) { |
| 156 | throw_key_error("Unknown key '" + jtr.first + "'", jtr.first, jtr.second); |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | throw_key_error("Unknown key '" + ky + "'", ky, itr.second); |
| 161 | } else if (ky == "condition") { |
| 162 | std::string condition = itr.second.as_string(); |
| 163 | if (!conditions.contains(condition) && Project::is_condition_name(condition)) { |
| 164 | throw_key_error("Unknown condition '" + condition + "'", condition, itr.second); |
| 165 | } |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | }; |
| 170 | |
| 171 | class TomlCheckerRoot { |
no test coverage detected