| 156 | |
| 157 | template <typename Key, typename T> |
| 158 | class mapping final { |
| 159 | std::map<Key, T> mDat; |
| 160 | |
| 161 | public: |
| 162 | mapping(std::initializer_list<std::pair<const Key, T>> l) : mDat(l) {} |
| 163 | |
| 164 | bool exist(const Key &k) const { |
| 165 | return mDat.count(k) > 0; |
| 166 | } |
| 167 | |
| 168 | const T &match(const Key &k) const |
| 169 | { |
| 170 | if (!exist(k)) |
| 171 | throw compile_error("Undefined Mapping."); |
| 172 | return mDat.at(k); |
| 173 | } |
| 174 | }; |
| 175 | |
| 176 | class token_base { |
| 177 | friend class compiler_type; |
nothing calls this directly
no test coverage detected