diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 9b399fec7..df8af936d 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -159,15 +159,6 @@ bool Lexer::isDigit (int c) return c >= 0x30 && c <= 0x39; } -//////////////////////////////////////////////////////////////////////////////// -// Digits 0-9 a-f A-F. -bool Lexer::isHexDigit (int c) -{ - return (c >= '0' && c <= '9') || - (c >= 'a' && c <= 'f') || - (c >= 'A' && c <= 'F'); -} - //////////////////////////////////////////////////////////////////////////////// bool Lexer::isIdentifierStart (int c) { @@ -581,7 +572,7 @@ bool Lexer::isUUID (std::string& token, Lexer::Type& type, bool endBoundary) { if (uuid_pattern[i] == 'x') { - if (! isHexDigit (_text[marker + i])) + if (! unicodeHexDigit (_text[marker + i])) break; } else if (uuid_pattern[i] != _text[marker + i]) @@ -616,7 +607,7 @@ bool Lexer::isHexNumber (std::string& token, Lexer::Type& type) { marker += 2; - while (isHexDigit (_text[marker])) + while (unicodeHexDigit (_text[marker])) ++marker; if (marker - _cursor > 2) @@ -1469,10 +1460,10 @@ bool Lexer::readWord ( else if (eos - cursor >= 6 && ((text[cursor + 0] == 'U' && text[cursor + 1] == '+') || (text[cursor + 0] == '\\' && text[cursor + 1] == 'u')) && - isHexDigit (text[cursor + 2]) && - isHexDigit (text[cursor + 3]) && - isHexDigit (text[cursor + 4]) && - isHexDigit (text[cursor + 5])) + unicodeHexDigit (text[cursor + 2]) && + unicodeHexDigit (text[cursor + 3]) && + unicodeHexDigit (text[cursor + 4]) && + unicodeHexDigit (text[cursor + 5])) { word += utf8_character ( hexToInt ( @@ -1553,10 +1544,10 @@ bool Lexer::readWord ( else if (eos - cursor >= 6 && ((text[cursor + 0] == 'U' && text[cursor + 1] == '+') || (text[cursor + 0] == '\\' && text[cursor + 1] == 'u')) && - isHexDigit (text[cursor + 2]) && - isHexDigit (text[cursor + 3]) && - isHexDigit (text[cursor + 4]) && - isHexDigit (text[cursor + 5])) + unicodeHexDigit (text[cursor + 2]) && + unicodeHexDigit (text[cursor + 3]) && + unicodeHexDigit (text[cursor + 4]) && + unicodeHexDigit (text[cursor + 5])) { word += utf8_character ( hexToInt ( diff --git a/src/Lexer.h b/src/Lexer.h index fe8b80e59..f5438bf31 100644 --- a/src/Lexer.h +++ b/src/Lexer.h @@ -63,7 +63,6 @@ public: static const std::string typeName (const Lexer::Type&); static bool isAlpha (int); static bool isDigit (int); - static bool isHexDigit (int); static bool isIdentifierStart (int); static bool isIdentifierNext (int); static bool isSingleCharOperator (int);