mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 07:43:08 +02:00
Nibbler: Removed unused ::getName method
This commit is contained in:
parent
38b9e54955
commit
78da4ffb90
3 changed files with 1 additions and 65 deletions
|
@ -535,38 +535,6 @@ bool Nibbler::getOneOf (
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// A name is a string of alpha-numeric characters.
|
|
||||||
bool Nibbler::getName (std::string& result)
|
|
||||||
{
|
|
||||||
auto i = _cursor;
|
|
||||||
|
|
||||||
if (i < _length)
|
|
||||||
{
|
|
||||||
if (! Lexer::isDigit ((*_input)[i]) &&
|
|
||||||
! ispunct ((*_input)[i]) &&
|
|
||||||
! Lexer::isWhitespace ((*_input)[i]))
|
|
||||||
{
|
|
||||||
++i;
|
|
||||||
while (i < _length &&
|
|
||||||
((*_input)[i] == '_' || ! ispunct ((*_input)[i])) &&
|
|
||||||
! Lexer::isWhitespace ((*_input)[i]))
|
|
||||||
{
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i > _cursor)
|
|
||||||
{
|
|
||||||
result = _input->substr (_cursor, i - _cursor);
|
|
||||||
_cursor = i;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// A word is a contiguous string of non-space, non-digit, non-punct characters.
|
// A word is a contiguous string of non-space, non-digit, non-punct characters.
|
||||||
bool Nibbler::getWord (std::string& result)
|
bool Nibbler::getWord (std::string& result)
|
||||||
|
|
|
@ -62,7 +62,6 @@ public:
|
||||||
bool getLiteral (const std::string&);
|
bool getLiteral (const std::string&);
|
||||||
bool getPartialUUID (std::string&);
|
bool getPartialUUID (std::string&);
|
||||||
bool getOneOf (const std::vector <std::string>&, std::string&);
|
bool getOneOf (const std::vector <std::string>&, std::string&);
|
||||||
bool getName (std::string&);
|
|
||||||
bool getWord (std::string&);
|
bool getWord (std::string&);
|
||||||
|
|
||||||
bool skipN (const int quantity = 1);
|
bool skipN (const int quantity = 1);
|
||||||
|
|
|
@ -35,7 +35,7 @@ Context context;
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int main (int, char**)
|
int main (int, char**)
|
||||||
{
|
{
|
||||||
UnitTest t (306);
|
UnitTest t (286);
|
||||||
|
|
||||||
// Ensure environment has no influence.
|
// Ensure environment has no influence.
|
||||||
unsetenv ("TASKDATA");
|
unsetenv ("TASKDATA");
|
||||||
|
@ -445,37 +445,6 @@ int main (int, char**)
|
||||||
t.is (s, "three", " 'threefour': getOneOf () -> three");
|
t.is (s, "three", " 'threefour': getOneOf () -> three");
|
||||||
t.notok (n.getOneOf (options, s), " 'four': getOneOf () -> false");
|
t.notok (n.getOneOf (options, s), " 'four': getOneOf () -> false");
|
||||||
|
|
||||||
// bool getName (std::string&);
|
|
||||||
t.diag ("Nibbler::getName");
|
|
||||||
n = Nibbler ("a1 one one.two 9 foo_bar");
|
|
||||||
t.ok (n.getName (s), "'a1 one one.two 9 foo_bar' getName -> ok");
|
|
||||||
t.is (s, "a1", " ' one one.two 9 foo_bar' getName -> 'a1'");
|
|
||||||
t.ok (n.skipWS (), " 'one one.two 9 foo_bar' skipWS -> ok");
|
|
||||||
|
|
||||||
t.ok (n.getName (s), " 'one one.two 9 foo_bar' getName -> ok");
|
|
||||||
t.is (s, "one", " ' one.two 9 foo_bar' getName -> 'one'");
|
|
||||||
t.ok (n.skipWS (), " 'one.two 9 foo_bar' skipWS -> ok");
|
|
||||||
|
|
||||||
t.ok (n.getName (s), " 'one.two 9 foo_bar' getName -> ok");
|
|
||||||
t.is (s, "one", " '.two 9 foo_bar' getName -> 'one'");
|
|
||||||
t.ok (n.skip ('.'), " 'two 9 foo_bar' skip . -> ok");
|
|
||||||
|
|
||||||
t.ok (n.getName (s), " 'two 9 foo_bar' getName -> ok");
|
|
||||||
t.is (s, "two", " ' 9 foo_bar' getName -> 'two'");
|
|
||||||
t.ok (n.skipWS (), " '9 foo_bar' skipWS -> ok");
|
|
||||||
|
|
||||||
t.notok (n.getName (s), " '9 foo_bar' getName -> not ok");
|
|
||||||
t.ok (n.skip ('9'), " ' foo_bar' skip 9 -> ok");
|
|
||||||
t.ok (n.skipWS (), " 'foo_bar' skipWS -> ok");
|
|
||||||
|
|
||||||
t.ok (n.getName (s), " 'foo_bar' getName -> ok");
|
|
||||||
t.is (s, "foo_bar", " '' getName -> 'foo_bar'");
|
|
||||||
t.ok (n.depleted (), "depleted");
|
|
||||||
|
|
||||||
n = Nibbler ("entrée");
|
|
||||||
t.ok (n.getName (s), "'entrée' -> ok");
|
|
||||||
t.is (s, "entrée", "'entrée' -> 'entrée'");
|
|
||||||
|
|
||||||
// bool getWord (std::string&);
|
// bool getWord (std::string&);
|
||||||
t.diag ("Nibbler::getWord");
|
t.diag ("Nibbler::getWord");
|
||||||
n = Nibbler ("one two th3ee");
|
n = Nibbler ("one two th3ee");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue