mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Nibbler
- Improved ::getDOM while it waits to be obsoleted.
This commit is contained in:
parent
a4eb390a04
commit
bfe5edd35d
1 changed files with 18 additions and 5 deletions
|
@ -903,6 +903,9 @@ bool Nibbler::getDate (const std::string& format, time_t& t)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Assumes that the options are sorted by decreasing length, so that if the
|
||||||
|
// options contain 'fourteen' and 'four', the stream is first matched against
|
||||||
|
// the longer entry.
|
||||||
bool Nibbler::getOneOf (
|
bool Nibbler::getOneOf (
|
||||||
const std::vector <std::string>& options,
|
const std::vector <std::string>& options,
|
||||||
std::string& found)
|
std::string& found)
|
||||||
|
@ -922,6 +925,8 @@ bool Nibbler::getOneOf (
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// [<number>|<uuid>|<word>|].<word>[.<word> ...]
|
// [<number>|<uuid>|<word>|].<word>[.<word> ...]
|
||||||
|
//
|
||||||
|
// TODO Obsolete
|
||||||
bool Nibbler::getDOM (std::string& result)
|
bool Nibbler::getDOM (std::string& result)
|
||||||
{
|
{
|
||||||
std::string::size_type i = mCursor;
|
std::string::size_type i = mCursor;
|
||||||
|
@ -933,9 +938,10 @@ bool Nibbler::getDOM (std::string& result)
|
||||||
std::string right;
|
std::string right;
|
||||||
int number;
|
int number;
|
||||||
|
|
||||||
if (getWord (left) &&
|
// <name>.<name>[.<name> ...]
|
||||||
|
if (getName (left) &&
|
||||||
skip ('.') &&
|
skip ('.') &&
|
||||||
getWord (right))
|
getName (right))
|
||||||
{
|
{
|
||||||
while (skip ('.') &&
|
while (skip ('.') &&
|
||||||
getWord (right))
|
getWord (right))
|
||||||
|
@ -946,9 +952,11 @@ bool Nibbler::getDOM (std::string& result)
|
||||||
}
|
}
|
||||||
|
|
||||||
restore ();
|
restore ();
|
||||||
|
|
||||||
|
// <id>.<name>[.<name> ...]
|
||||||
if (getInt (number) &&
|
if (getInt (number) &&
|
||||||
skip ('.') &&
|
skip ('.') &&
|
||||||
getWord (right))
|
getName (right))
|
||||||
{
|
{
|
||||||
while (skip ('.') &&
|
while (skip ('.') &&
|
||||||
getWord (right))
|
getWord (right))
|
||||||
|
@ -959,9 +967,11 @@ bool Nibbler::getDOM (std::string& result)
|
||||||
}
|
}
|
||||||
|
|
||||||
restore ();
|
restore ();
|
||||||
|
|
||||||
|
// <uuid>.<name>[.<name> ...]
|
||||||
if (getUUID (left) &&
|
if (getUUID (left) &&
|
||||||
skip ('.') &&
|
skip ('.') &&
|
||||||
getWord (right))
|
getName (right))
|
||||||
{
|
{
|
||||||
while (skip ('.') &&
|
while (skip ('.') &&
|
||||||
getWord (right))
|
getWord (right))
|
||||||
|
@ -972,7 +982,9 @@ bool Nibbler::getDOM (std::string& result)
|
||||||
}
|
}
|
||||||
|
|
||||||
restore ();
|
restore ();
|
||||||
if (getWord (right))
|
|
||||||
|
// <name>[.<name> ...]
|
||||||
|
if (getName (right))
|
||||||
{
|
{
|
||||||
while (skip ('.') &&
|
while (skip ('.') &&
|
||||||
getWord (right))
|
getWord (right))
|
||||||
|
@ -982,6 +994,7 @@ bool Nibbler::getDOM (std::string& result)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restore ();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue