From 6ebbc8f9829bf0f3127367769c662d1a8f881a2d Mon Sep 17 00:00:00 2001 From: Ryo Nihei Date: Thu, 25 Nov 2021 21:18:34 +0900 Subject: Support Lowercase and Uppercase property (Meet RL1.2 of UTS #18 partially) --- ucd/prop_list.go | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'ucd') diff --git a/ucd/prop_list.go b/ucd/prop_list.go index cd4a7fe..1ceaaea 100644 --- a/ucd/prop_list.go +++ b/ucd/prop_list.go @@ -3,32 +3,43 @@ package ucd import "io" type PropList struct { - WhiteSpace []*CodePointRange + OtherLowercase []*CodePointRange + OtherUppercase []*CodePointRange + WhiteSpace []*CodePointRange } // ParsePropList parses the PropList.txt. func ParsePropList(r io.Reader) (*PropList, error) { + var ol []*CodePointRange + var ou []*CodePointRange var ws []*CodePointRange p := newParser(r) for p.parse() { if len(p.fields) == 0 { continue } - if p.fields[1].symbol() != "White_Space" { - continue - } - + cp, err := p.fields[0].codePointRange() if err != nil { return nil, err } - ws = append(ws, cp) + + switch p.fields[1].symbol() { + case "Other_Lowercase": + ol = append(ol, cp) + case "Other_Uppercase": + ou = append(ou, cp) + case "White_Space": + ws = append(ws, cp) + } } if p.err != nil { return nil, p.err } return &PropList{ - WhiteSpace: ws, + OtherLowercase: ol, + OtherUppercase: ou, + WhiteSpace: ws, }, nil } -- cgit v1.2.3