mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Lexer
- Exposed more primitives as static methods.
This commit is contained in:
parent
4ec1f17557
commit
38359b779a
2 changed files with 45 additions and 45 deletions
|
@ -615,6 +615,47 @@ bool Lexer::is_ws (int c)
|
|||
c == 0x3000); // ideographic space Common Separator, space
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_ident_start (int c)
|
||||
{
|
||||
return c && // Include null character check.
|
||||
! is_ws (c) &&
|
||||
! is_dec_digit (c) &&
|
||||
! is_single_op (c);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_ident (int c)
|
||||
{
|
||||
return c && // Include null character check.
|
||||
! is_ws (c) &&
|
||||
! is_single_op (c);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_single_op (int c)
|
||||
{
|
||||
return c == '+' ||
|
||||
c == '-' ||
|
||||
c == '*' ||
|
||||
c == '/' ||
|
||||
c == '(' ||
|
||||
c == ')' ||
|
||||
c == '<' ||
|
||||
c == '>' ||
|
||||
c == '^' ||
|
||||
c == '!' ||
|
||||
c == '%' ||
|
||||
c == '=' ||
|
||||
c == '~';
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_dec_digit (int c)
|
||||
{
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::boundary (int left, int right)
|
||||
{
|
||||
|
@ -747,23 +788,6 @@ bool Lexer::is_num (int c) const
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_ident_start (int c) const
|
||||
{
|
||||
return c && // Include null character check.
|
||||
! is_ws (c) &&
|
||||
! is_dec_digit (c) &&
|
||||
! is_single_op (c);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_ident (int c) const
|
||||
{
|
||||
return c && // Include null character check.
|
||||
! is_ws (c) &&
|
||||
! is_single_op (c);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_triple_op (int c0, int c1, int c2) const
|
||||
{
|
||||
|
@ -785,30 +809,6 @@ bool Lexer::is_double_op (int c0, int c1, int c2) const
|
|||
(c0 == '!' && c1 == '~');
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_single_op (int c) const
|
||||
{
|
||||
return c == '+' ||
|
||||
c == '-' ||
|
||||
c == '*' ||
|
||||
c == '/' ||
|
||||
c == '(' ||
|
||||
c == ')' ||
|
||||
c == '<' ||
|
||||
c == '>' ||
|
||||
c == '^' ||
|
||||
c == '!' ||
|
||||
c == '%' ||
|
||||
c == '=' ||
|
||||
c == '~';
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_dec_digit (int c) const
|
||||
{
|
||||
return c >= '0' && c <= '9';
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Lexer::is_hex_digit (int c) const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue