From 8791c0a921801f1d7302e3cebd12c96e08b5445d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 22 Feb 2015 18:23:26 -0500 Subject: [PATCH] Lexer - Migrated old noSpaces() function into Lexer::isOneWord. --- src/Lexer.cpp | 12 ++++++++++++ src/Lexer.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 6d8e36350..855ee095d 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -999,3 +999,15 @@ bool Lexer::isAllDigits (const std::string& text) } //////////////////////////////////////////////////////////////////////////////// +bool Lexer::isOneWord (const std::string& text) +{ + std::string::size_type i = 0; + int character; + while ((character = utf8_next_char (text, i))) + if (Lexer::isWhitespace (character)) + return false; + + return true; +} + +//////////////////////////////////////////////////////////////////////////////// diff --git a/src/Lexer.h b/src/Lexer.h index 3bb07ce6b..b5cde1d42 100644 --- a/src/Lexer.h +++ b/src/Lexer.h @@ -59,6 +59,7 @@ public: static std::vector split (const std::string&); static std::string typeToString (Lexer::Type); static bool isAllDigits (const std::string&); + static bool isOneWord (const std::string&); // Static helpers. static const std::string typeName (const Lexer::Type&);