1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
package ucd
// contributoryProperties is a set of contributory properties vartan uses internally.
// Property statuses are defined in the following table.
//
// https://unicode.org/reports/tr44/#Property_List_Table
var contributoryProperties = []string{
"oalpha",
"olower",
"oupper",
}
func ContributoryProperties() []string {
return contributoryProperties
}
// https://www.unicode.org/reports/tr44/#GC_Values_Table
var compositGeneralCategories = map[string][]string{
// Cased_Letter
"lc": {"lu", "ll", "lt"},
// Letter
"l": {"lu", "ll", "lt", "lm", "lo"},
// Mark
"m": {"mm", "mc", "me"},
// Number
"n": {"nd", "nl", "no"},
// Punctuation
"p": {"pc", "pd", "ps", "pi", "pe", "pf", "po"},
// Symbol
"s": {"sm", "sc", "sk", "so"},
// Separator
"z": {"zs", "zl", "zp"},
// Other
"c": {"cc", "cf", "cs", "co", "cn"},
}
// https://www.unicode.org/Public/13.0.0/ucd/DerivedCoreProperties.txt
var derivedCoreProperties = map[string][]string{
// Alphabetic
"alpha": {
`\p{Lowercase=yes}`,
`\p{Uppercase=yes}`,
`\p{Lt}`,
`\p{Lm}`,
`\p{Lo}`,
`\p{Nl}`,
`\p{Other_Alphabetic=yes}`,
},
// Lowercase
"lower": {
`\p{Ll}`,
`\p{Other_Lowercase=yes}`,
},
// Uppercase
"upper": {
`\p{Lu}`,
`\p{Other_Uppercase=yes}`,
},
}
// https://www.unicode.org/Public/13.0.0/ucd/PropertyAliases.txt
var propertyNameAbbs = map[string]string{
"generalcategory": "gc",
"gc": "gc",
"script": "sc",
"sc": "sc",
"alphabetic": "alpha",
"alpha": "alpha",
"otheralphabetic": "oalpha",
"oalpha": "oalpha",
"lowercase": "lower",
"lower": "lower",
"uppercase": "upper",
"upper": "upper",
"otherlowercase": "olower",
"olower": "olower",
"otheruppercase": "oupper",
"oupper": "oupper",
"whitespace": "wspace",
"wspace": "wspace",
"space": "wspace",
}
// https://www.unicode.org/reports/tr44/#Type_Key_Table
// https://www.unicode.org/reports/tr44/#Binary_Values_Table
var binaryValues = map[string]bool{
"yes": true,
"y": true,
"true": true,
"t": true,
"no": false,
"n": false,
"false": false,
"f": false,
}
|