From 926b44301aa339b7a204f709959ee44b6ee95902 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Tue, 24 Nov 2020 10:00:47 +0100 Subject: Implement Shift Left (WIP) --- cpp.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cpp.cpp') diff --git a/cpp.cpp b/cpp.cpp index cefd5fd..15dfc87 100644 --- a/cpp.cpp +++ b/cpp.cpp @@ -390,6 +390,8 @@ std::unordered_map binaryOperations {"*", FlowGraph::BinaryOperationType::Multiply}, {"/", FlowGraph::BinaryOperationType::Divide}, {"%", FlowGraph::BinaryOperationType::Modulo}, + {"<<", FlowGraph::BinaryOperationType::ShiftLeft}, + {">>", FlowGraph::BinaryOperationType::ShiftRight}, }; } // namespace @@ -492,6 +494,9 @@ std::unordered_map> 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 -- cgit v1.2.3