aboutsummaryrefslogtreecommitdiff
path: root/compiler/ucd.go
diff options
context:
space:
mode:
authorRyo Nihei <nihei.dev@gmail.com>2021-11-26 00:01:16 +0900
committerRyo Nihei <nihei.dev@gmail.com>2021-11-26 00:01:16 +0900
commite9af22730e68908f46c9aee3b35e133d34191bef (patch)
tree7c8b2a738453ca7e26c1aebc4375800b8842d3aa /compiler/ucd.go
parentMake character properties available in an inverse expression (Make [^\p{...}]... (diff)
downloadtre-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.go12
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 {