From adc965e762111b4b6d9a905bfe8fbdf474d406db Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 25 Jan 2018 00:59:05 -0500 Subject: [PATCH] Lexer: Migrated to unicodeLatinAlpha --- src/Lexer.cpp | 13 +++---------- src/Lexer.h | 1 - 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/Lexer.cpp b/src/Lexer.cpp index df8af936d..ca5d0c3d6 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -143,13 +143,6 @@ const std::string Lexer::typeName (const Lexer::Type& type) return "unknown"; } -//////////////////////////////////////////////////////////////////////////////// -bool Lexer::isAlpha (int c) -{ - return (c >= 'A' && c <= 'Z') || - (c >= 'a' && c <= 'z'); -} - //////////////////////////////////////////////////////////////////////////////// // Digits 0-9. // @@ -225,7 +218,7 @@ bool Lexer::isBoundary (int left, int right) if (right == '\0') return true; // XOR - if (isAlpha (left) != isAlpha (right)) return true; + if (unicodeLatinAlpha (left) != unicodeLatinAlpha (right)) return true; if (isDigit (left) != isDigit (right)) return true; if (unicodeWhitespace (left) != unicodeWhitespace (right)) return true; @@ -262,7 +255,7 @@ bool Lexer::isPunctuation (int c) c != '$' && c != '_' && ! isDigit (c) && - ! isAlpha (c); + ! unicodeLatinAlpha (c); } //////////////////////////////////////////////////////////////////////////////// @@ -1217,7 +1210,7 @@ bool Lexer::isDOM (std::string& token, Lexer::Type& type) } // Lookahead: ! - else if (! isAlpha (_text[marker])) + else if (! unicodeLatinAlpha (_text[marker])) { token = _text.substr (marker, _cursor - marker); type = Lexer::Type::dom; diff --git a/src/Lexer.h b/src/Lexer.h index f5438bf31..fe4951da2 100644 --- a/src/Lexer.h +++ b/src/Lexer.h @@ -61,7 +61,6 @@ public: // Static helpers. static const std::string typeName (const Lexer::Type&); - static bool isAlpha (int); static bool isDigit (int); static bool isIdentifierStart (int); static bool isIdentifierNext (int);