mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Lexer: Migrated to unicodeLatinAlpha
This commit is contained in:
parent
ea26369f80
commit
0086a51311
2 changed files with 3 additions and 11 deletions
|
@ -143,13 +143,6 @@ const std::string Lexer::typeName (const Lexer::Type& type)
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
bool Lexer::isAlpha (int c)
|
|
||||||
{
|
|
||||||
return (c >= 'A' && c <= 'Z') ||
|
|
||||||
(c >= 'a' && c <= 'z');
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Digits 0-9.
|
// Digits 0-9.
|
||||||
//
|
//
|
||||||
|
@ -225,7 +218,7 @@ bool Lexer::isBoundary (int left, int right)
|
||||||
if (right == '\0') return true;
|
if (right == '\0') return true;
|
||||||
|
|
||||||
// XOR
|
// XOR
|
||||||
if (isAlpha (left) != isAlpha (right)) return true;
|
if (unicodeLatinAlpha (left) != unicodeLatinAlpha (right)) return true;
|
||||||
if (isDigit (left) != isDigit (right)) return true;
|
if (isDigit (left) != isDigit (right)) return true;
|
||||||
if (unicodeWhitespace (left) != unicodeWhitespace (right)) return true;
|
if (unicodeWhitespace (left) != unicodeWhitespace (right)) return true;
|
||||||
|
|
||||||
|
@ -262,7 +255,7 @@ bool Lexer::isPunctuation (int c)
|
||||||
c != '$' &&
|
c != '$' &&
|
||||||
c != '_' &&
|
c != '_' &&
|
||||||
! isDigit (c) &&
|
! isDigit (c) &&
|
||||||
! isAlpha (c);
|
! unicodeLatinAlpha (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1217,7 +1210,7 @@ bool Lexer::isDOM (std::string& token, Lexer::Type& type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lookahead: !<alpha>
|
// Lookahead: !<alpha>
|
||||||
else if (! isAlpha (_text[marker]))
|
else if (! unicodeLatinAlpha (_text[marker]))
|
||||||
{
|
{
|
||||||
token = _text.substr (marker, _cursor - marker);
|
token = _text.substr (marker, _cursor - marker);
|
||||||
type = Lexer::Type::dom;
|
type = Lexer::Type::dom;
|
||||||
|
|
|
@ -61,7 +61,6 @@ public:
|
||||||
|
|
||||||
// Static helpers.
|
// Static helpers.
|
||||||
static const std::string typeName (const Lexer::Type&);
|
static const std::string typeName (const Lexer::Type&);
|
||||||
static bool isAlpha (int);
|
|
||||||
static bool isDigit (int);
|
static bool isDigit (int);
|
||||||
static bool isIdentifierStart (int);
|
static bool isIdentifierStart (int);
|
||||||
static bool isIdentifierNext (int);
|
static bool isIdentifierNext (int);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue