...
1
2
3
4
5
6
7 package main
8
9
10
11
12 import (
13 "log"
14
15 "golang.org/x/text/internal/ucd"
16 )
17
18 func catFromEntry(p *ucd.Parser) (cat category) {
19 r := p.Rune(0)
20 switch s := p.String(1); s {
21 case "valid":
22 cat = valid
23 case "disallowed":
24 cat = disallowed
25 case "disallowed_STD3_valid":
26 cat = disallowedSTD3Valid
27 case "disallowed_STD3_mapped":
28 cat = disallowedSTD3Mapped
29 case "mapped":
30 cat = mapped
31 case "deviation":
32 cat = deviation
33 case "ignored":
34 cat = ignored
35 default:
36 log.Fatalf("%U: Unknown category %q", r, s)
37 }
38 if s := p.String(3); s != "" {
39 if cat != valid {
40 log.Fatalf(`%U: %s defined for %q; want "valid"`, r, s, p.String(1))
41 }
42 switch s {
43 case "NV8":
44 cat = validNV8
45 case "XV8":
46 cat = validXV8
47 default:
48 log.Fatalf("%U: Unexpected exception %q", r, s)
49 }
50 }
51 return cat
52 }
53
54 var joinType = map[string]info{
55 "L": joiningL,
56 "D": joiningD,
57 "T": joiningT,
58 "R": joiningR,
59 }
60
View as plain text