From 7890cf0ab72f269784333f251ec21a255574f947 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 7 Sep 2014 16:12:06 -0400 Subject: [PATCH] Code Cleanup - Removed unused text.cpp isWordStart function. --- src/text.cpp | 22 ---------------------- src/text.h | 1 - test/text.t.cpp | 19 +------------------ 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/src/text.cpp b/src/text.cpp index 3869c5929..987cd8982 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -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 diff --git a/src/text.h b/src/text.h index 93cff8718..5a113063d 100644 --- a/src/text.h +++ b/src/text.h @@ -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); diff --git a/test/text.t.cpp b/test/text.t.cpp index 566673d08..e52e032d2 100644 --- a/test/text.t.cpp +++ b/test/text.t.cpp @@ -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");