diff --git a/src/Parser.cpp b/src/Parser.cpp index 0b97a2dc2..8ace3463c 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -531,6 +531,22 @@ Tree* Parser::captureFirst (const std::string& arg) return t; } +//////////////////////////////////////////////////////////////////////////////// +Tree* Parser::captureLast (const std::string& arg) +{ + // Insert the arg as the new first branch. + Tree* t = new Tree ("argIns"); + if (!t) + throw std::string (STRING_ERROR_MEMORY); + + t->attribute ("raw", arg); + t->tag ("?"); + t->_trunk = _tree; + + _tree->_branches.push_back (t); + return t; +} + //////////////////////////////////////////////////////////////////////////////// const std::string Parser::getFilterExpression () { diff --git a/src/Parser.h b/src/Parser.h index 0f8440fbe..ea09b5353 100644 --- a/src/Parser.h +++ b/src/Parser.h @@ -57,6 +57,7 @@ public: void applyOverrides (); void injectDefaults (); Tree* captureFirst (const std::string&); + Tree* captureLast (const std::string&); const std::string getFilterExpression (); const std::vector getWords () const;