mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-28 13:37:20 +02:00
A3t
- Added ::clear method. - Handles ::captureFirst with an empty tree.
This commit is contained in:
parent
74cfc972fc
commit
b5bd3e44c8
2 changed files with 14 additions and 2 deletions
15
src/A3t.cpp
15
src/A3t.cpp
|
@ -76,6 +76,16 @@ void A3t::initialize (int argc, const char** argv)
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void A3t::clear ()
|
||||
{
|
||||
delete _tree;
|
||||
|
||||
_tree = new Tree ("root");
|
||||
if (! _tree)
|
||||
throw std::string ("Failed to allocate memory for parse tree.");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Add an arg for every word from std::cin.
|
||||
//
|
||||
|
@ -514,11 +524,12 @@ Tree* A3t::captureFirst (const std::string& arg)
|
|||
t->_trunk = _tree;
|
||||
|
||||
std::vector <Tree*>::iterator i = _tree->_branches.begin ();
|
||||
i++; // Walk past the binary.
|
||||
if (i != _tree->_branches.end ())
|
||||
i++; // Walk past the binary.
|
||||
|
||||
_tree->_branches.insert (i, t);
|
||||
findCommand ();
|
||||
|
||||
findCommand ();
|
||||
return t;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
A3t ();
|
||||
~A3t ();
|
||||
void initialize (int, const char**);
|
||||
void clear ();
|
||||
void appendStdin ();
|
||||
Tree* tree ();
|
||||
Tree* parse ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue