From 57b876f005a5c68d93bad4a83f3d239e00a58543 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 21 Apr 2014 16:17:31 -0400 Subject: [PATCH] Tree - Parse tree is now colored to match the old one, somewhat. --- src/Tree.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Tree.cpp b/src/Tree.cpp index 1ab49ede8..c8c5ea1a7 100644 --- a/src/Tree.cpp +++ b/src/Tree.cpp @@ -274,11 +274,22 @@ void Tree::dumpNode (Tree* t, int depth, std::stringstream& output) std::string tags; std::vector ::iterator tag; for (tag = t->_tags.begin (); tag != t->_tags.end (); ++tag) - tags += (tags.length () ? " " : "") + *tag; + { + if (tags.length ()) + tags += ' '; + + if (*tag == "BINARY") tags += "\033[1;37;44m" + *tag + "\033[0m"; + else if (*tag == "CMD") tags += "\033[1;37;46m" + *tag + "\033[0m"; + else if (*tag == "FILTER") tags += "\033[1;37;42m" + *tag + "\033[0m"; + else if (*tag == "MODIFICATION") tags += "\033[1;37;43m" + *tag + "\033[0m"; + else if (*tag == "RC") tags += "\033[1;37;41m" + *tag + "\033[0m"; + else if (*tag == "CONFIG") tags += "\033[1;37;101m" + *tag + "\033[0m"; + else if (*tag == "?") tags += "\033[38;5;255;48;5;232m" + *tag + "\033[0m"; + else tags += "\033[32m" + *tag + "\033[0m"; + } if (tags.length ()) - output << " \033[32m" << tags << "\033[0m"; - + output << ' ' << tags; output << "\n"; // Recurse for branches.