Code Cleanup

- Removed unused text.cpp isWordStart function.
This commit is contained in:
Paul Beckingham 2014-09-07 16:12:06 -04:00
parent c1806303a1
commit 7890cf0ab7
3 changed files with 1 additions and 41 deletions

View file

@ -569,28 +569,6 @@ bool noVerticalSpace (const std::string& input)
return true;
}
////////////////////////////////////////////////////////////////////////////////
// Input: hello, world
// Result for pos: y......y....
bool isWordStart (const std::string& input, std::string::size_type pos)
{
// Short circuit: no input means no word start.
if (input.length () == 0)
return false;
// If pos is the first non space/punct character of the string.
if (pos == 0 && ! Lexer::is_ws (input[pos]) && !isPunctuation (input[pos]))
return true;
// If pos is not the first alphanumeric character, but there is a preceding
// space/punct character.
if (pos > 0 && ! Lexer::is_ws (input[pos]) && !isPunctuation (input[pos])
&& ( Lexer::is_ws (input[pos - 1]) || isPunctuation (input[pos - 1])))
return true;
return false;
}
////////////////////////////////////////////////////////////////////////////////
// Input: hello, world
// Result for pos: ....y......y

View file

@ -56,7 +56,6 @@ bool nontrivial (const std::string&);
bool digitsOnly (const std::string&);
bool noSpaces (const std::string&);
bool noVerticalSpace (const std::string&);
bool isWordStart (const std::string&, std::string::size_type);
bool isWordEnd (const std::string&, std::string::size_type);
bool isPunctuation (char);
std::string visible (char);

View file

@ -37,7 +37,7 @@ Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (257);
UnitTest t (242);
// Ensure environment has no influence.
unsetenv ("TASKDATA");
@ -328,23 +328,6 @@ int main (int argc, char** argv)
// 0123456789012
// s e s e
// bool isWordStart (const std::string&, std::string::size_type);
t.notok (isWordStart ("", 0), "isWordStart (\"\", 0) -> false");
t.ok (isWordStart ("foo", 0), "isWordStart (\"foo\", 0) -> true");
t.ok (isWordStart (text, 0), "isWordStart (\"Hello, world.\", 0) -> true");
t.notok (isWordStart (text, 1), "isWordStart (\"Hello, world.\", 1) -> false");
t.notok (isWordStart (text, 2), "isWordStart (\"Hello, world.\", 2) -> false");
t.notok (isWordStart (text, 3), "isWordStart (\"Hello, world.\", 3) -> false");
t.notok (isWordStart (text, 4), "isWordStart (\"Hello, world.\", 4) -> false");
t.notok (isWordStart (text, 5), "isWordStart (\"Hello, world.\", 5) -> false");
t.notok (isWordStart (text, 6), "isWordStart (\"Hello, world.\", 6) -> false");
t.ok (isWordStart (text, 7), "isWordStart (\"Hello, world.\", 7) -> true");
t.notok (isWordStart (text, 8), "isWordStart (\"Hello, world.\", 8) -> false");
t.notok (isWordStart (text, 9), "isWordStart (\"Hello, world.\", 9) -> false");
t.notok (isWordStart (text, 10), "isWordStart (\"Hello, world.\", 10) -> false");
t.notok (isWordStart (text, 11), "isWordStart (\"Hello, world.\", 11) -> false");
t.notok (isWordStart (text, 12), "isWordStart (\"Hello, world.\", 12) -> false");
// bool isWordEnd (const std::string&, std::string::size_type);
t.notok (isWordEnd ("", 0), "isWordEnd (\"\", 0) -> false");
t.ok (isWordEnd ("foo", 2), "isWordEnd (\"foo\", 2) -> true");