Regex: Tweak is_ctype implementation style
This commit is contained in:
parent
d142db80f2
commit
a52da6fe34
|
@ -1091,23 +1091,14 @@ bool is_character_class(const CharacterClass& character_class, Codepoint cp)
|
||||||
|
|
||||||
bool is_ctype(CharacterType ctype, Codepoint cp)
|
bool is_ctype(CharacterType ctype, Codepoint cp)
|
||||||
{
|
{
|
||||||
if ((ctype & CharacterType::Digit) and iswdigit(cp))
|
return ((ctype & CharacterType::Whitespace) and is_blank(cp)) or
|
||||||
return true;
|
((ctype & CharacterType::HorizontalWhitespace) and is_horizontal_blank(cp)) or
|
||||||
if ((ctype & CharacterType::Word) and is_word(cp))
|
((ctype & CharacterType::Digit) and iswdigit(cp)) or
|
||||||
return true;
|
((ctype & CharacterType::Word) and is_word(cp)) or
|
||||||
if ((ctype & CharacterType::Whitespace) and is_blank(cp))
|
((ctype & CharacterType::NotWhitespace) and not is_blank(cp)) or
|
||||||
return true;
|
((ctype & CharacterType::NotHorizontalWhitespace) and not is_horizontal_blank(cp)) or
|
||||||
if ((ctype & CharacterType::HorizontalWhitespace) and is_horizontal_blank(cp))
|
((ctype & CharacterType::NotDigit) and not iswdigit(cp)) or
|
||||||
return true;
|
((ctype & CharacterType::NotWord) and not is_word(cp));
|
||||||
if ((ctype & CharacterType::NotDigit) and not iswdigit(cp))
|
|
||||||
return true;
|
|
||||||
if ((ctype & CharacterType::NotWord) and not is_word(cp))
|
|
||||||
return true;
|
|
||||||
if ((ctype & CharacterType::NotWhitespace) and not is_blank(cp))
|
|
||||||
return true;
|
|
||||||
if ((ctype & CharacterType::NotHorizontalWhitespace) and not is_horizontal_blank(cp))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
|
@ -26,13 +26,13 @@ enum class MatchDirection
|
||||||
enum class CharacterType : unsigned char
|
enum class CharacterType : unsigned char
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
Word = 1 << 0,
|
Whitespace = 1 << 0,
|
||||||
Whitespace = 1 << 1,
|
HorizontalWhitespace = 1 << 1,
|
||||||
HorizontalWhitespace = 1 << 2,
|
Word = 1 << 2,
|
||||||
Digit = 1 << 3,
|
Digit = 1 << 3,
|
||||||
NotWord = 1 << 4,
|
NotWhitespace = 1 << 4,
|
||||||
NotWhitespace = 1 << 5,
|
NotHorizontalWhitespace = 1 << 5,
|
||||||
NotHorizontalWhitespace = 1 << 6,
|
NotWord = 1 << 6,
|
||||||
NotDigit = 1 << 7
|
NotDigit = 1 << 7
|
||||||
};
|
};
|
||||||
constexpr bool with_bit_ops(Meta::Type<CharacterType>) { return true; }
|
constexpr bool with_bit_ops(Meta::Type<CharacterType>) { return true; }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user