Skip to content

Commit

Permalink
Fix ellipsis punctuation checks after a9ace12
Browse files Browse the repository at this point in the history
Apparently, U+2026 is not terminal punctuation in Unicode
classification, so the QA check for its correct use was accidentally
broken by a9ace12.
  • Loading branch information
vslavik committed Jun 2, 2020
1 parent ca1286c commit 23e86f2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/qa_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ class PunctuationMismatch : public QACheck

const UChar32 s_last = source.Last();
const UChar32 t_last = translation.Last();
const bool s_punct = u_hasBinaryProperty(s_last, UCHAR_TERMINAL_PUNCTUATION) || u_hasBinaryProperty(s_last, UCHAR_QUOTATION_MARK);
const bool t_punct = u_hasBinaryProperty(t_last, UCHAR_TERMINAL_PUNCTUATION) || u_hasBinaryProperty(t_last, UCHAR_QUOTATION_MARK);
const bool s_punct = IsPunctuation(s_last);
const bool t_punct = IsPunctuation(t_last);

if (u_getIntPropertyValue(s_last, UCHAR_BIDI_PAIRED_BRACKET_TYPE) == U_BPT_CLOSE ||
u_getIntPropertyValue(t_last, UCHAR_BIDI_PAIRED_BRACKET_TYPE) == U_BPT_CLOSE)
Expand Down Expand Up @@ -238,6 +238,13 @@ class PunctuationMismatch : public QACheck
}

private:
bool IsPunctuation(UChar32 c) const
{
return u_hasBinaryProperty(c, UCHAR_TERMINAL_PUNCTUATION) ||
u_hasBinaryProperty(c, UCHAR_QUOTATION_MARK) ||
c == L''; // somehow U+2026 ellipsis is not terminal punctuation
}

bool IsEquivalent(UChar32 src, UChar32 trans) const
{
if (src == trans)
Expand Down

0 comments on commit 23e86f2

Please sign in to comment.