From 991b493afc385de84e916e7e23e9313825d6e6d9 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 14 Feb 2020 09:17:25 +0100 Subject: Bugfix --- grammer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/grammer.cpp b/grammer.cpp index dc65876..2fc136c 100644 --- a/grammer.cpp +++ b/grammer.cpp @@ -249,8 +249,12 @@ void Compiler::RemoveLastNode() if (node_id == root_node_id) { // No parent -> remove root if (node.child_ids.empty()) { // No children -> now tree is empty clear(); + } else if (ChildIdIsToken(node.child_ids.back())) { // last token child: remove + tokens_used--; + node.child_ids.pop_back(); } else if (node.child_ids.size() == 1) { // One child: removing possible if (!ChildIdIsToken(node.child_ids[0])) { + // node: set new root nodes[node.child_ids[0]].parent_node_id = node.child_ids[0]; root_node_id = node.child_ids[0]; } -- cgit v1.2.3