#pragma once #include #include "has_token.hpp" #include "mstch/mstch.hpp" namespace mstch { class get_token : public boost::static_visitor { public: get_token(const std::string &token, const mstch::node &node) : m_token(token), m_node(node) {} template const mstch::node &operator()(const T &) const { return m_node; } const mstch::node &operator()(const map &map) const { return map.at(m_token); } const mstch::node &operator()(const std::shared_ptr &object) const { return object->at(m_token); } private: const std::string &m_token; const mstch::node &m_node; }; }