mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Parser
- Implemented ::capture_last, so that new args can be injected at either end of the command line.
This commit is contained in:
parent
7598997e70
commit
f4605a1bc7
2 changed files with 17 additions and 0 deletions
|
@ -531,6 +531,22 @@ Tree* Parser::captureFirst (const std::string& arg)
|
||||||
return t;
|
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 ()
|
const std::string Parser::getFilterExpression ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
void applyOverrides ();
|
void applyOverrides ();
|
||||||
void injectDefaults ();
|
void injectDefaults ();
|
||||||
Tree* captureFirst (const std::string&);
|
Tree* captureFirst (const std::string&);
|
||||||
|
Tree* captureLast (const std::string&);
|
||||||
|
|
||||||
const std::string getFilterExpression ();
|
const std::string getFilterExpression ();
|
||||||
const std::vector <std::string> getWords () const;
|
const std::vector <std::string> getWords () const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue