diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-24 10:00:47 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-24 10:00:47 +0100 |
commit | 926b44301aa339b7a204f709959ee44b6ee95902 (patch) | |
tree | 7332570f3d6b553887f144a91e62e21dfa22a4af /cpp.cpp | |
parent | 61db05a4127790da3219fccce87c34aa890d1d08 (diff) |
Implement Shift Left (WIP)
Diffstat (limited to 'cpp.cpp')
-rw-r--r-- | cpp.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -390,6 +390,8 @@ std::unordered_map<std::string, FlowGraph::BinaryOperationType> binaryOperations {"*", FlowGraph::BinaryOperationType::Multiply}, {"/", FlowGraph::BinaryOperationType::Divide}, {"%", FlowGraph::BinaryOperationType::Modulo}, + {"<<", FlowGraph::BinaryOperationType::ShiftLeft}, + {">>", FlowGraph::BinaryOperationType::ShiftRight}, }; } // namespace @@ -492,6 +494,9 @@ std::unordered_map<std::string, std::function<std::any(index_t)>> CPP::getNodeEv }, { "shift-expression", [&](index_t index) -> std::any { + if (childTypesOfNodeMatch(index, {"shift-expression", "", "additive-expression"})) { + return BinaryOperation(index); + } if (childTypesOfNodeMatch(index, {"additive-expression"})) return getValue(index, 0); throw std::runtime_error("ICE: Unsupported childs: "s + ruleString(index)); // TODO |