- Implemented ::capture_last, so that new args can be injected at either end
  of the command line.
This commit is contained in:
Paul Beckingham 2014-05-31 13:52:59 -04:00
parent 7598997e70
commit f4605a1bc7
2 changed files with 17 additions and 0 deletions

View file

@ -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 ()
{

View file

@ -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 <std::string> getWords () const;