From ce7506f4fc4528f4213b2e50e0902d9a564302f1 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 25 May 2014 19:32:35 -0400 Subject: [PATCH] Parser - Implemented ::getCommand. --- src/Parser.cpp | 17 +++++++++++++++++ src/Parser.h | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Parser.cpp b/src/Parser.cpp index 7b422988d..fe839f203 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -608,6 +608,23 @@ std::string Parser::getLimit () const return "0"; } +//////////////////////////////////////////////////////////////////////////////// +std::string Parser::getCommand () const +{ + std::vector ::const_iterator i; + for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i) + { + // Parser override operator. + if ((*i)->attribute ("canonical") == "TERMINATED") + break; + + if ((*i)->hasTag ("CMD")) + return (*i)->attribute ("raw"); + } + + return ""; +} + //////////////////////////////////////////////////////////////////////////////// // /pattern/ --> description ~ pattern void Parser::findPattern () diff --git a/src/Parser.h b/src/Parser.h index 5333740ef..02b670183 100644 --- a/src/Parser.h +++ b/src/Parser.h @@ -59,9 +59,9 @@ public: const std::string getFilterExpression (); const std::vector getWords () const; - // TODO Extract modifications std::string getLimit () const; + std::string getCommand () const; private: void findTerminator ();