diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-11-28 17:50:38 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-11-28 17:50:38 +0900 |
commit | f0870a4d2ec589bf5de268a54d51c1da197ed882 (patch) | |
tree | cdacf26b1eabb5776c00652e58c833051285c582 /ucd/unicode_data.go | |
parent | Support Script property (Meet RL1.2 of UTS #18 partially) (diff) | |
download | tre-f0870a4d2ec589bf5de268a54d51c1da197ed882.tar.gz tre-f0870a4d2ec589bf5de268a54d51c1da197ed882.tar.xz |
Remove default value's code points of General_Category
Diffstat (limited to '')
-rw-r--r-- | ucd/unicode_data.go | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/ucd/unicode_data.go b/ucd/unicode_data.go index d45ee39..e2a8e87 100644 --- a/ucd/unicode_data.go +++ b/ucd/unicode_data.go @@ -15,7 +15,6 @@ func ParseUnicodeData(r io.Reader, propValAliases *PropertyValueAliases) (*Unico propValAliases: propValAliases, } - lastCPTo := rune(-1) p := newParser(r) for p.parse() { if len(p.fields) == 0 { @@ -25,25 +24,12 @@ func ParseUnicodeData(r io.Reader, propValAliases *PropertyValueAliases) (*Unico if err != nil { return nil, err } - if cp.From-lastCPTo > 1 { - unicodeData.addGC(propValAliases.GeneralCategoryDefaultValue, &CodePointRange{ - From: lastCPTo + 1, - To: cp.From - 1, - }) - } - lastCPTo = cp.To gc := p.fields[2].normalizedSymbol() unicodeData.addGC(gc, cp) } if p.err != nil { return nil, p.err } - if lastCPTo < propValAliases.GeneralCategoryDefaultRange.To { - unicodeData.addGC(propValAliases.GeneralCategoryDefaultValue, &CodePointRange{ - From: lastCPTo + 1, - To: propValAliases.GeneralCategoryDefaultRange.To, - }) - } return unicodeData, nil } @@ -53,10 +39,7 @@ func (u *UnicodeData) addGC(gc string, cp *CodePointRange) { // > The data file UnicodeData.txt defines many property values in each record. When a field in a data line // > for a code point is empty, that indicates that the property takes the default value for that code point. if gc == "" { - if cp.From < u.propValAliases.GeneralCategoryDefaultRange.From || cp.To > u.propValAliases.GeneralCategoryDefaultRange.To { - return - } - gc = u.propValAliases.GeneralCategoryDefaultValue + return } cps, ok := u.GeneralCategory[u.propValAliases.gcAbb(gc)] |