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_table.go.tmpl | |
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_table.go.tmpl')
-rw-r--r-- | compiler/ucd_table.go.tmpl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/ucd_table.go.tmpl b/compiler/ucd_table.go.tmpl index ad336d9..8d6fbc8 100644 --- a/compiler/ucd_table.go.tmpl +++ b/compiler/ucd_table.go.tmpl @@ -26,6 +26,7 @@ var compositGeneralCategories = map[string][]string{ // https://www.unicode.org/Public/13.0.0/ucd/DerivedCoreProperties.txt var derivedCoreProperties = map[string][]string{ + "alpha": {`\p{Lowercase=yes}`, `\p{Uppercase=yes}`, `\p{Lt}`, `\p{Lm}`, `\p{Lo}`, `\p{Nl}`, `\p{Other_Alphabetic=yes}`}, "lower": {`\p{Ll}`, `\p{Other_Lowercase=yes}`}, "upper": {`\p{Lu}`, `\p{Other_Uppercase=yes}`}, } @@ -34,6 +35,10 @@ var derivedCoreProperties = map[string][]string{ var propertyNameAbbs = map[string]string{ "generalcategory": "gc", "gc": "gc", + "alphabetic": "alpha", + "alpha": "alpha", + "otheralphabetic": "oalpha", + "oalpha": "oalpha", "lowercase": "lower", "lower": "lower", "uppercase": "upper", @@ -73,6 +78,11 @@ var generalCategoryCodePoints = map[string][]*ucd.CodePointRange{ {{ range $prop } // https://www.unicode.org/Public/13.0.0/ucd/PropList.txt +var otherAlphabeticCodePoints = []*ucd.CodePointRange{ {{ range .PropList.OtherAlphabetic }} + &ucd.CodePointRange{From: rune({{ .From }}), To: rune({{ .To }})},{{ end }} +} + +// https://www.unicode.org/Public/13.0.0/ucd/PropList.txt var otherLowercaseCodePoints = []*ucd.CodePointRange{ {{ range .PropList.OtherLowercase }} &ucd.CodePointRange{From: rune({{ .From }}), To: rune({{ .To }})},{{ end }} } |