mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-26 06:37:20 +02:00
Lexer: Migrated to unicodeHexDigit
This commit is contained in:
parent
cac258ef72
commit
e199bc98b3
2 changed files with 10 additions and 20 deletions
|
@ -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 (
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue