Suggest characters at ends of path fragments

The program now suggests a slash for containers, a space for leafs and a
left bracket for lists. The logic for suggesting the first the starting
bracket for lists got a little bit simplified, since it's now a part of
the list's identifier. The CLI now directly shows, if a
slash/bracket/space is going to be appended. The user can use this
information to deduce if a node is container/list/leaf.

Change-Id: Ib1a3cdd326a1451ba80f3bb48a9e8bdd13c102ae
diff --git a/src/ast_handlers.hpp b/src/ast_handlers.hpp
index 5501247..75d8553 100644
--- a/src/ast_handlers.hpp
+++ b/src/ast_handlers.hpp
@@ -333,6 +333,7 @@
     {
         auto& parserContext = x3::get<parser_context_tag>(context);
         parserContext.m_suggestions.clear();
+        parserContext.m_completionSuffix.clear();
     }
 };
 
@@ -556,7 +557,32 @@
         const auto& schema = parserContext.m_schema;
 
         parserContext.m_completionIterator = begin;
-        parserContext.m_suggestions = schema.childNodes(parserContext.m_curPath, Recursion::NonRecursive);
+        auto suggestions = schema.childNodes(parserContext.m_curPath, Recursion::NonRecursive);
+        std::set<std::string> suffixesAdded;
+        std::transform(suggestions.begin(), suggestions.end(),
+            std::inserter(suffixesAdded, suffixesAdded.end()),
+            [&parserContext, &schema] (auto it) {
+                ModuleNodePair node;
+                if (auto colonPos = it.find(":"); colonPos != it.npos) {
+                    node.first = it.substr(0, colonPos);
+                    node.second = it.substr(colonPos + 1, node.second.npos);
+                } else {
+                    node.first = boost::none;
+                    node.second = it;
+                }
+
+                if (schema.isLeaf(parserContext.m_curPath, node)) {
+                    return it + " ";
+                }
+                if (schema.isContainer(parserContext.m_curPath, node)) {
+                    return it + "/";
+                }
+                if (schema.isList(parserContext.m_curPath, node)) {
+                    return it + "[";
+                }
+                return it;
+        });
+        parserContext.m_suggestions = suffixesAdded;
     }
 };
 
@@ -593,16 +619,6 @@
     }
 };
 
-struct suggestKeysStart_class {
-    template <typename T, typename Iterator, typename Context>
-    void on_success(Iterator const&, Iterator const&, T&, Context const& context)
-    {
-        auto& parserContext = x3::get<parser_context_tag>(context);
-
-        parserContext.m_completionSuffix = "[";
-    }
-};
-
 struct commandNamesVisitor {
     template <typename T>
     auto operator()(boost::type<T>)