summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/text/internal/export/idna/gen.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/text/internal/export/idna/gen.go')
-rw-r--r--vendor/golang.org/x/text/internal/export/idna/gen.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/vendor/golang.org/x/text/internal/export/idna/gen.go b/vendor/golang.org/x/text/internal/export/idna/gen.go
index 27a5e1c43..cce630535 100644
--- a/vendor/golang.org/x/text/internal/export/idna/gen.go
+++ b/vendor/golang.org/x/text/internal/export/idna/gen.go
@@ -21,6 +21,7 @@ import (
"golang.org/x/text/internal/gen"
"golang.org/x/text/internal/triegen"
"golang.org/x/text/internal/ucd"
+ "golang.org/x/text/unicode/bidi"
)
func main() {
@@ -35,6 +36,12 @@ var runes = map[rune]info{}
func genTables() {
t := triegen.NewTrie("idna")
+ ucd.Parse(gen.OpenUCDFile("DerivedNormalizationProps.txt"), func(p *ucd.Parser) {
+ r := p.Rune(0)
+ if p.String(1) == "NFC_QC" { // p.String(2) is "N" or "M"
+ runes[r] = mayNeedNorm
+ }
+ })
ucd.Parse(gen.OpenUCDFile("UnicodeData.txt"), func(p *ucd.Parser) {
r := p.Rune(0)
@@ -44,7 +51,17 @@ func genTables() {
}
switch {
case unicode.In(r, unicode.Mark):
- runes[r] |= modifier
+ runes[r] |= modifier | mayNeedNorm
+ }
+ // TODO: by using UnicodeData.txt we don't mark undefined codepoints
+ // that are earmarked as RTL properly. However, an undefined cp will
+ // always fail, so there is no need to store this info.
+ switch p, _ := bidi.LookupRune(r); p.Class() {
+ case bidi.R, bidi.AL, bidi.AN:
+ if x := runes[r]; x != 0 && x != mayNeedNorm {
+ log.Fatalf("%U: rune both modifier and RTL letter/number", r)
+ }
+ runes[r] = rtl
}
})