Nibbler: Removed unused ::getUntilRx method
This commit is contained in:
@@ -131,33 +131,6 @@ bool Nibbler::getUntil (const std::string& terminator, std::string& result)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
#ifdef NIBBLER_FEATURE_REGEX
|
|
||||||
bool Nibbler::getUntilRx (const std::string& regex, std::string& result)
|
|
||||||
{
|
|
||||||
if (_cursor < _length)
|
|
||||||
{
|
|
||||||
RX r (regex, true);
|
|
||||||
std::vector <int> start;
|
|
||||||
std::vector <int> end;
|
|
||||||
if (r.match (start, end, _input->substr (_cursor)))
|
|
||||||
{
|
|
||||||
result = _input->substr (_cursor, start[0]);
|
|
||||||
_cursor += start[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result = _input->substr (_cursor);
|
|
||||||
_cursor = _length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool Nibbler::getUntilOneOf (const std::string& chars, std::string& result)
|
bool Nibbler::getUntilOneOf (const std::string& chars, std::string& result)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ public:
|
|||||||
|
|
||||||
bool getUntil (char, std::string&);
|
bool getUntil (char, std::string&);
|
||||||
bool getUntil (const std::string&, std::string&);
|
bool getUntil (const std::string&, std::string&);
|
||||||
#ifdef NIBBLER_FEATURE_REGEX
|
|
||||||
bool getUntilRx (const std::string&, std::string&);
|
|
||||||
#endif
|
|
||||||
bool getUntilOneOf (const std::string&, std::string&);
|
bool getUntilOneOf (const std::string&, std::string&);
|
||||||
bool getUntilWS (std::string&);
|
bool getUntilWS (std::string&);
|
||||||
bool getUntilEOL (std::string&);
|
bool getUntilEOL (std::string&);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ Context context;
|
|||||||
int main (int, char**)
|
int main (int, char**)
|
||||||
{
|
{
|
||||||
#ifdef NIBBLER_FEATURE_REGEX
|
#ifdef NIBBLER_FEATURE_REGEX
|
||||||
UnitTest t (339);
|
UnitTest t (325);
|
||||||
#else
|
#else
|
||||||
UnitTest t (315);
|
UnitTest t (315);
|
||||||
#endif
|
#endif
|
||||||
@@ -85,23 +85,6 @@ int main (int, char**)
|
|||||||
t.notok (n.getUntil (' ', s), " '' : getUntil (' ') -> false");
|
t.notok (n.getUntil (' ', s), " '' : getUntil (' ') -> false");
|
||||||
t.ok (n.depleted (), " '' : depleted () -> true");
|
t.ok (n.depleted (), " '' : depleted () -> true");
|
||||||
|
|
||||||
#ifdef NIBBLER_FEATURE_REGEX
|
|
||||||
// bool getUntilRx (const std::string&, std::string&);
|
|
||||||
t.diag ("Nibbler::getUntilRx");
|
|
||||||
n = Nibbler ("one two");
|
|
||||||
t.ok (n.getUntilRx ("th", s), " 'one two' : getUntilRx ('th') -> true");
|
|
||||||
t.is (s, "one two", " 'one two' : getUntilRx ('th') -> 'one two'");
|
|
||||||
|
|
||||||
n = Nibbler ("one two");
|
|
||||||
t.ok (n.getUntilRx ("e", s), " 'one two' : getUntilRx ('e') -> true");
|
|
||||||
t.is (s, "on", " 'one two' : getUntilRx ('e') -> 'on'"); // 30
|
|
||||||
t.ok (n.getUntilRx ("tw", s), " 'e two' : getUntilRx ('tw') -> true");
|
|
||||||
t.is (s, "e ", " 'e two' : getUntilRx ('tw') -> 'e '");
|
|
||||||
t.ok (n.getUntilRx ("$", s), " 'two' : getUntilRx ('$') -> true");
|
|
||||||
t.is (s, "two", " 'two' : getUntilRx ('$') -> 'two'");
|
|
||||||
t.ok (n.depleted (), " '' : depleted () -> true");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// bool getUntilOneOf (const std::string&, std::string&);
|
// bool getUntilOneOf (const std::string&, std::string&);
|
||||||
t.diag ("Nibbler::getUntilOneOf");
|
t.diag ("Nibbler::getUntilOneOf");
|
||||||
n = Nibbler ("ab.cd");
|
n = Nibbler ("ab.cd");
|
||||||
|
|||||||
Reference in New Issue
Block a user