diff --git a/src/Date.cpp b/src/Date.cpp index 20015fe63..fe8f9f26e 100644 --- a/src/Date.cpp +++ b/src/Date.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/src/Lexer.cpp b/src/Lexer.cpp index c09e88b99..0a9da3003 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -299,8 +299,14 @@ bool Lexer::isBoundary (int left, int right) //////////////////////////////////////////////////////////////////////////////// bool Lexer::isPunctuation (int c) { - return c != '@' && - ispunct (c); + return isprint (c) && + c != ' ' && + c != '@' && + c != '#' && + c != '$' && + c != '_' && + ! isDigit (c) && + ! isAlpha (c); } //////////////////////////////////////////////////////////////////////////////// diff --git a/src/Nibbler.cpp b/src/Nibbler.cpp index 30c5b4d5d..261dc4745 100644 --- a/src/Nibbler.cpp +++ b/src/Nibbler.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -1036,9 +1035,9 @@ bool Nibbler::getWord (std::string& result) if (i < _length) { - while (!Lexer::isDigit (_input[i]) && - !isPunctuation (_input[i]) && - !Lexer::isWhitespace (_input[i])) + while (!Lexer::isDigit (_input[i]) && + !Lexer::isPunctuation (_input[i]) && + !Lexer::isWhitespace (_input[i])) { ++i; } @@ -1228,21 +1227,6 @@ bool Nibbler::depleted () return false; } -//////////////////////////////////////////////////////////////////////////////// -// Override of ispunct, that considers #, $, _ and @ not to be punctuation. -// -// ispunct: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ -// Punctuation: ! " % & ' ( ) * + , - . / : ; < = > ? [ \ ] ^ _ ` { | } ~ -// delta: # $ @ -// -bool Nibbler::isPunctuation (char c) -{ - if (c == '@' || c == '#' || c == '$' || c == '_') - return false; - - return ispunct (c); -} - //////////////////////////////////////////////////////////////////////////////// std::string Nibbler::dump () { diff --git a/src/Nibbler.h b/src/Nibbler.h index b97b12a58..626f5300c 100644 --- a/src/Nibbler.h +++ b/src/Nibbler.h @@ -110,7 +110,6 @@ public: bool depleted (); - static bool isPunctuation (char); std::string dump (); private: diff --git a/src/text.cpp b/src/text.cpp index e94092cea..e2e02b1fb 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -479,21 +478,6 @@ bool nontrivial (const std::string& input) return false; } -//////////////////////////////////////////////////////////////////////////////// -// Override of ispunct, that considers #, $ and @ not to be punctuation. -// -// ispunct: ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ -// Punctuation: ! " % & ' ( ) * + , - . / : ; < = > ? [ \ ] ^ _ ` { | } ~ -// delta: # $ @ -// -bool isPunctuation (char c) -{ - if (c == '@' || c == '#' || c == '$') - return false; - - return ispunct (c); -} - //////////////////////////////////////////////////////////////////////////////// bool compare ( const std::string& left, diff --git a/src/text.h b/src/text.h index a126199ce..56fab1416 100644 --- a/src/text.h +++ b/src/text.h @@ -50,7 +50,6 @@ const std::string str_replace (std::string&, const std::string&, const std::stri const std::string str_replace (const std::string&, const std::string&, const std::string&); const char* optionalBlankLine (); bool nontrivial (const std::string&); -bool isPunctuation (char); bool compare (const std::string&, const std::string&, bool sensitive = true); bool closeEnough (const std::string&, const std::string&, unsigned int minLength = 0); std::string::size_type find (const std::string&, const std::string&, bool sensitive = true);