Nibbler: Removed unused ::skipAll method

This commit is contained in:
Paul Beckingham 2015-10-29 23:53:17 -04:00
parent 119827e4e1
commit 297f2b6e99
3 changed files with 1 additions and 32 deletions

View file

@ -532,26 +532,6 @@ bool Nibbler::skip (char c)
return false; return false;
} }
////////////////////////////////////////////////////////////////////////////////
bool Nibbler::skipAll (char c)
{
if (_cursor < _length)
{
auto i = _input->find_first_not_of (c, _cursor);
if (i == _cursor)
return false;
if (i == std::string::npos)
_cursor = _length; // Yes, off the end.
else
_cursor = i;
return true;
}
return false;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
bool Nibbler::skipWS () bool Nibbler::skipWS ()
{ {

View file

@ -63,7 +63,6 @@ public:
bool skipN (const int quantity = 1); bool skipN (const int quantity = 1);
bool skip (char); bool skip (char);
bool skipAll (char);
bool skipAllOneOf (const std::string&); bool skipAllOneOf (const std::string&);
bool skipWS (); bool skipWS ();

View file

@ -35,7 +35,7 @@ Context context;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
int main (int, char**) int main (int, char**)
{ {
UnitTest t (252); UnitTest t (246);
// Ensure environment has no influence. // Ensure environment has no influence.
unsetenv ("TASKDATA"); unsetenv ("TASKDATA");
@ -57,7 +57,6 @@ int main (int, char**)
t.notok (n.getUntilOneOf ("ab", s), "trivial: getUntilOneOf"); t.notok (n.getUntilOneOf ("ab", s), "trivial: getUntilOneOf");
t.notok (n.skipN (123), "trivial: skipN"); t.notok (n.skipN (123), "trivial: skipN");
t.notok (n.skip ('x'), "trivial: skip"); t.notok (n.skip ('x'), "trivial: skip");
t.notok (n.skipAll ('x'), "trivial: skipAll");
t.notok (n.skipAllOneOf ("abc"), "trivial: skipAllOneOf"); t.notok (n.skipAllOneOf ("abc"), "trivial: skipAllOneOf");
t.notok (n.backN (1), "trivial: backN"); t.notok (n.backN (1), "trivial: backN");
t.notok (n.getQuoted ('"', s), "trivial: getQuoted"); t.notok (n.getQuoted ('"', s), "trivial: getQuoted");
@ -128,15 +127,6 @@ int main (int, char**)
t.ok (n.skip ('a'), " 'a' : skip ('a') -> true"); t.ok (n.skip ('a'), " 'a' : skip ('a') -> true");
t.ok (n.depleted (), " '' : depleted () -> true"); t.ok (n.depleted (), " '' : depleted () -> true");
// bool skipAll (char);
t.diag ("Nibbler::skipAll");
n = Nibbler ("aaaabb");
t.ok (n.skipAll ('a'), " 'aaaabb' : skipAll ('a') -> true");
t.notok (n.skipAll ('a'), " 'bb' : skipAll ('a') -> false");
t.ok (n.skipAll ('b'), " 'bb' : skipAll ('b') -> true");
t.notok (n.skipAll ('b'), " '' : skipAll ('b') -> false");
t.ok (n.depleted (), " '' : depleted () -> true");
// bool skipAllOneOf (const std::string&); // bool skipAllOneOf (const std::string&);
t.diag ("Nibbler::skipAllOneOf"); t.diag ("Nibbler::skipAllOneOf");
n = Nibbler ("abababcc"); n = Nibbler ("abababcc");