mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Nibbler: Removed unused ::getWord method
This commit is contained in:
parent
78da4ffb90
commit
0c5984c517
3 changed files with 1 additions and 63 deletions
|
@ -535,32 +535,6 @@ bool Nibbler::getOneOf (
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// A word is a contiguous string of non-space, non-digit, non-punct characters.
|
||||
bool Nibbler::getWord (std::string& result)
|
||||
{
|
||||
auto i = _cursor;
|
||||
|
||||
if (i < _length)
|
||||
{
|
||||
while (!Lexer::isDigit ((*_input)[i]) &&
|
||||
!Lexer::isPunctuation ((*_input)[i]) &&
|
||||
!Lexer::isWhitespace ((*_input)[i]))
|
||||
{
|
||||
++i;
|
||||
}
|
||||
|
||||
if (i > _cursor)
|
||||
{
|
||||
result = _input->substr (_cursor, i - _cursor);
|
||||
_cursor = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Nibbler::skipN (const int quantity /* = 1 */)
|
||||
{
|
||||
|
|
|
@ -62,7 +62,6 @@ public:
|
|||
bool getLiteral (const std::string&);
|
||||
bool getPartialUUID (std::string&);
|
||||
bool getOneOf (const std::vector <std::string>&, std::string&);
|
||||
bool getWord (std::string&);
|
||||
|
||||
bool skipN (const int quantity = 1);
|
||||
bool skip (char);
|
||||
|
|
|
@ -35,7 +35,7 @@ Context context;
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int, char**)
|
||||
{
|
||||
UnitTest t (286);
|
||||
UnitTest t (261);
|
||||
|
||||
// Ensure environment has no influence.
|
||||
unsetenv ("TASKDATA");
|
||||
|
@ -445,41 +445,6 @@ int main (int, char**)
|
|||
t.is (s, "three", " 'threefour': getOneOf () -> three");
|
||||
t.notok (n.getOneOf (options, s), " 'four': getOneOf () -> false");
|
||||
|
||||
// bool getWord (std::string&);
|
||||
t.diag ("Nibbler::getWord");
|
||||
n = Nibbler ("one two th3ee");
|
||||
t.ok (n.getWord (s), "'one' getWord -> ok");
|
||||
t.is (s, "one", "'one' getWord -> 'one'");
|
||||
t.ok (n.skipWS (), "skipWS");
|
||||
t.ok (n.getWord (s), "'two' getWord -> ok");
|
||||
t.is (s, "two", "'two' getWord -> 'two'");
|
||||
t.ok (n.skipWS (), "skipWS");
|
||||
t.ok (n.getWord (s), "'th' getWord -> ok");
|
||||
t.is (s, "th", "'th' getWord -> 'th'");
|
||||
t.ok (n.skip ('3'), "skip(3)");
|
||||
t.ok (n.getWord (s), "'ee' getWord -> ok");
|
||||
t.is (s, "ee", "'ee' getWord -> 'ee'");
|
||||
t.ok (n.depleted (), "depleted");
|
||||
|
||||
t.diag ("Nibbler::getWord");
|
||||
n = Nibbler ("one TWO,three,f ");
|
||||
t.ok (n.getWord (s), "'one TWO,three,f ' getWord -> ok");
|
||||
t.is (s, "one", " ' TWO,three,f ' getWord -> one");
|
||||
t.ok (n.skipWS (), " 'TWO,three,f ' skipWS -> ok");
|
||||
|
||||
t.ok (n.getWord (s), " 'TWO,three,f ' getWord -> ok");
|
||||
t.is (s, "TWO", " ',three,f ' getWord -> TWO");
|
||||
t.ok (n.skip (','), " 'three,f ' skip , -> ok");
|
||||
|
||||
t.ok (n.getWord (s), " 'three,f ' getWord -> ok");
|
||||
t.is (s, "three", " ',f ' getWord -> three");
|
||||
t.ok (n.skip (','), " 'f ' skip , -> ok");
|
||||
|
||||
t.ok (n.getWord (s), " 'f ' getWord -> ok");
|
||||
t.is (s, "f", " ' ' getWord -> f");
|
||||
t.ok (n.skipWS (), " '' skip , -> ok");
|
||||
t.ok (n.depleted (), " '' depleted -> true");
|
||||
|
||||
// bool getN (int, std::string&);
|
||||
t.diag ("Nibbler::getN");
|
||||
n = Nibbler ("111223");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue