diff options
author | George L. Albany <Megacake1234@gmail.com> | 2024-07-07 20:58:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-07 20:58:13 +0200 |
commit | 2275b40b519bdbc8ee707ca2373ea167a72625ab (patch) | |
tree | d38d333b55e6ec42c28adf4554153aad378159fc /src/openvic-simulation/dataloader/NodeTools.hpp | |
parent | 8c8b9349e26b4f606e18810a201ff378eaac19b2 (diff) | |
parent | 71b846dc5dd1ac49626c8b479571050224a4cca1 (diff) |
Merge pull request #169 from OpenVicProject/dryad
Update OpenVicProject/OpenVic-Dataloader@4a49007
Diffstat (limited to 'src/openvic-simulation/dataloader/NodeTools.hpp')
-rw-r--r-- | src/openvic-simulation/dataloader/NodeTools.hpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/openvic-simulation/dataloader/NodeTools.hpp b/src/openvic-simulation/dataloader/NodeTools.hpp index 92682e7..b0bb723 100644 --- a/src/openvic-simulation/dataloader/NodeTools.hpp +++ b/src/openvic-simulation/dataloader/NodeTools.hpp @@ -14,10 +14,32 @@ #include "openvic-simulation/types/HasIdentifier.hpp" #include "openvic-simulation/types/OrderedContainers.hpp" #include "openvic-simulation/types/Vector.hpp" +#include "openvic-simulation/utility/Getters.hpp" #include "openvic-simulation/utility/TslHelper.hpp" namespace OpenVic { - namespace ast = ovdl::v2script::ast; + namespace ast { + using namespace ovdl::v2script::ast; + using NodeCPtr = const Node*; + + constexpr std::string_view get_type_name(NodeKind kind) { +#define NODE_CASE(Node) \ + case Node: return OpenVic::utility::type_name<ast::Node>(); + switch (kind) { + using enum NodeKind; + NODE_CASE(FileTree); + NODE_CASE(IdentifierValue); + NODE_CASE(StringValue); + NODE_CASE(ListValue); + NODE_CASE(NullValue); + NODE_CASE(EventStatement); + NODE_CASE(AssignStatement); + NODE_CASE(ValueStatement); + default: ovdl::detail::unreachable(); + } + } +#undef NODE_CASE + } using name_list_t = std::vector<std::string>; std::ostream& operator<<(std::ostream& stream, name_list_t const& name_list); |