Tweak categorize(Codepoint) implementation

This commit is contained in:
Maxime Coste 2016-04-03 18:25:48 +01:00
parent b5a68307ba
commit 15e82518d3

View File

@ -58,14 +58,13 @@ enum class CharCategories
template<WordType word_type = Word> template<WordType word_type = Word>
inline CharCategories categorize(Codepoint c) inline CharCategories categorize(Codepoint c)
{ {
if (is_word(c))
return CharCategories::Word;
if (is_eol(c)) if (is_eol(c))
return CharCategories::EndOfLine; return CharCategories::EndOfLine;
if (is_horizontal_blank(c)) if (is_horizontal_blank(c))
return CharCategories::Blank; return CharCategories::Blank;
return word_type == WORD ? CharCategories::Word if (word_type == WORD or is_word(c))
: CharCategories::Punctuation; return CharCategories::Word;
return CharCategories::Punctuation;
} }
inline Codepoint to_lower(Codepoint cp) { return towlower((wchar_t)cp); } inline Codepoint to_lower(Codepoint cp) { return towlower((wchar_t)cp); }