diff options
author | Ryo Nihei <nihei.dev@gmail.com> | 2021-11-26 00:01:16 +0900 |
---|---|---|
committer | Ryo Nihei <nihei.dev@gmail.com> | 2021-11-26 00:01:16 +0900 |
commit | e9af22730e68908f46c9aee3b35e133d34191bef (patch) | |
tree | 7c8b2a738453ca7e26c1aebc4375800b8842d3aa /compiler/ucd.go | |
parent | Make character properties available in an inverse expression (Make [^\p{...}]... (diff) | |
download | tre-e9af22730e68908f46c9aee3b35e133d34191bef.tar.gz tre-e9af22730e68908f46c9aee3b35e133d34191bef.tar.xz |
Support Alphabetic property (Meet RL1.2 of UTS #18 partially)
Diffstat (limited to 'compiler/ucd.go')
-rw-r--r-- | compiler/ucd.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/ucd.go b/compiler/ucd.go index 3c0bee1..80b46ab 100644 --- a/compiler/ucd.go +++ b/compiler/ucd.go @@ -33,7 +33,7 @@ func normalizeCharacterProperty(propName, propVal string) (string, error) { fmt.Fprint(&b, prop) } fmt.Fprint(&b, "]") - + return b.String(), nil } @@ -61,6 +61,16 @@ func findCodePointRanges(propName, propVal string) ([]*ucd.CodePointRange, bool, ranges = append(ranges, rs...) } return ranges, false, nil + case "oalpha": + yes, ok := binaryValues[ucd.NormalizeSymbolicValue(propVal)] + if !ok { + return nil, false, fmt.Errorf("unsupported character property value: %v", propVal) + } + if yes { + return otherAlphabeticCodePoints, false, nil + } else { + return otherAlphabeticCodePoints, true, nil + } case "olower": yes, ok := binaryValues[ucd.NormalizeSymbolicValue(propVal)] if !ok { |