ires 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -45
- data/ext/Gopkg.lock +31 -1
- data/ext/ires/image.go +227 -0
- data/ext/ires/ires.go +47 -59
- data/ext/ires/uri.go +143 -0
- data/ext/main.go +18 -9
- data/ext/vendor/github.com/PuerkitoBio/purell/LICENSE +12 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/README.md +187 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/bench_test.go +57 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/benchmarks/v0.1.0 +9 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/example_test.go +35 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/purell.go +379 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/purell_test.go +768 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/urlnorm_test.go +53 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/LICENSE +27 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/README.md +16 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/urlesc.go +180 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/urlesc_test.go +641 -0
- data/ext/vendor/github.com/{satori/go.uuid → goware/urlx}/LICENSE +3 -1
- data/ext/vendor/github.com/goware/urlx/README.md +172 -0
- data/ext/vendor/github.com/goware/urlx/urlx.go +196 -0
- data/ext/vendor/github.com/goware/urlx/urlx_test.go +232 -0
- data/ext/vendor/golang.org/x/net/AUTHORS +3 -0
- data/ext/vendor/golang.org/x/net/CONTRIBUTING.md +31 -0
- data/ext/vendor/golang.org/x/net/CONTRIBUTORS +3 -0
- data/ext/vendor/golang.org/x/net/LICENSE +27 -0
- data/ext/vendor/golang.org/x/net/PATENTS +22 -0
- data/ext/vendor/golang.org/x/net/README.md +16 -0
- data/ext/vendor/golang.org/x/net/bpf/asm.go +41 -0
- data/ext/vendor/golang.org/x/net/bpf/constants.go +218 -0
- data/ext/vendor/golang.org/x/net/bpf/doc.go +82 -0
- data/ext/vendor/golang.org/x/net/bpf/instructions.go +704 -0
- data/ext/vendor/golang.org/x/net/bpf/instructions_test.go +525 -0
- data/ext/vendor/golang.org/x/net/bpf/setter.go +10 -0
- data/ext/vendor/golang.org/x/net/bpf/testdata/all_instructions.bpf +1 -0
- data/ext/vendor/golang.org/x/net/bpf/testdata/all_instructions.txt +79 -0
- data/ext/vendor/golang.org/x/net/bpf/vm.go +140 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_aluop_test.go +512 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_bpf_test.go +192 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_extension_test.go +49 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_instructions.go +174 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_jump_test.go +380 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_load_test.go +246 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_ret_test.go +115 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_scratch_test.go +247 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_test.go +144 -0
- data/ext/vendor/golang.org/x/net/codereview.cfg +1 -0
- data/ext/vendor/golang.org/x/net/context/context.go +54 -0
- data/ext/vendor/golang.org/x/net/context/context_test.go +583 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go +74 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go +29 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go +147 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17_test.go +79 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_test.go +105 -0
- data/ext/vendor/golang.org/x/net/context/go17.go +72 -0
- data/ext/vendor/golang.org/x/net/context/go19.go +20 -0
- data/ext/vendor/golang.org/x/net/context/pre_go17.go +300 -0
- data/ext/vendor/golang.org/x/net/context/pre_go19.go +109 -0
- data/ext/vendor/golang.org/x/net/context/withtimeout_test.go +31 -0
- data/ext/vendor/golang.org/x/net/dict/dict.go +210 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/example_test.go +132 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/message.go +1997 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/message_test.go +1116 -0
- data/ext/vendor/golang.org/x/net/html/atom/atom.go +78 -0
- data/ext/vendor/golang.org/x/net/html/atom/atom_test.go +109 -0
- data/ext/vendor/golang.org/x/net/html/atom/gen.go +709 -0
- data/ext/vendor/golang.org/x/net/html/atom/table.go +777 -0
- data/ext/vendor/golang.org/x/net/html/atom/table_test.go +373 -0
- data/ext/vendor/golang.org/x/net/html/charset/charset.go +257 -0
- data/ext/vendor/golang.org/x/net/html/charset/charset_test.go +237 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-charset.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-UTF-8-BOM.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-meta-charset.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-meta-content.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/No-encoding-declaration.html +47 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/README +9 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-16BE-BOM.html +0 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-16LE-BOM.html +0 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-8-BOM-vs-meta-charset.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-8-BOM-vs-meta-content.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/meta-charset-attribute.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/meta-content-attribute.html +48 -0
- data/ext/vendor/golang.org/x/net/html/const.go +104 -0
- data/ext/vendor/golang.org/x/net/html/doc.go +106 -0
- data/ext/vendor/golang.org/x/net/html/doctype.go +156 -0
- data/ext/vendor/golang.org/x/net/html/entity.go +2253 -0
- data/ext/vendor/golang.org/x/net/html/entity_test.go +29 -0
- data/ext/vendor/golang.org/x/net/html/escape.go +258 -0
- data/ext/vendor/golang.org/x/net/html/escape_test.go +97 -0
- data/ext/vendor/golang.org/x/net/html/example_test.go +40 -0
- data/ext/vendor/golang.org/x/net/html/foreign.go +226 -0
- data/ext/vendor/golang.org/x/net/html/node.go +193 -0
- data/ext/vendor/golang.org/x/net/html/node_test.go +146 -0
- data/ext/vendor/golang.org/x/net/html/parse.go +2094 -0
- data/ext/vendor/golang.org/x/net/html/parse_test.go +388 -0
- data/ext/vendor/golang.org/x/net/html/render.go +271 -0
- data/ext/vendor/golang.org/x/net/html/render_test.go +156 -0
- data/ext/vendor/golang.org/x/net/html/testdata/go1.html +2237 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/README +28 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/adoption01.dat +194 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/adoption02.dat +31 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/comments01.dat +135 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/doctype01.dat +370 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/entities01.dat +603 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/entities02.dat +249 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/html5test-com.dat +246 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/inbody01.dat +43 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/isindex.dat +40 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/pending-spec-changes-plain-text-unsafe.dat +0 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/pending-spec-changes.dat +52 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/plain-text-unsafe.dat +0 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scriptdata01.dat +308 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scripted/adoption01.dat +15 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scripted/webkit01.dat +28 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tables01.dat +212 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests1.dat +1952 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests10.dat +799 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests11.dat +482 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests12.dat +62 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests14.dat +74 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests15.dat +208 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests16.dat +2299 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests17.dat +153 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests18.dat +269 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests19.dat +1237 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests2.dat +763 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests20.dat +455 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests21.dat +221 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests22.dat +157 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests23.dat +155 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests24.dat +79 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests25.dat +219 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests26.dat +313 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests3.dat +305 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests4.dat +59 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests5.dat +191 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests6.dat +663 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests7.dat +390 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests8.dat +148 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests9.dat +457 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests_innerHTML_1.dat +741 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tricky01.dat +261 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/webkit01.dat +610 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/webkit02.dat +159 -0
- data/ext/vendor/golang.org/x/net/html/token.go +1219 -0
- data/ext/vendor/golang.org/x/net/html/token_test.go +748 -0
- data/ext/vendor/golang.org/x/net/http2/Dockerfile +51 -0
- data/ext/vendor/golang.org/x/net/http2/Makefile +3 -0
- data/ext/vendor/golang.org/x/net/http2/README +20 -0
- data/ext/vendor/golang.org/x/net/http2/ciphers.go +641 -0
- data/ext/vendor/golang.org/x/net/http2/ciphers_test.go +309 -0
- data/ext/vendor/golang.org/x/net/http2/client_conn_pool.go +256 -0
- data/ext/vendor/golang.org/x/net/http2/configure_transport.go +80 -0
- data/ext/vendor/golang.org/x/net/http2/databuffer.go +146 -0
- data/ext/vendor/golang.org/x/net/http2/databuffer_test.go +157 -0
- data/ext/vendor/golang.org/x/net/http2/errors.go +133 -0
- data/ext/vendor/golang.org/x/net/http2/errors_test.go +24 -0
- data/ext/vendor/golang.org/x/net/http2/flow.go +50 -0
- data/ext/vendor/golang.org/x/net/http2/flow_test.go +53 -0
- data/ext/vendor/golang.org/x/net/http2/frame.go +1579 -0
- data/ext/vendor/golang.org/x/net/http2/frame_test.go +1191 -0
- data/ext/vendor/golang.org/x/net/http2/go16.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/go17.go +106 -0
- data/ext/vendor/golang.org/x/net/http2/go17_not18.go +36 -0
- data/ext/vendor/golang.org/x/net/http2/go18.go +56 -0
- data/ext/vendor/golang.org/x/net/http2/go18_test.go +79 -0
- data/ext/vendor/golang.org/x/net/http2/go19.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/go19_test.go +60 -0
- data/ext/vendor/golang.org/x/net/http2/gotrack.go +170 -0
- data/ext/vendor/golang.org/x/net/http2/gotrack_test.go +33 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/Makefile +8 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/README +16 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/h2demo.go +538 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/launch.go +302 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.key +27 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.pem +26 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.srl +1 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/server.crt +20 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/server.key +27 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/tmpl.go +1991 -0
- data/ext/vendor/golang.org/x/net/http2/h2i/README.md +97 -0
- data/ext/vendor/golang.org/x/net/http2/h2i/h2i.go +522 -0
- data/ext/vendor/golang.org/x/net/http2/headermap.go +78 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/encode.go +240 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/encode_test.go +386 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/hpack.go +490 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/hpack_test.go +722 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/huffman.go +212 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/tables.go +479 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/tables_test.go +214 -0
- data/ext/vendor/golang.org/x/net/http2/http2.go +391 -0
- data/ext/vendor/golang.org/x/net/http2/http2_test.go +199 -0
- data/ext/vendor/golang.org/x/net/http2/not_go16.go +21 -0
- data/ext/vendor/golang.org/x/net/http2/not_go17.go +87 -0
- data/ext/vendor/golang.org/x/net/http2/not_go18.go +29 -0
- data/ext/vendor/golang.org/x/net/http2/not_go19.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/pipe.go +163 -0
- data/ext/vendor/golang.org/x/net/http2/pipe_test.go +130 -0
- data/ext/vendor/golang.org/x/net/http2/server.go +2857 -0
- data/ext/vendor/golang.org/x/net/http2/server_push_test.go +521 -0
- data/ext/vendor/golang.org/x/net/http2/server_test.go +3721 -0
- data/ext/vendor/golang.org/x/net/http2/testdata/draft-ietf-httpbis-http2.xml +5021 -0
- data/ext/vendor/golang.org/x/net/http2/transport.go +2285 -0
- data/ext/vendor/golang.org/x/net/http2/transport_test.go +3714 -0
- data/ext/vendor/golang.org/x/net/http2/write.go +370 -0
- data/ext/vendor/golang.org/x/net/http2/writesched.go +242 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_priority.go +452 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_priority_test.go +541 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_random.go +72 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_random_test.go +44 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_test.go +125 -0
- data/ext/vendor/golang.org/x/net/http2/z_spec_test.go +356 -0
- data/ext/vendor/golang.org/x/net/icmp/dstunreach.go +41 -0
- data/ext/vendor/golang.org/x/net/icmp/echo.go +45 -0
- data/ext/vendor/golang.org/x/net/icmp/endpoint.go +113 -0
- data/ext/vendor/golang.org/x/net/icmp/example_test.go +63 -0
- data/ext/vendor/golang.org/x/net/icmp/extension.go +89 -0
- data/ext/vendor/golang.org/x/net/icmp/extension_test.go +259 -0
- data/ext/vendor/golang.org/x/net/icmp/helper_posix.go +75 -0
- data/ext/vendor/golang.org/x/net/icmp/interface.go +236 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv4.go +61 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv4_test.go +83 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv6.go +23 -0
- data/ext/vendor/golang.org/x/net/icmp/listen_posix.go +100 -0
- data/ext/vendor/golang.org/x/net/icmp/listen_stub.go +33 -0
- data/ext/vendor/golang.org/x/net/icmp/message.go +152 -0
- data/ext/vendor/golang.org/x/net/icmp/message_test.go +134 -0
- data/ext/vendor/golang.org/x/net/icmp/messagebody.go +41 -0
- data/ext/vendor/golang.org/x/net/icmp/mpls.go +77 -0
- data/ext/vendor/golang.org/x/net/icmp/multipart.go +109 -0
- data/ext/vendor/golang.org/x/net/icmp/multipart_test.go +442 -0
- data/ext/vendor/golang.org/x/net/icmp/packettoobig.go +43 -0
- data/ext/vendor/golang.org/x/net/icmp/paramprob.go +63 -0
- data/ext/vendor/golang.org/x/net/icmp/ping_test.go +200 -0
- data/ext/vendor/golang.org/x/net/icmp/sys_freebsd.go +11 -0
- data/ext/vendor/golang.org/x/net/icmp/timeexceeded.go +39 -0
- data/ext/vendor/golang.org/x/net/idna/example_test.go +70 -0
- data/ext/vendor/golang.org/x/net/idna/idna.go +680 -0
- data/ext/vendor/golang.org/x/net/idna/idna_test.go +108 -0
- data/ext/vendor/golang.org/x/net/idna/punycode.go +203 -0
- data/ext/vendor/golang.org/x/net/idna/punycode_test.go +198 -0
- data/ext/vendor/golang.org/x/net/idna/tables.go +4477 -0
- data/ext/vendor/golang.org/x/net/idna/trie.go +72 -0
- data/ext/vendor/golang.org/x/net/idna/trieval.go +114 -0
- data/ext/vendor/golang.org/x/net/internal/iana/const.go +180 -0
- data/ext/vendor/golang.org/x/net/internal/iana/gen.go +293 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_bsd.go +53 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_nobsd.go +15 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_posix.go +31 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_stub.go +32 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_unix.go +29 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_windows.go +42 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/interface.go +94 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/rlimit.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/stack.go +147 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go +13 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go +17 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_darwin.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_dragonfly.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_freebsd.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_linux.go +49 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_netbsd.go +47 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_openbsd.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_solaris.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/error_unix.go +31 -0
- data/ext/vendor/golang.org/x/net/internal/socket/error_windows.go +26 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_32bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_64bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_stub.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go +42 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go +39 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go +16 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux.go +36 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go +24 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go +24 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go +36 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_stub.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go +74 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_msg.go +77 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go +18 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go +18 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/internal/socket/reflect.go +62 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket.go +285 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket_go1_9_test.go +259 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket_test.go +46 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys.go +33 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_bsd.go +17 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_bsdvar.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_darwin.go +7 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_dragonfly.go +7 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux.go +27 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_386.go +55 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_386.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_arm.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.go +55 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_netbsd.go +25 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_posix.go +168 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_solaris.go +71 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_stub.go +64 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_unix.go +33 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_windows.go +70 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go +65 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go +68 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go +60 -0
- data/ext/vendor/golang.org/x/net/internal/timeseries/timeseries.go +525 -0
- data/ext/vendor/golang.org/x/net/internal/timeseries/timeseries_test.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv4/batch.go +191 -0
- data/ext/vendor/golang.org/x/net/ipv4/bpf_test.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/control.go +144 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_bsd.go +40 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_pktinfo.go +39 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_test.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_unix.go +73 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_windows.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_darwin.go +77 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_dragonfly.go +38 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_freebsd.go +75 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_linux.go +122 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_netbsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_openbsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_solaris.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv4/dgramopt.go +265 -0
- data/ext/vendor/golang.org/x/net/ipv4/doc.go +244 -0
- data/ext/vendor/golang.org/x/net/ipv4/endpoint.go +187 -0
- data/ext/vendor/golang.org/x/net/ipv4/example_test.go +224 -0
- data/ext/vendor/golang.org/x/net/ipv4/gen.go +199 -0
- data/ext/vendor/golang.org/x/net/ipv4/genericopt.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/header.go +159 -0
- data/ext/vendor/golang.org/x/net/ipv4/header_test.go +228 -0
- data/ext/vendor/golang.org/x/net/ipv4/helper.go +63 -0
- data/ext/vendor/golang.org/x/net/ipv4/iana.go +34 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_linux.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_test.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicast_test.go +334 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicastlistener_test.go +265 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicastsockopt_test.go +195 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet.go +69 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet_go1_8.go +56 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet_go1_9.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg.go +36 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_8.go +59 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_9.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_nocmsg.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_go1_8_test.go +248 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_go1_9_test.go +388 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_test.go +140 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt.go +44 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt_posix.go +71 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt_stub.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreq.go +119 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreqn.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bpf.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_darwin.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_dragonfly.go +35 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_freebsd.go +76 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_linux.go +59 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_solaris.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_ssmreq.go +54 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_windows.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/unicast_test.go +247 -0
- data/ext/vendor/golang.org/x/net/ipv4/unicastsockopt_test.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_darwin.go +99 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go +31 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_386.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_netbsd.go +30 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_openbsd.go +30 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_solaris.go +100 -0
- data/ext/vendor/golang.org/x/net/ipv6/batch.go +119 -0
- data/ext/vendor/golang.org/x/net/ipv6/bpf_test.go +96 -0
- data/ext/vendor/golang.org/x/net/ipv6/control.go +187 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_rfc2292_unix.go +48 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_rfc3542_unix.go +94 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_test.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_unix.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_windows.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_darwin.go +112 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_dragonfly.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_freebsd.go +105 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_linux.go +147 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_netbsd.go +80 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_openbsd.go +89 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_solaris.go +114 -0
- data/ext/vendor/golang.org/x/net/ipv6/dgramopt.go +302 -0
- data/ext/vendor/golang.org/x/net/ipv6/doc.go +243 -0
- data/ext/vendor/golang.org/x/net/ipv6/endpoint.go +128 -0
- data/ext/vendor/golang.org/x/net/ipv6/example_test.go +216 -0
- data/ext/vendor/golang.org/x/net/ipv6/gen.go +199 -0
- data/ext/vendor/golang.org/x/net/ipv6/genericopt.go +58 -0
- data/ext/vendor/golang.org/x/net/ipv6/header.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/header_test.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/helper.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/iana.go +82 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp.go +60 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_bsd.go +29 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_linux.go +27 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_solaris.go +27 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_stub.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_test.go +96 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_windows.go +22 -0
- data/ext/vendor/golang.org/x/net/ipv6/mocktransponder_test.go +32 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicast_test.go +264 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicastlistener_test.go +261 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicastsockopt_test.go +157 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg.go +35 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_8.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_9.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_nocmsg.go +41 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_go1_8_test.go +242 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_go1_9_test.go +373 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_test.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt.go +43 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_posix.go +87 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_stub.go +46 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_test.go +133 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_asmreq.go +24 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go +17 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bpf.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bsd.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_darwin.go +106 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_freebsd.go +92 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_linux.go +74 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_solaris.go +74 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_ssmreq.go +54 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_windows.go +75 -0
- data/ext/vendor/golang.org/x/net/ipv6/unicast_test.go +184 -0
- data/ext/vendor/golang.org/x/net/ipv6/unicastsockopt_test.go +120 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_darwin.go +131 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_dragonfly.go +88 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go +122 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go +124 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go +124 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_386.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_arm.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_netbsd.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_openbsd.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_solaris.go +131 -0
- data/ext/vendor/golang.org/x/net/lex/httplex/httplex.go +351 -0
- data/ext/vendor/golang.org/x/net/lex/httplex/httplex_test.go +119 -0
- data/ext/vendor/golang.org/x/net/lif/address.go +105 -0
- data/ext/vendor/golang.org/x/net/lif/address_test.go +123 -0
- data/ext/vendor/golang.org/x/net/lif/binary.go +115 -0
- data/ext/vendor/golang.org/x/net/lif/defs_solaris.go +90 -0
- data/ext/vendor/golang.org/x/net/lif/lif.go +43 -0
- data/ext/vendor/golang.org/x/net/lif/link.go +126 -0
- data/ext/vendor/golang.org/x/net/lif/link_test.go +63 -0
- data/ext/vendor/golang.org/x/net/lif/sys.go +21 -0
- data/ext/vendor/golang.org/x/net/lif/sys_solaris_amd64.s +8 -0
- data/ext/vendor/golang.org/x/net/lif/syscall.go +28 -0
- data/ext/vendor/golang.org/x/net/lif/zsys_solaris_amd64.go +103 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest.go +456 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_go16.go +24 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_go17.go +24 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_test.go +76 -0
- data/ext/vendor/golang.org/x/net/netutil/listen.go +48 -0
- data/ext/vendor/golang.org/x/net/netutil/listen_test.go +101 -0
- data/ext/vendor/golang.org/x/net/proxy/direct.go +18 -0
- data/ext/vendor/golang.org/x/net/proxy/per_host.go +140 -0
- data/ext/vendor/golang.org/x/net/proxy/per_host_test.go +55 -0
- data/ext/vendor/golang.org/x/net/proxy/proxy.go +134 -0
- data/ext/vendor/golang.org/x/net/proxy/proxy_test.go +215 -0
- data/ext/vendor/golang.org/x/net/proxy/socks5.go +214 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/gen.go +713 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/list.go +135 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/list_test.go +416 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/table.go +9419 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/table_test.go +16756 -0
- data/ext/vendor/golang.org/x/net/route/address.go +425 -0
- data/ext/vendor/golang.org/x/net/route/address_darwin_test.go +63 -0
- data/ext/vendor/golang.org/x/net/route/address_test.go +103 -0
- data/ext/vendor/golang.org/x/net/route/binary.go +90 -0
- data/ext/vendor/golang.org/x/net/route/defs_darwin.go +114 -0
- data/ext/vendor/golang.org/x/net/route/defs_dragonfly.go +113 -0
- data/ext/vendor/golang.org/x/net/route/defs_freebsd.go +337 -0
- data/ext/vendor/golang.org/x/net/route/defs_netbsd.go +112 -0
- data/ext/vendor/golang.org/x/net/route/defs_openbsd.go +116 -0
- data/ext/vendor/golang.org/x/net/route/interface.go +64 -0
- data/ext/vendor/golang.org/x/net/route/interface_announce.go +32 -0
- data/ext/vendor/golang.org/x/net/route/interface_classic.go +66 -0
- data/ext/vendor/golang.org/x/net/route/interface_freebsd.go +78 -0
- data/ext/vendor/golang.org/x/net/route/interface_multicast.go +30 -0
- data/ext/vendor/golang.org/x/net/route/interface_openbsd.go +90 -0
- data/ext/vendor/golang.org/x/net/route/message.go +72 -0
- data/ext/vendor/golang.org/x/net/route/message_darwin_test.go +34 -0
- data/ext/vendor/golang.org/x/net/route/message_freebsd_test.go +92 -0
- data/ext/vendor/golang.org/x/net/route/message_test.go +239 -0
- data/ext/vendor/golang.org/x/net/route/route.go +123 -0
- data/ext/vendor/golang.org/x/net/route/route_classic.go +67 -0
- data/ext/vendor/golang.org/x/net/route/route_openbsd.go +65 -0
- data/ext/vendor/golang.org/x/net/route/route_test.go +390 -0
- data/ext/vendor/golang.org/x/net/route/sys.go +39 -0
- data/ext/vendor/golang.org/x/net/route/sys_darwin.go +87 -0
- data/ext/vendor/golang.org/x/net/route/sys_dragonfly.go +76 -0
- data/ext/vendor/golang.org/x/net/route/sys_freebsd.go +155 -0
- data/ext/vendor/golang.org/x/net/route/sys_netbsd.go +71 -0
- data/ext/vendor/golang.org/x/net/route/sys_openbsd.go +80 -0
- data/ext/vendor/golang.org/x/net/route/syscall.go +28 -0
- data/ext/vendor/golang.org/x/net/route/zsys_darwin.go +99 -0
- data/ext/vendor/golang.org/x/net/route/zsys_dragonfly.go +98 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_386.go +126 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go +123 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_arm.go +123 -0
- data/ext/vendor/golang.org/x/net/route/zsys_netbsd.go +97 -0
- data/ext/vendor/golang.org/x/net/route/zsys_openbsd.go +101 -0
- data/ext/vendor/golang.org/x/net/trace/events.go +532 -0
- data/ext/vendor/golang.org/x/net/trace/histogram.go +365 -0
- data/ext/vendor/golang.org/x/net/trace/histogram_test.go +325 -0
- data/ext/vendor/golang.org/x/net/trace/trace.go +1082 -0
- data/ext/vendor/golang.org/x/net/trace/trace_go16.go +21 -0
- data/ext/vendor/golang.org/x/net/trace/trace_go17.go +21 -0
- data/ext/vendor/golang.org/x/net/trace/trace_test.go +178 -0
- data/ext/vendor/golang.org/x/net/webdav/file.go +796 -0
- data/ext/vendor/golang.org/x/net/webdav/file_go1.6.go +17 -0
- data/ext/vendor/golang.org/x/net/webdav/file_go1.7.go +16 -0
- data/ext/vendor/golang.org/x/net/webdav/file_test.go +1184 -0
- data/ext/vendor/golang.org/x/net/webdav/if.go +173 -0
- data/ext/vendor/golang.org/x/net/webdav/if_test.go +322 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/README +11 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/atom_test.go +56 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/example_test.go +151 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/marshal.go +1223 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/marshal_test.go +1939 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/read.go +692 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/read_test.go +744 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/typeinfo.go +371 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/xml.go +1998 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/xml_test.go +752 -0
- data/ext/vendor/golang.org/x/net/webdav/litmus_test_server.go +94 -0
- data/ext/vendor/golang.org/x/net/webdav/lock.go +445 -0
- data/ext/vendor/golang.org/x/net/webdav/lock_test.go +731 -0
- data/ext/vendor/golang.org/x/net/webdav/prop.go +418 -0
- data/ext/vendor/golang.org/x/net/webdav/prop_test.go +613 -0
- data/ext/vendor/golang.org/x/net/webdav/webdav.go +702 -0
- data/ext/vendor/golang.org/x/net/webdav/webdav_test.go +344 -0
- data/ext/vendor/golang.org/x/net/webdav/xml.go +519 -0
- data/ext/vendor/golang.org/x/net/webdav/xml_test.go +906 -0
- data/ext/vendor/golang.org/x/net/websocket/client.go +106 -0
- data/ext/vendor/golang.org/x/net/websocket/dial.go +24 -0
- data/ext/vendor/golang.org/x/net/websocket/dial_test.go +43 -0
- data/ext/vendor/golang.org/x/net/websocket/exampledial_test.go +31 -0
- data/ext/vendor/golang.org/x/net/websocket/examplehandler_test.go +26 -0
- data/ext/vendor/golang.org/x/net/websocket/hybi.go +583 -0
- data/ext/vendor/golang.org/x/net/websocket/hybi_test.go +608 -0
- data/ext/vendor/golang.org/x/net/websocket/server.go +113 -0
- data/ext/vendor/golang.org/x/net/websocket/websocket.go +448 -0
- data/ext/vendor/golang.org/x/net/websocket/websocket_test.go +665 -0
- data/ext/vendor/golang.org/x/net/xsrftoken/xsrf.go +94 -0
- data/ext/vendor/golang.org/x/net/xsrftoken/xsrf_test.go +83 -0
- data/ext/vendor/golang.org/x/text/AUTHORS +3 -0
- data/ext/vendor/golang.org/x/text/CONTRIBUTING.md +31 -0
- data/ext/vendor/golang.org/x/text/CONTRIBUTORS +3 -0
- data/ext/vendor/golang.org/x/text/LICENSE +27 -0
- data/ext/vendor/golang.org/x/text/PATENTS +22 -0
- data/ext/vendor/golang.org/x/text/README.md +91 -0
- data/ext/vendor/golang.org/x/text/cases/cases.go +162 -0
- data/ext/vendor/golang.org/x/text/cases/context.go +376 -0
- data/ext/vendor/golang.org/x/text/cases/context_test.go +438 -0
- data/ext/vendor/golang.org/x/text/cases/example_test.go +53 -0
- data/ext/vendor/golang.org/x/text/cases/fold.go +34 -0
- data/ext/vendor/golang.org/x/text/cases/fold_test.go +51 -0
- data/ext/vendor/golang.org/x/text/cases/gen.go +839 -0
- data/ext/vendor/golang.org/x/text/cases/gen_trieval.go +219 -0
- data/ext/vendor/golang.org/x/text/cases/icu.go +61 -0
- data/ext/vendor/golang.org/x/text/cases/icu_test.go +210 -0
- data/ext/vendor/golang.org/x/text/cases/info.go +82 -0
- data/ext/vendor/golang.org/x/text/cases/map.go +816 -0
- data/ext/vendor/golang.org/x/text/cases/map_test.go +950 -0
- data/ext/vendor/golang.org/x/text/cases/tables.go +2251 -0
- data/ext/vendor/golang.org/x/text/cases/tables_test.go +1158 -0
- data/ext/vendor/golang.org/x/text/cases/trieval.go +215 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/doc.go +35 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/extract.go +195 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/main.go +356 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/message.go +127 -0
- data/ext/vendor/golang.org/x/text/codereview.cfg +1 -0
- data/ext/vendor/golang.org/x/text/collate/build/builder.go +702 -0
- data/ext/vendor/golang.org/x/text/collate/build/builder_test.go +290 -0
- data/ext/vendor/golang.org/x/text/collate/build/colelem.go +294 -0
- data/ext/vendor/golang.org/x/text/collate/build/colelem_test.go +215 -0
- data/ext/vendor/golang.org/x/text/collate/build/contract.go +309 -0
- data/ext/vendor/golang.org/x/text/collate/build/contract_test.go +266 -0
- data/ext/vendor/golang.org/x/text/collate/build/order.go +393 -0
- data/ext/vendor/golang.org/x/text/collate/build/order_test.go +229 -0
- data/ext/vendor/golang.org/x/text/collate/build/table.go +81 -0
- data/ext/vendor/golang.org/x/text/collate/build/trie.go +290 -0
- data/ext/vendor/golang.org/x/text/collate/build/trie_test.go +107 -0
- data/ext/vendor/golang.org/x/text/collate/collate.go +403 -0
- data/ext/vendor/golang.org/x/text/collate/collate_test.go +482 -0
- data/ext/vendor/golang.org/x/text/collate/export_test.go +51 -0
- data/ext/vendor/golang.org/x/text/collate/index.go +32 -0
- data/ext/vendor/golang.org/x/text/collate/maketables.go +553 -0
- data/ext/vendor/golang.org/x/text/collate/option.go +239 -0
- data/ext/vendor/golang.org/x/text/collate/option_test.go +209 -0
- data/ext/vendor/golang.org/x/text/collate/reg_test.go +230 -0
- data/ext/vendor/golang.org/x/text/collate/sort.go +81 -0
- data/ext/vendor/golang.org/x/text/collate/sort_test.go +55 -0
- data/ext/vendor/golang.org/x/text/collate/table_test.go +291 -0
- data/ext/vendor/golang.org/x/text/collate/tables.go +73789 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/Makefile +7 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/chars.go +1156 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/col.go +97 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/colcmp.go +529 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/darwin.go +111 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/gen.go +183 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/icu.go +209 -0
- data/ext/vendor/golang.org/x/text/currency/common.go +66 -0
- data/ext/vendor/golang.org/x/text/currency/currency.go +185 -0
- data/ext/vendor/golang.org/x/text/currency/currency_test.go +171 -0
- data/ext/vendor/golang.org/x/text/currency/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/currency/format.go +215 -0
- data/ext/vendor/golang.org/x/text/currency/format_test.go +70 -0
- data/ext/vendor/golang.org/x/text/currency/gen.go +400 -0
- data/ext/vendor/golang.org/x/text/currency/gen_common.go +70 -0
- data/ext/vendor/golang.org/x/text/currency/query.go +152 -0
- data/ext/vendor/golang.org/x/text/currency/query_test.go +107 -0
- data/ext/vendor/golang.org/x/text/currency/tables.go +2574 -0
- data/ext/vendor/golang.org/x/text/currency/tables_test.go +93 -0
- data/ext/vendor/golang.org/x/text/doc.go +13 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/charmap.go +249 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/charmap_test.go +258 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/maketables.go +556 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/tables.go +7410 -0
- data/ext/vendor/golang.org/x/text/encoding/encoding.go +335 -0
- data/ext/vendor/golang.org/x/text/encoding/encoding_test.go +290 -0
- data/ext/vendor/golang.org/x/text/encoding/example_test.go +42 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/gen.go +173 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go +86 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/htmlindex_test.go +144 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/map.go +105 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/tables.go +352 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/gen.go +192 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go +209 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go +192 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/tables.go +2348 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go +180 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/gen.go +137 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go +81 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/mib.go +1621 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/internal.go +75 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/all.go +12 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/all_test.go +248 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/eucjp.go +225 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go +299 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/maketables.go +161 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/shiftjis.go +189 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/tables.go +26971 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/all_test.go +94 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/euckr.go +177 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/maketables.go +143 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/tables.go +34152 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/all.go +12 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go +143 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go +269 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go +245 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/maketables.go +161 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/tables.go +43999 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-gb18030.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-16le.txt +0 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-32be.txt +0 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-8.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-windows-1252.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-euc-jp.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-iso-2022-jp.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-shift-jis.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-utf-8.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-hz-gb2312.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-utf-8.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-gbk.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-utf-8.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-big5.txt +106 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-utf-8.txt +106 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-euc-kr.txt +175 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-utf-8.txt +175 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go +114 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go +199 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/maketables.go +140 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/tables.go +37142 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/override.go +82 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/unicode.go +434 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/unicode_test.go +499 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/utf32/utf32.go +296 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go +248 -0
- data/ext/vendor/golang.org/x/text/feature/plural/common.go +70 -0
- data/ext/vendor/golang.org/x/text/feature/plural/data_test.go +190 -0
- data/ext/vendor/golang.org/x/text/feature/plural/example_test.go +46 -0
- data/ext/vendor/golang.org/x/text/feature/plural/gen.go +513 -0
- data/ext/vendor/golang.org/x/text/feature/plural/gen_common.go +74 -0
- data/ext/vendor/golang.org/x/text/feature/plural/message.go +244 -0
- data/ext/vendor/golang.org/x/text/feature/plural/message_test.go +197 -0
- data/ext/vendor/golang.org/x/text/feature/plural/plural.go +258 -0
- data/ext/vendor/golang.org/x/text/feature/plural/plural_test.go +216 -0
- data/ext/vendor/golang.org/x/text/feature/plural/tables.go +540 -0
- data/ext/vendor/golang.org/x/text/gen.go +318 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/catmsg.go +366 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go +316 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/codec.go +407 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/varint.go +62 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/varint_test.go +123 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collate_test.go +121 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collelem.go +371 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collelem_test.go +183 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/colltab.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/colltab_test.go +64 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/contract.go +145 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/contract_test.go +131 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/iter.go +178 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/iter_test.go +63 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/numeric.go +236 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/numeric_test.go +159 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/table.go +275 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/trie.go +159 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/trie_test.go +106 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/weighter.go +31 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/weighter_test.go +42 -0
- data/ext/vendor/golang.org/x/text/internal/export/README +4 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/common_test.go +55 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/example_test.go +68 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen.go +276 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_common.go +59 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_test.go +91 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_trieval.go +123 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/idna.go +717 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/idna_test.go +308 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/punycode.go +201 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/punycode_test.go +198 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/tables.go +4557 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/trie.go +70 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/trieval.go +119 -0
- data/ext/vendor/golang.org/x/text/internal/format/format.go +41 -0
- data/ext/vendor/golang.org/x/text/internal/gen.go +52 -0
- data/ext/vendor/golang.org/x/text/internal/gen/code.go +351 -0
- data/ext/vendor/golang.org/x/text/internal/gen/gen.go +281 -0
- data/ext/vendor/golang.org/x/text/internal/gen_test.go +38 -0
- data/ext/vendor/golang.org/x/text/internal/internal.go +51 -0
- data/ext/vendor/golang.org/x/text/internal/internal_test.go +38 -0
- data/ext/vendor/golang.org/x/text/internal/match.go +67 -0
- data/ext/vendor/golang.org/x/text/internal/match_test.go +56 -0
- data/ext/vendor/golang.org/x/text/internal/number/common.go +40 -0
- data/ext/vendor/golang.org/x/text/internal/number/decimal.go +498 -0
- data/ext/vendor/golang.org/x/text/internal/number/decimal_test.go +329 -0
- data/ext/vendor/golang.org/x/text/internal/number/format.go +540 -0
- data/ext/vendor/golang.org/x/text/internal/number/format_test.go +522 -0
- data/ext/vendor/golang.org/x/text/internal/number/gen.go +458 -0
- data/ext/vendor/golang.org/x/text/internal/number/gen_common.go +44 -0
- data/ext/vendor/golang.org/x/text/internal/number/number.go +154 -0
- data/ext/vendor/golang.org/x/text/internal/number/number_test.go +100 -0
- data/ext/vendor/golang.org/x/text/internal/number/pattern.go +485 -0
- data/ext/vendor/golang.org/x/text/internal/number/pattern_test.go +438 -0
- data/ext/vendor/golang.org/x/text/internal/number/roundingmode_string.go +16 -0
- data/ext/vendor/golang.org/x/text/internal/number/tables.go +1154 -0
- data/ext/vendor/golang.org/x/text/internal/number/tables_test.go +125 -0
- data/ext/vendor/golang.org/x/text/internal/stringset/set.go +86 -0
- data/ext/vendor/golang.org/x/text/internal/stringset/set_test.go +53 -0
- data/ext/vendor/golang.org/x/text/internal/tables.go +117 -0
- data/ext/vendor/golang.org/x/text/internal/tag/tag.go +100 -0
- data/ext/vendor/golang.org/x/text/internal/tag/tag_test.go +67 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/codesize.go +53 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/flag.go +22 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/gc.go +14 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/gccgo.go +11 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/go1_6.go +23 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/go1_7.go +17 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/text.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/compact.go +58 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/data_test.go +875 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/example_compact_test.go +71 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/example_test.go +148 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/gen_test.go +68 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/print.go +251 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/triegen.go +494 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/example_test.go +81 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/ucd.go +371 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/ucd_test.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/utf8internal/utf8internal.go +87 -0
- data/ext/vendor/golang.org/x/text/language/Makefile +16 -0
- data/ext/vendor/golang.org/x/text/language/common.go +16 -0
- data/ext/vendor/golang.org/x/text/language/coverage.go +197 -0
- data/ext/vendor/golang.org/x/text/language/coverage_test.go +154 -0
- data/ext/vendor/golang.org/x/text/language/display/dict.go +92 -0
- data/ext/vendor/golang.org/x/text/language/display/dict_test.go +39 -0
- data/ext/vendor/golang.org/x/text/language/display/display.go +420 -0
- data/ext/vendor/golang.org/x/text/language/display/display_test.go +705 -0
- data/ext/vendor/golang.org/x/text/language/display/examples_test.go +116 -0
- data/ext/vendor/golang.org/x/text/language/display/lookup.go +251 -0
- data/ext/vendor/golang.org/x/text/language/display/maketables.go +602 -0
- data/ext/vendor/golang.org/x/text/language/display/tables.go +50344 -0
- data/ext/vendor/golang.org/x/text/language/doc.go +102 -0
- data/ext/vendor/golang.org/x/text/language/examples_test.go +413 -0
- data/ext/vendor/golang.org/x/text/language/gen.go +1706 -0
- data/ext/vendor/golang.org/x/text/language/gen_common.go +20 -0
- data/ext/vendor/golang.org/x/text/language/gen_index.go +162 -0
- data/ext/vendor/golang.org/x/text/language/go1_1.go +38 -0
- data/ext/vendor/golang.org/x/text/language/go1_2.go +11 -0
- data/ext/vendor/golang.org/x/text/language/httpexample_test.go +48 -0
- data/ext/vendor/golang.org/x/text/language/index.go +769 -0
- data/ext/vendor/golang.org/x/text/language/language.go +887 -0
- data/ext/vendor/golang.org/x/text/language/language_test.go +878 -0
- data/ext/vendor/golang.org/x/text/language/lookup.go +396 -0
- data/ext/vendor/golang.org/x/text/language/lookup_test.go +457 -0
- data/ext/vendor/golang.org/x/text/language/match.go +933 -0
- data/ext/vendor/golang.org/x/text/language/match_test.go +505 -0
- data/ext/vendor/golang.org/x/text/language/parse.go +859 -0
- data/ext/vendor/golang.org/x/text/language/parse_test.go +517 -0
- data/ext/vendor/golang.org/x/text/language/tables.go +3675 -0
- data/ext/vendor/golang.org/x/text/language/tags.go +143 -0
- data/ext/vendor/golang.org/x/text/language/testdata/CLDRLocaleMatcherTest.txt +389 -0
- data/ext/vendor/golang.org/x/text/language/testdata/GoLocaleMatcherTest.txt +226 -0
- data/ext/vendor/golang.org/x/text/message/catalog.go +28 -0
- data/ext/vendor/golang.org/x/text/message/catalog/catalog.go +292 -0
- data/ext/vendor/golang.org/x/text/message/catalog/catalog_test.go +194 -0
- data/ext/vendor/golang.org/x/text/message/catalog/dict.go +90 -0
- data/ext/vendor/golang.org/x/text/message/doc.go +100 -0
- data/ext/vendor/golang.org/x/text/message/examples_test.go +42 -0
- data/ext/vendor/golang.org/x/text/message/fmt_test.go +1889 -0
- data/ext/vendor/golang.org/x/text/message/format.go +532 -0
- data/ext/vendor/golang.org/x/text/message/message.go +169 -0
- data/ext/vendor/golang.org/x/text/message/message_test.go +181 -0
- data/ext/vendor/golang.org/x/text/message/print.go +1194 -0
- data/ext/vendor/golang.org/x/text/number/doc.go +28 -0
- data/ext/vendor/golang.org/x/text/number/examples_test.go +28 -0
- data/ext/vendor/golang.org/x/text/number/format.go +122 -0
- data/ext/vendor/golang.org/x/text/number/format_test.go +107 -0
- data/ext/vendor/golang.org/x/text/number/number.go +77 -0
- data/ext/vendor/golang.org/x/text/number/number_test.go +190 -0
- data/ext/vendor/golang.org/x/text/number/option.go +177 -0
- data/ext/vendor/golang.org/x/text/runes/cond.go +187 -0
- data/ext/vendor/golang.org/x/text/runes/cond_test.go +282 -0
- data/ext/vendor/golang.org/x/text/runes/example_test.go +60 -0
- data/ext/vendor/golang.org/x/text/runes/runes.go +355 -0
- data/ext/vendor/golang.org/x/text/runes/runes_test.go +664 -0
- data/ext/vendor/golang.org/x/text/search/index.go +35 -0
- data/ext/vendor/golang.org/x/text/search/pattern.go +155 -0
- data/ext/vendor/golang.org/x/text/search/pattern_test.go +357 -0
- data/ext/vendor/golang.org/x/text/search/search.go +237 -0
- data/ext/vendor/golang.org/x/text/search/tables.go +12448 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bench_test.go +54 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bidirule.go +340 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go +851 -0
- data/ext/vendor/golang.org/x/text/secure/doc.go +6 -0
- data/ext/vendor/golang.org/x/text/secure/precis/benchmark_test.go +82 -0
- data/ext/vendor/golang.org/x/text/secure/precis/class.go +36 -0
- data/ext/vendor/golang.org/x/text/secure/precis/class_test.go +50 -0
- data/ext/vendor/golang.org/x/text/secure/precis/context.go +139 -0
- data/ext/vendor/golang.org/x/text/secure/precis/doc.go +14 -0
- data/ext/vendor/golang.org/x/text/secure/precis/enforce_test.go +396 -0
- data/ext/vendor/golang.org/x/text/secure/precis/gen.go +310 -0
- data/ext/vendor/golang.org/x/text/secure/precis/gen_trieval.go +68 -0
- data/ext/vendor/golang.org/x/text/secure/precis/nickname.go +72 -0
- data/ext/vendor/golang.org/x/text/secure/precis/options.go +157 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profile.go +402 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profile_test.go +149 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profiles.go +78 -0
- data/ext/vendor/golang.org/x/text/secure/precis/tables.go +3887 -0
- data/ext/vendor/golang.org/x/text/secure/precis/tables_test.go +69 -0
- data/ext/vendor/golang.org/x/text/secure/precis/transformer.go +32 -0
- data/ext/vendor/golang.org/x/text/secure/precis/trieval.go +64 -0
- data/ext/vendor/golang.org/x/text/transform/examples_test.go +37 -0
- data/ext/vendor/golang.org/x/text/transform/transform.go +705 -0
- data/ext/vendor/golang.org/x/text/transform/transform_test.go +1317 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/bidi.go +198 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/bracket.go +335 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/core.go +1058 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/core_test.go +224 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen.go +133 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen_ranges.go +57 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen_trieval.go +64 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/prop.go +206 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/ranges_test.go +53 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/tables.go +1813 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/tables_test.go +82 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/trieval.go +60 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/base.go +100 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/cldr.go +130 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/cldr_test.go +27 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/collate.go +359 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/collate_test.go +275 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/data_test.go +186 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/decode.go +171 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/examples_test.go +21 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/makexml.go +400 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/resolve.go +602 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/resolve_test.go +368 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/slice.go +144 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/slice_test.go +175 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/xml.go +1487 -0
- data/ext/vendor/golang.org/x/text/unicode/doc.go +8 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/composition.go +508 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/composition_test.go +130 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/example_iter_test.go +82 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/forminfo.go +259 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/forminfo_test.go +54 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/input.go +109 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/iter.go +457 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/iter_test.go +98 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/maketables.go +976 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/norm_test.go +14 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/normalize.go +609 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/normalize_test.go +1287 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/readwriter.go +125 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/readwriter_test.go +56 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/tables.go +7651 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/transform.go +88 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/transform_test.go +101 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/trie.go +54 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/triegen.go +117 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/ucd_test.go +275 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/gen.go +115 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/merge.go +260 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/merge_test.go +184 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/rangetable.go +70 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go +55 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/tables.go +6376 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/bits.go +59 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/example_test.go +118 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/gen.go +195 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/gen_bits.go +63 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/runenames.go +48 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/runenames_test.go +46 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/tables.go +15514 -0
- data/ext/vendor/golang.org/x/text/width/common_test.go +92 -0
- data/ext/vendor/golang.org/x/text/width/example_test.go +52 -0
- data/ext/vendor/golang.org/x/text/width/gen.go +115 -0
- data/ext/vendor/golang.org/x/text/width/gen_common.go +96 -0
- data/ext/vendor/golang.org/x/text/width/gen_trieval.go +34 -0
- data/ext/vendor/golang.org/x/text/width/kind_string.go +16 -0
- data/ext/vendor/golang.org/x/text/width/runes_test.go +461 -0
- data/ext/vendor/golang.org/x/text/width/tables.go +1316 -0
- data/ext/vendor/golang.org/x/text/width/tables_test.go +59 -0
- data/ext/vendor/golang.org/x/text/width/transform.go +239 -0
- data/ext/vendor/golang.org/x/text/width/transform_test.go +701 -0
- data/ext/vendor/golang.org/x/text/width/trieval.go +30 -0
- data/ext/vendor/golang.org/x/text/width/width.go +206 -0
- data/lib/ires/version.rb +1 -1
- data/shared/darwin/ires.so +0 -0
- data/shared/linux/ires.so +0 -0
- metadata +1011 -23
- data/ext/operate/image.go +0 -176
- data/ext/util/uri/uri.go +0 -105
- data/ext/vendor/github.com/satori/go.uuid/README.md +0 -65
- data/ext/vendor/github.com/satori/go.uuid/benchmarks_test.go +0 -121
- data/ext/vendor/github.com/satori/go.uuid/uuid.go +0 -488
- data/ext/vendor/github.com/satori/go.uuid/uuid_test.go +0 -633
@@ -0,0 +1,1706 @@
|
|
1
|
+
// Copyright 2013 The Go Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style
|
3
|
+
// license that can be found in the LICENSE file.
|
4
|
+
|
5
|
+
// +build ignore
|
6
|
+
|
7
|
+
// Language tag table generator.
|
8
|
+
// Data read from the web.
|
9
|
+
|
10
|
+
package main
|
11
|
+
|
12
|
+
import (
|
13
|
+
"bufio"
|
14
|
+
"flag"
|
15
|
+
"fmt"
|
16
|
+
"io"
|
17
|
+
"io/ioutil"
|
18
|
+
"log"
|
19
|
+
"math"
|
20
|
+
"reflect"
|
21
|
+
"regexp"
|
22
|
+
"sort"
|
23
|
+
"strconv"
|
24
|
+
"strings"
|
25
|
+
|
26
|
+
"golang.org/x/text/internal/gen"
|
27
|
+
"golang.org/x/text/internal/tag"
|
28
|
+
"golang.org/x/text/unicode/cldr"
|
29
|
+
)
|
30
|
+
|
31
|
+
var (
|
32
|
+
test = flag.Bool("test",
|
33
|
+
false,
|
34
|
+
"test existing tables; can be used to compare web data with package data.")
|
35
|
+
outputFile = flag.String("output",
|
36
|
+
"tables.go",
|
37
|
+
"output file for generated tables")
|
38
|
+
)
|
39
|
+
|
40
|
+
var comment = []string{
|
41
|
+
`
|
42
|
+
lang holds an alphabetically sorted list of ISO-639 language identifiers.
|
43
|
+
All entries are 4 bytes. The index of the identifier (divided by 4) is the language tag.
|
44
|
+
For 2-byte language identifiers, the two successive bytes have the following meaning:
|
45
|
+
- if the first letter of the 2- and 3-letter ISO codes are the same:
|
46
|
+
the second and third letter of the 3-letter ISO code.
|
47
|
+
- otherwise: a 0 and a by 2 bits right-shifted index into altLangISO3.
|
48
|
+
For 3-byte language identifiers the 4th byte is 0.`,
|
49
|
+
`
|
50
|
+
langNoIndex is a bit vector of all 3-letter language codes that are not used as an index
|
51
|
+
in lookup tables. The language ids for these language codes are derived directly
|
52
|
+
from the letters and are not consecutive.`,
|
53
|
+
`
|
54
|
+
altLangISO3 holds an alphabetically sorted list of 3-letter language code alternatives
|
55
|
+
to 2-letter language codes that cannot be derived using the method described above.
|
56
|
+
Each 3-letter code is followed by its 1-byte langID.`,
|
57
|
+
`
|
58
|
+
altLangIndex is used to convert indexes in altLangISO3 to langIDs.`,
|
59
|
+
`
|
60
|
+
langAliasMap maps langIDs to their suggested replacements.`,
|
61
|
+
`
|
62
|
+
script is an alphabetically sorted list of ISO 15924 codes. The index
|
63
|
+
of the script in the string, divided by 4, is the internal scriptID.`,
|
64
|
+
`
|
65
|
+
isoRegionOffset needs to be added to the index of regionISO to obtain the regionID
|
66
|
+
for 2-letter ISO codes. (The first isoRegionOffset regionIDs are reserved for
|
67
|
+
the UN.M49 codes used for groups.)`,
|
68
|
+
`
|
69
|
+
regionISO holds a list of alphabetically sorted 2-letter ISO region codes.
|
70
|
+
Each 2-letter codes is followed by two bytes with the following meaning:
|
71
|
+
- [A-Z}{2}: the first letter of the 2-letter code plus these two
|
72
|
+
letters form the 3-letter ISO code.
|
73
|
+
- 0, n: index into altRegionISO3.`,
|
74
|
+
`
|
75
|
+
regionTypes defines the status of a region for various standards.`,
|
76
|
+
`
|
77
|
+
m49 maps regionIDs to UN.M49 codes. The first isoRegionOffset entries are
|
78
|
+
codes indicating collections of regions.`,
|
79
|
+
`
|
80
|
+
m49Index gives indexes into fromM49 based on the three most significant bits
|
81
|
+
of a 10-bit UN.M49 code. To search an UN.M49 code in fromM49, search in
|
82
|
+
fromM49[m49Index[msb39(code)]:m49Index[msb3(code)+1]]
|
83
|
+
for an entry where the first 7 bits match the 7 lsb of the UN.M49 code.
|
84
|
+
The region code is stored in the 9 lsb of the indexed value.`,
|
85
|
+
`
|
86
|
+
fromM49 contains entries to map UN.M49 codes to regions. See m49Index for details.`,
|
87
|
+
`
|
88
|
+
altRegionISO3 holds a list of 3-letter region codes that cannot be
|
89
|
+
mapped to 2-letter codes using the default algorithm. This is a short list.`,
|
90
|
+
`
|
91
|
+
altRegionIDs holds a list of regionIDs the positions of which match those
|
92
|
+
of the 3-letter ISO codes in altRegionISO3.`,
|
93
|
+
`
|
94
|
+
variantNumSpecialized is the number of specialized variants in variants.`,
|
95
|
+
`
|
96
|
+
suppressScript is an index from langID to the dominant script for that language,
|
97
|
+
if it exists. If a script is given, it should be suppressed from the language tag.`,
|
98
|
+
`
|
99
|
+
likelyLang is a lookup table, indexed by langID, for the most likely
|
100
|
+
scripts and regions given incomplete information. If more entries exist for a
|
101
|
+
given language, region and script are the index and size respectively
|
102
|
+
of the list in likelyLangList.`,
|
103
|
+
`
|
104
|
+
likelyLangList holds lists info associated with likelyLang.`,
|
105
|
+
`
|
106
|
+
likelyRegion is a lookup table, indexed by regionID, for the most likely
|
107
|
+
languages and scripts given incomplete information. If more entries exist
|
108
|
+
for a given regionID, lang and script are the index and size respectively
|
109
|
+
of the list in likelyRegionList.
|
110
|
+
TODO: exclude containers and user-definable regions from the list.`,
|
111
|
+
`
|
112
|
+
likelyRegionList holds lists info associated with likelyRegion.`,
|
113
|
+
`
|
114
|
+
likelyScript is a lookup table, indexed by scriptID, for the most likely
|
115
|
+
languages and regions given a script.`,
|
116
|
+
`
|
117
|
+
matchLang holds pairs of langIDs of base languages that are typically
|
118
|
+
mutually intelligible. Each pair is associated with a confidence and
|
119
|
+
whether the intelligibility goes one or both ways.`,
|
120
|
+
`
|
121
|
+
matchScript holds pairs of scriptIDs where readers of one script
|
122
|
+
can typically also read the other. Each is associated with a confidence.`,
|
123
|
+
`
|
124
|
+
nRegionGroups is the number of region groups.`,
|
125
|
+
`
|
126
|
+
regionInclusion maps region identifiers to sets of regions in regionInclusionBits,
|
127
|
+
where each set holds all groupings that are directly connected in a region
|
128
|
+
containment graph.`,
|
129
|
+
`
|
130
|
+
regionInclusionBits is an array of bit vectors where every vector represents
|
131
|
+
a set of region groupings. These sets are used to compute the distance
|
132
|
+
between two regions for the purpose of language matching.`,
|
133
|
+
`
|
134
|
+
regionInclusionNext marks, for each entry in regionInclusionBits, the set of
|
135
|
+
all groups that are reachable from the groups set in the respective entry.`,
|
136
|
+
}
|
137
|
+
|
138
|
+
// TODO: consider changing some of these structures to tries. This can reduce
|
139
|
+
// memory, but may increase the need for memory allocations. This could be
|
140
|
+
// mitigated if we can piggyback on language tags for common cases.
|
141
|
+
|
142
|
+
func failOnError(e error) {
|
143
|
+
if e != nil {
|
144
|
+
log.Panic(e)
|
145
|
+
}
|
146
|
+
}
|
147
|
+
|
148
|
+
type setType int
|
149
|
+
|
150
|
+
const (
|
151
|
+
Indexed setType = 1 + iota // all elements must be of same size
|
152
|
+
Linear
|
153
|
+
)
|
154
|
+
|
155
|
+
type stringSet struct {
|
156
|
+
s []string
|
157
|
+
sorted, frozen bool
|
158
|
+
|
159
|
+
// We often need to update values after the creation of an index is completed.
|
160
|
+
// We include a convenience map for keeping track of this.
|
161
|
+
update map[string]string
|
162
|
+
typ setType // used for checking.
|
163
|
+
}
|
164
|
+
|
165
|
+
func (ss *stringSet) clone() stringSet {
|
166
|
+
c := *ss
|
167
|
+
c.s = append([]string(nil), c.s...)
|
168
|
+
return c
|
169
|
+
}
|
170
|
+
|
171
|
+
func (ss *stringSet) setType(t setType) {
|
172
|
+
if ss.typ != t && ss.typ != 0 {
|
173
|
+
log.Panicf("type %d cannot be assigned as it was already %d", t, ss.typ)
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
// parse parses a whitespace-separated string and initializes ss with its
|
178
|
+
// components.
|
179
|
+
func (ss *stringSet) parse(s string) {
|
180
|
+
scan := bufio.NewScanner(strings.NewReader(s))
|
181
|
+
scan.Split(bufio.ScanWords)
|
182
|
+
for scan.Scan() {
|
183
|
+
ss.add(scan.Text())
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
func (ss *stringSet) assertChangeable() {
|
188
|
+
if ss.frozen {
|
189
|
+
log.Panic("attempt to modify a frozen stringSet")
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
func (ss *stringSet) add(s string) {
|
194
|
+
ss.assertChangeable()
|
195
|
+
ss.s = append(ss.s, s)
|
196
|
+
ss.sorted = ss.frozen
|
197
|
+
}
|
198
|
+
|
199
|
+
func (ss *stringSet) freeze() {
|
200
|
+
ss.compact()
|
201
|
+
ss.frozen = true
|
202
|
+
}
|
203
|
+
|
204
|
+
func (ss *stringSet) compact() {
|
205
|
+
if ss.sorted {
|
206
|
+
return
|
207
|
+
}
|
208
|
+
a := ss.s
|
209
|
+
sort.Strings(a)
|
210
|
+
k := 0
|
211
|
+
for i := 1; i < len(a); i++ {
|
212
|
+
if a[k] != a[i] {
|
213
|
+
a[k+1] = a[i]
|
214
|
+
k++
|
215
|
+
}
|
216
|
+
}
|
217
|
+
ss.s = a[:k+1]
|
218
|
+
ss.sorted = ss.frozen
|
219
|
+
}
|
220
|
+
|
221
|
+
type funcSorter struct {
|
222
|
+
fn func(a, b string) bool
|
223
|
+
sort.StringSlice
|
224
|
+
}
|
225
|
+
|
226
|
+
func (s funcSorter) Less(i, j int) bool {
|
227
|
+
return s.fn(s.StringSlice[i], s.StringSlice[j])
|
228
|
+
}
|
229
|
+
|
230
|
+
func (ss *stringSet) sortFunc(f func(a, b string) bool) {
|
231
|
+
ss.compact()
|
232
|
+
sort.Sort(funcSorter{f, sort.StringSlice(ss.s)})
|
233
|
+
}
|
234
|
+
|
235
|
+
func (ss *stringSet) remove(s string) {
|
236
|
+
ss.assertChangeable()
|
237
|
+
if i, ok := ss.find(s); ok {
|
238
|
+
copy(ss.s[i:], ss.s[i+1:])
|
239
|
+
ss.s = ss.s[:len(ss.s)-1]
|
240
|
+
}
|
241
|
+
}
|
242
|
+
|
243
|
+
func (ss *stringSet) replace(ol, nu string) {
|
244
|
+
ss.s[ss.index(ol)] = nu
|
245
|
+
ss.sorted = ss.frozen
|
246
|
+
}
|
247
|
+
|
248
|
+
func (ss *stringSet) index(s string) int {
|
249
|
+
ss.setType(Indexed)
|
250
|
+
i, ok := ss.find(s)
|
251
|
+
if !ok {
|
252
|
+
if i < len(ss.s) {
|
253
|
+
log.Panicf("find: item %q is not in list. Closest match is %q.", s, ss.s[i])
|
254
|
+
}
|
255
|
+
log.Panicf("find: item %q is not in list", s)
|
256
|
+
|
257
|
+
}
|
258
|
+
return i
|
259
|
+
}
|
260
|
+
|
261
|
+
func (ss *stringSet) find(s string) (int, bool) {
|
262
|
+
ss.compact()
|
263
|
+
i := sort.SearchStrings(ss.s, s)
|
264
|
+
return i, i != len(ss.s) && ss.s[i] == s
|
265
|
+
}
|
266
|
+
|
267
|
+
func (ss *stringSet) slice() []string {
|
268
|
+
ss.compact()
|
269
|
+
return ss.s
|
270
|
+
}
|
271
|
+
|
272
|
+
func (ss *stringSet) updateLater(v, key string) {
|
273
|
+
if ss.update == nil {
|
274
|
+
ss.update = map[string]string{}
|
275
|
+
}
|
276
|
+
ss.update[v] = key
|
277
|
+
}
|
278
|
+
|
279
|
+
// join joins the string and ensures that all entries are of the same length.
|
280
|
+
func (ss *stringSet) join() string {
|
281
|
+
ss.setType(Indexed)
|
282
|
+
n := len(ss.s[0])
|
283
|
+
for _, s := range ss.s {
|
284
|
+
if len(s) != n {
|
285
|
+
log.Panicf("join: not all entries are of the same length: %q", s)
|
286
|
+
}
|
287
|
+
}
|
288
|
+
ss.s = append(ss.s, strings.Repeat("\xff", n))
|
289
|
+
return strings.Join(ss.s, "")
|
290
|
+
}
|
291
|
+
|
292
|
+
// ianaEntry holds information for an entry in the IANA Language Subtag Repository.
|
293
|
+
// All types use the same entry.
|
294
|
+
// See http://tools.ietf.org/html/bcp47#section-5.1 for a description of the various
|
295
|
+
// fields.
|
296
|
+
type ianaEntry struct {
|
297
|
+
typ string
|
298
|
+
description []string
|
299
|
+
scope string
|
300
|
+
added string
|
301
|
+
preferred string
|
302
|
+
deprecated string
|
303
|
+
suppressScript string
|
304
|
+
macro string
|
305
|
+
prefix []string
|
306
|
+
}
|
307
|
+
|
308
|
+
type builder struct {
|
309
|
+
w *gen.CodeWriter
|
310
|
+
hw io.Writer // MultiWriter for w and w.Hash
|
311
|
+
data *cldr.CLDR
|
312
|
+
supp *cldr.SupplementalData
|
313
|
+
|
314
|
+
// indices
|
315
|
+
locale stringSet // common locales
|
316
|
+
lang stringSet // canonical language ids (2 or 3 letter ISO codes) with data
|
317
|
+
langNoIndex stringSet // 3-letter ISO codes with no associated data
|
318
|
+
script stringSet // 4-letter ISO codes
|
319
|
+
region stringSet // 2-letter ISO or 3-digit UN M49 codes
|
320
|
+
variant stringSet // 4-8-alphanumeric variant code.
|
321
|
+
|
322
|
+
// Region codes that are groups with their corresponding group IDs.
|
323
|
+
groups map[int]index
|
324
|
+
|
325
|
+
// langInfo
|
326
|
+
registry map[string]*ianaEntry
|
327
|
+
}
|
328
|
+
|
329
|
+
type index uint
|
330
|
+
|
331
|
+
func newBuilder(w *gen.CodeWriter) *builder {
|
332
|
+
r := gen.OpenCLDRCoreZip()
|
333
|
+
defer r.Close()
|
334
|
+
d := &cldr.Decoder{}
|
335
|
+
data, err := d.DecodeZip(r)
|
336
|
+
failOnError(err)
|
337
|
+
b := builder{
|
338
|
+
w: w,
|
339
|
+
hw: io.MultiWriter(w, w.Hash),
|
340
|
+
data: data,
|
341
|
+
supp: data.Supplemental(),
|
342
|
+
}
|
343
|
+
b.parseRegistry()
|
344
|
+
return &b
|
345
|
+
}
|
346
|
+
|
347
|
+
func (b *builder) parseRegistry() {
|
348
|
+
r := gen.OpenIANAFile("assignments/language-subtag-registry")
|
349
|
+
defer r.Close()
|
350
|
+
b.registry = make(map[string]*ianaEntry)
|
351
|
+
|
352
|
+
scan := bufio.NewScanner(r)
|
353
|
+
scan.Split(bufio.ScanWords)
|
354
|
+
var record *ianaEntry
|
355
|
+
for more := scan.Scan(); more; {
|
356
|
+
key := scan.Text()
|
357
|
+
more = scan.Scan()
|
358
|
+
value := scan.Text()
|
359
|
+
switch key {
|
360
|
+
case "Type:":
|
361
|
+
record = &ianaEntry{typ: value}
|
362
|
+
case "Subtag:", "Tag:":
|
363
|
+
if s := strings.SplitN(value, "..", 2); len(s) > 1 {
|
364
|
+
for a := s[0]; a <= s[1]; a = inc(a) {
|
365
|
+
b.addToRegistry(a, record)
|
366
|
+
}
|
367
|
+
} else {
|
368
|
+
b.addToRegistry(value, record)
|
369
|
+
}
|
370
|
+
case "Suppress-Script:":
|
371
|
+
record.suppressScript = value
|
372
|
+
case "Added:":
|
373
|
+
record.added = value
|
374
|
+
case "Deprecated:":
|
375
|
+
record.deprecated = value
|
376
|
+
case "Macrolanguage:":
|
377
|
+
record.macro = value
|
378
|
+
case "Preferred-Value:":
|
379
|
+
record.preferred = value
|
380
|
+
case "Prefix:":
|
381
|
+
record.prefix = append(record.prefix, value)
|
382
|
+
case "Scope:":
|
383
|
+
record.scope = value
|
384
|
+
case "Description:":
|
385
|
+
buf := []byte(value)
|
386
|
+
for more = scan.Scan(); more; more = scan.Scan() {
|
387
|
+
b := scan.Bytes()
|
388
|
+
if b[0] == '%' || b[len(b)-1] == ':' {
|
389
|
+
break
|
390
|
+
}
|
391
|
+
buf = append(buf, ' ')
|
392
|
+
buf = append(buf, b...)
|
393
|
+
}
|
394
|
+
record.description = append(record.description, string(buf))
|
395
|
+
continue
|
396
|
+
default:
|
397
|
+
continue
|
398
|
+
}
|
399
|
+
more = scan.Scan()
|
400
|
+
}
|
401
|
+
if scan.Err() != nil {
|
402
|
+
log.Panic(scan.Err())
|
403
|
+
}
|
404
|
+
}
|
405
|
+
|
406
|
+
func (b *builder) addToRegistry(key string, entry *ianaEntry) {
|
407
|
+
if info, ok := b.registry[key]; ok {
|
408
|
+
if info.typ != "language" || entry.typ != "extlang" {
|
409
|
+
log.Fatalf("parseRegistry: tag %q already exists", key)
|
410
|
+
}
|
411
|
+
} else {
|
412
|
+
b.registry[key] = entry
|
413
|
+
}
|
414
|
+
}
|
415
|
+
|
416
|
+
var commentIndex = make(map[string]string)
|
417
|
+
|
418
|
+
func init() {
|
419
|
+
for _, s := range comment {
|
420
|
+
key := strings.TrimSpace(strings.SplitN(s, " ", 2)[0])
|
421
|
+
commentIndex[key] = s
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
func (b *builder) comment(name string) {
|
426
|
+
if s := commentIndex[name]; len(s) > 0 {
|
427
|
+
b.w.WriteComment(s)
|
428
|
+
} else {
|
429
|
+
fmt.Fprintln(b.w)
|
430
|
+
}
|
431
|
+
}
|
432
|
+
|
433
|
+
func (b *builder) pf(f string, x ...interface{}) {
|
434
|
+
fmt.Fprintf(b.hw, f, x...)
|
435
|
+
fmt.Fprint(b.hw, "\n")
|
436
|
+
}
|
437
|
+
|
438
|
+
func (b *builder) p(x ...interface{}) {
|
439
|
+
fmt.Fprintln(b.hw, x...)
|
440
|
+
}
|
441
|
+
|
442
|
+
func (b *builder) addSize(s int) {
|
443
|
+
b.w.Size += s
|
444
|
+
b.pf("// Size: %d bytes", s)
|
445
|
+
}
|
446
|
+
|
447
|
+
func (b *builder) writeConst(name string, x interface{}) {
|
448
|
+
b.comment(name)
|
449
|
+
b.w.WriteConst(name, x)
|
450
|
+
}
|
451
|
+
|
452
|
+
// writeConsts computes f(v) for all v in values and writes the results
|
453
|
+
// as constants named _v to a single constant block.
|
454
|
+
func (b *builder) writeConsts(f func(string) int, values ...string) {
|
455
|
+
b.pf("const (")
|
456
|
+
for _, v := range values {
|
457
|
+
b.pf("\t_%s = %v", v, f(v))
|
458
|
+
}
|
459
|
+
b.pf(")")
|
460
|
+
}
|
461
|
+
|
462
|
+
// writeType writes the type of the given value, which must be a struct.
|
463
|
+
func (b *builder) writeType(value interface{}) {
|
464
|
+
b.comment(reflect.TypeOf(value).Name())
|
465
|
+
b.w.WriteType(value)
|
466
|
+
}
|
467
|
+
|
468
|
+
func (b *builder) writeSlice(name string, ss interface{}) {
|
469
|
+
b.writeSliceAddSize(name, 0, ss)
|
470
|
+
}
|
471
|
+
|
472
|
+
func (b *builder) writeSliceAddSize(name string, extraSize int, ss interface{}) {
|
473
|
+
b.comment(name)
|
474
|
+
b.w.Size += extraSize
|
475
|
+
v := reflect.ValueOf(ss)
|
476
|
+
t := v.Type().Elem()
|
477
|
+
b.pf("// Size: %d bytes, %d elements", v.Len()*int(t.Size())+extraSize, v.Len())
|
478
|
+
|
479
|
+
fmt.Fprintf(b.w, "var %s = ", name)
|
480
|
+
b.w.WriteArray(ss)
|
481
|
+
b.p()
|
482
|
+
}
|
483
|
+
|
484
|
+
type fromTo struct {
|
485
|
+
from, to uint16
|
486
|
+
}
|
487
|
+
|
488
|
+
func (b *builder) writeSortedMap(name string, ss *stringSet, index func(s string) uint16) {
|
489
|
+
ss.sortFunc(func(a, b string) bool {
|
490
|
+
return index(a) < index(b)
|
491
|
+
})
|
492
|
+
m := []fromTo{}
|
493
|
+
for _, s := range ss.s {
|
494
|
+
m = append(m, fromTo{index(s), index(ss.update[s])})
|
495
|
+
}
|
496
|
+
b.writeSlice(name, m)
|
497
|
+
}
|
498
|
+
|
499
|
+
const base = 'z' - 'a' + 1
|
500
|
+
|
501
|
+
func strToInt(s string) uint {
|
502
|
+
v := uint(0)
|
503
|
+
for i := 0; i < len(s); i++ {
|
504
|
+
v *= base
|
505
|
+
v += uint(s[i] - 'a')
|
506
|
+
}
|
507
|
+
return v
|
508
|
+
}
|
509
|
+
|
510
|
+
// converts the given integer to the original ASCII string passed to strToInt.
|
511
|
+
// len(s) must match the number of characters obtained.
|
512
|
+
func intToStr(v uint, s []byte) {
|
513
|
+
for i := len(s) - 1; i >= 0; i-- {
|
514
|
+
s[i] = byte(v%base) + 'a'
|
515
|
+
v /= base
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
func (b *builder) writeBitVector(name string, ss []string) {
|
520
|
+
vec := make([]uint8, int(math.Ceil(math.Pow(base, float64(len(ss[0])))/8)))
|
521
|
+
for _, s := range ss {
|
522
|
+
v := strToInt(s)
|
523
|
+
vec[v/8] |= 1 << (v % 8)
|
524
|
+
}
|
525
|
+
b.writeSlice(name, vec)
|
526
|
+
}
|
527
|
+
|
528
|
+
// TODO: convert this type into a list or two-stage trie.
|
529
|
+
func (b *builder) writeMapFunc(name string, m map[string]string, f func(string) uint16) {
|
530
|
+
b.comment(name)
|
531
|
+
v := reflect.ValueOf(m)
|
532
|
+
sz := v.Len() * (2 + int(v.Type().Key().Size()))
|
533
|
+
for _, k := range m {
|
534
|
+
sz += len(k)
|
535
|
+
}
|
536
|
+
b.addSize(sz)
|
537
|
+
keys := []string{}
|
538
|
+
b.pf(`var %s = map[string]uint16{`, name)
|
539
|
+
for k := range m {
|
540
|
+
keys = append(keys, k)
|
541
|
+
}
|
542
|
+
sort.Strings(keys)
|
543
|
+
for _, k := range keys {
|
544
|
+
b.pf("\t%q: %v,", k, f(m[k]))
|
545
|
+
}
|
546
|
+
b.p("}")
|
547
|
+
}
|
548
|
+
|
549
|
+
func (b *builder) writeMap(name string, m interface{}) {
|
550
|
+
b.comment(name)
|
551
|
+
v := reflect.ValueOf(m)
|
552
|
+
sz := v.Len() * (2 + int(v.Type().Key().Size()) + int(v.Type().Elem().Size()))
|
553
|
+
b.addSize(sz)
|
554
|
+
f := strings.FieldsFunc(fmt.Sprintf("%#v", m), func(r rune) bool {
|
555
|
+
return strings.IndexRune("{}, ", r) != -1
|
556
|
+
})
|
557
|
+
sort.Strings(f[1:])
|
558
|
+
b.pf(`var %s = %s{`, name, f[0])
|
559
|
+
for _, kv := range f[1:] {
|
560
|
+
b.pf("\t%s,", kv)
|
561
|
+
}
|
562
|
+
b.p("}")
|
563
|
+
}
|
564
|
+
|
565
|
+
func (b *builder) langIndex(s string) uint16 {
|
566
|
+
if s == "und" {
|
567
|
+
return 0
|
568
|
+
}
|
569
|
+
if i, ok := b.lang.find(s); ok {
|
570
|
+
return uint16(i)
|
571
|
+
}
|
572
|
+
return uint16(strToInt(s)) + uint16(len(b.lang.s))
|
573
|
+
}
|
574
|
+
|
575
|
+
// inc advances the string to its lexicographical successor.
|
576
|
+
func inc(s string) string {
|
577
|
+
const maxTagLength = 4
|
578
|
+
var buf [maxTagLength]byte
|
579
|
+
intToStr(strToInt(strings.ToLower(s))+1, buf[:len(s)])
|
580
|
+
for i := 0; i < len(s); i++ {
|
581
|
+
if s[i] <= 'Z' {
|
582
|
+
buf[i] -= 'a' - 'A'
|
583
|
+
}
|
584
|
+
}
|
585
|
+
return string(buf[:len(s)])
|
586
|
+
}
|
587
|
+
|
588
|
+
func (b *builder) parseIndices() {
|
589
|
+
meta := b.supp.Metadata
|
590
|
+
|
591
|
+
for k, v := range b.registry {
|
592
|
+
var ss *stringSet
|
593
|
+
switch v.typ {
|
594
|
+
case "language":
|
595
|
+
if len(k) == 2 || v.suppressScript != "" || v.scope == "special" {
|
596
|
+
b.lang.add(k)
|
597
|
+
continue
|
598
|
+
} else {
|
599
|
+
ss = &b.langNoIndex
|
600
|
+
}
|
601
|
+
case "region":
|
602
|
+
ss = &b.region
|
603
|
+
case "script":
|
604
|
+
ss = &b.script
|
605
|
+
case "variant":
|
606
|
+
ss = &b.variant
|
607
|
+
default:
|
608
|
+
continue
|
609
|
+
}
|
610
|
+
ss.add(k)
|
611
|
+
}
|
612
|
+
// Include any language for which there is data.
|
613
|
+
for _, lang := range b.data.Locales() {
|
614
|
+
if x := b.data.RawLDML(lang); false ||
|
615
|
+
x.LocaleDisplayNames != nil ||
|
616
|
+
x.Characters != nil ||
|
617
|
+
x.Delimiters != nil ||
|
618
|
+
x.Measurement != nil ||
|
619
|
+
x.Dates != nil ||
|
620
|
+
x.Numbers != nil ||
|
621
|
+
x.Units != nil ||
|
622
|
+
x.ListPatterns != nil ||
|
623
|
+
x.Collations != nil ||
|
624
|
+
x.Segmentations != nil ||
|
625
|
+
x.Rbnf != nil ||
|
626
|
+
x.Annotations != nil ||
|
627
|
+
x.Metadata != nil {
|
628
|
+
|
629
|
+
from := strings.Split(lang, "_")
|
630
|
+
if lang := from[0]; lang != "root" {
|
631
|
+
b.lang.add(lang)
|
632
|
+
}
|
633
|
+
}
|
634
|
+
}
|
635
|
+
// Include locales for plural rules, which uses a different structure.
|
636
|
+
for _, plurals := range b.data.Supplemental().Plurals {
|
637
|
+
for _, rules := range plurals.PluralRules {
|
638
|
+
for _, lang := range strings.Split(rules.Locales, " ") {
|
639
|
+
if lang = strings.Split(lang, "_")[0]; lang != "root" {
|
640
|
+
b.lang.add(lang)
|
641
|
+
}
|
642
|
+
}
|
643
|
+
}
|
644
|
+
}
|
645
|
+
// Include languages in likely subtags.
|
646
|
+
for _, m := range b.supp.LikelySubtags.LikelySubtag {
|
647
|
+
from := strings.Split(m.From, "_")
|
648
|
+
b.lang.add(from[0])
|
649
|
+
}
|
650
|
+
// Include ISO-639 alpha-3 bibliographic entries.
|
651
|
+
for _, a := range meta.Alias.LanguageAlias {
|
652
|
+
if a.Reason == "bibliographic" {
|
653
|
+
b.langNoIndex.add(a.Type)
|
654
|
+
}
|
655
|
+
}
|
656
|
+
// Include regions in territoryAlias (not all are in the IANA registry!)
|
657
|
+
for _, reg := range b.supp.Metadata.Alias.TerritoryAlias {
|
658
|
+
if len(reg.Type) == 2 {
|
659
|
+
b.region.add(reg.Type)
|
660
|
+
}
|
661
|
+
}
|
662
|
+
|
663
|
+
for _, s := range b.lang.s {
|
664
|
+
if len(s) == 3 {
|
665
|
+
b.langNoIndex.remove(s)
|
666
|
+
}
|
667
|
+
}
|
668
|
+
b.writeConst("numLanguages", len(b.lang.slice())+len(b.langNoIndex.slice()))
|
669
|
+
b.writeConst("numScripts", len(b.script.slice()))
|
670
|
+
b.writeConst("numRegions", len(b.region.slice()))
|
671
|
+
|
672
|
+
// Add dummy codes at the start of each list to represent "unspecified".
|
673
|
+
b.lang.add("---")
|
674
|
+
b.script.add("----")
|
675
|
+
b.region.add("---")
|
676
|
+
|
677
|
+
// common locales
|
678
|
+
b.locale.parse(meta.DefaultContent.Locales)
|
679
|
+
}
|
680
|
+
|
681
|
+
// TODO: region inclusion data will probably not be use used in future matchers.
|
682
|
+
|
683
|
+
func (b *builder) computeRegionGroups() {
|
684
|
+
b.groups = make(map[int]index)
|
685
|
+
|
686
|
+
// Create group indices.
|
687
|
+
for i := 1; b.region.s[i][0] < 'A'; i++ { // Base M49 indices on regionID.
|
688
|
+
b.groups[i] = index(len(b.groups))
|
689
|
+
}
|
690
|
+
for _, g := range b.supp.TerritoryContainment.Group {
|
691
|
+
// Skip UN and EURO zone as they are flattening the containment
|
692
|
+
// relationship.
|
693
|
+
if g.Type == "EZ" || g.Type == "UN" {
|
694
|
+
continue
|
695
|
+
}
|
696
|
+
group := b.region.index(g.Type)
|
697
|
+
if _, ok := b.groups[group]; !ok {
|
698
|
+
b.groups[group] = index(len(b.groups))
|
699
|
+
}
|
700
|
+
}
|
701
|
+
if len(b.groups) > 64 {
|
702
|
+
log.Fatalf("only 64 groups supported, found %d", len(b.groups))
|
703
|
+
}
|
704
|
+
b.writeConst("nRegionGroups", len(b.groups))
|
705
|
+
}
|
706
|
+
|
707
|
+
var langConsts = []string{
|
708
|
+
"af", "am", "ar", "az", "bg", "bn", "ca", "cs", "da", "de", "el", "en", "es",
|
709
|
+
"et", "fa", "fi", "fil", "fr", "gu", "he", "hi", "hr", "hu", "hy", "id", "is",
|
710
|
+
"it", "ja", "ka", "kk", "km", "kn", "ko", "ky", "lo", "lt", "lv", "mk", "ml",
|
711
|
+
"mn", "mo", "mr", "ms", "mul", "my", "nb", "ne", "nl", "no", "pa", "pl", "pt",
|
712
|
+
"ro", "ru", "sh", "si", "sk", "sl", "sq", "sr", "sv", "sw", "ta", "te", "th",
|
713
|
+
"tl", "tn", "tr", "uk", "ur", "uz", "vi", "zh", "zu",
|
714
|
+
|
715
|
+
// constants for grandfathered tags (if not already defined)
|
716
|
+
"jbo", "ami", "bnn", "hak", "tlh", "lb", "nv", "pwn", "tao", "tay", "tsu",
|
717
|
+
"nn", "sfb", "vgt", "sgg", "cmn", "nan", "hsn",
|
718
|
+
}
|
719
|
+
|
720
|
+
// writeLanguage generates all tables needed for language canonicalization.
|
721
|
+
func (b *builder) writeLanguage() {
|
722
|
+
meta := b.supp.Metadata
|
723
|
+
|
724
|
+
b.writeConst("nonCanonicalUnd", b.lang.index("und"))
|
725
|
+
b.writeConsts(func(s string) int { return int(b.langIndex(s)) }, langConsts...)
|
726
|
+
b.writeConst("langPrivateStart", b.langIndex("qaa"))
|
727
|
+
b.writeConst("langPrivateEnd", b.langIndex("qtz"))
|
728
|
+
|
729
|
+
// Get language codes that need to be mapped (overlong 3-letter codes,
|
730
|
+
// deprecated 2-letter codes, legacy and grandfathered tags.)
|
731
|
+
langAliasMap := stringSet{}
|
732
|
+
aliasTypeMap := map[string]langAliasType{}
|
733
|
+
|
734
|
+
// altLangISO3 get the alternative ISO3 names that need to be mapped.
|
735
|
+
altLangISO3 := stringSet{}
|
736
|
+
// Add dummy start to avoid the use of index 0.
|
737
|
+
altLangISO3.add("---")
|
738
|
+
altLangISO3.updateLater("---", "aa")
|
739
|
+
|
740
|
+
lang := b.lang.clone()
|
741
|
+
for _, a := range meta.Alias.LanguageAlias {
|
742
|
+
if a.Replacement == "" {
|
743
|
+
a.Replacement = "und"
|
744
|
+
}
|
745
|
+
// TODO: support mapping to tags
|
746
|
+
repl := strings.SplitN(a.Replacement, "_", 2)[0]
|
747
|
+
if a.Reason == "overlong" {
|
748
|
+
if len(a.Replacement) == 2 && len(a.Type) == 3 {
|
749
|
+
lang.updateLater(a.Replacement, a.Type)
|
750
|
+
}
|
751
|
+
} else if len(a.Type) <= 3 {
|
752
|
+
switch a.Reason {
|
753
|
+
case "macrolanguage":
|
754
|
+
aliasTypeMap[a.Type] = langMacro
|
755
|
+
case "deprecated":
|
756
|
+
// handled elsewhere
|
757
|
+
continue
|
758
|
+
case "bibliographic", "legacy":
|
759
|
+
if a.Type == "no" {
|
760
|
+
continue
|
761
|
+
}
|
762
|
+
aliasTypeMap[a.Type] = langLegacy
|
763
|
+
default:
|
764
|
+
log.Fatalf("new %s alias: %s", a.Reason, a.Type)
|
765
|
+
}
|
766
|
+
langAliasMap.add(a.Type)
|
767
|
+
langAliasMap.updateLater(a.Type, repl)
|
768
|
+
}
|
769
|
+
}
|
770
|
+
// Manually add the mapping of "nb" (Norwegian) to its macro language.
|
771
|
+
// This can be removed if CLDR adopts this change.
|
772
|
+
langAliasMap.add("nb")
|
773
|
+
langAliasMap.updateLater("nb", "no")
|
774
|
+
aliasTypeMap["nb"] = langMacro
|
775
|
+
|
776
|
+
for k, v := range b.registry {
|
777
|
+
// Also add deprecated values for 3-letter ISO codes, which CLDR omits.
|
778
|
+
if v.typ == "language" && v.deprecated != "" && v.preferred != "" {
|
779
|
+
langAliasMap.add(k)
|
780
|
+
langAliasMap.updateLater(k, v.preferred)
|
781
|
+
aliasTypeMap[k] = langDeprecated
|
782
|
+
}
|
783
|
+
}
|
784
|
+
// Fix CLDR mappings.
|
785
|
+
lang.updateLater("tl", "tgl")
|
786
|
+
lang.updateLater("sh", "hbs")
|
787
|
+
lang.updateLater("mo", "mol")
|
788
|
+
lang.updateLater("no", "nor")
|
789
|
+
lang.updateLater("tw", "twi")
|
790
|
+
lang.updateLater("nb", "nob")
|
791
|
+
lang.updateLater("ak", "aka")
|
792
|
+
lang.updateLater("bh", "bih")
|
793
|
+
|
794
|
+
// Ensure that each 2-letter code is matched with a 3-letter code.
|
795
|
+
for _, v := range lang.s[1:] {
|
796
|
+
s, ok := lang.update[v]
|
797
|
+
if !ok {
|
798
|
+
if s, ok = lang.update[langAliasMap.update[v]]; !ok {
|
799
|
+
continue
|
800
|
+
}
|
801
|
+
lang.update[v] = s
|
802
|
+
}
|
803
|
+
if v[0] != s[0] {
|
804
|
+
altLangISO3.add(s)
|
805
|
+
altLangISO3.updateLater(s, v)
|
806
|
+
}
|
807
|
+
}
|
808
|
+
|
809
|
+
// Complete canonicalized language tags.
|
810
|
+
lang.freeze()
|
811
|
+
for i, v := range lang.s {
|
812
|
+
// We can avoid these manual entries by using the IANA registry directly.
|
813
|
+
// Seems easier to update the list manually, as changes are rare.
|
814
|
+
// The panic in this loop will trigger if we miss an entry.
|
815
|
+
add := ""
|
816
|
+
if s, ok := lang.update[v]; ok {
|
817
|
+
if s[0] == v[0] {
|
818
|
+
add = s[1:]
|
819
|
+
} else {
|
820
|
+
add = string([]byte{0, byte(altLangISO3.index(s))})
|
821
|
+
}
|
822
|
+
} else if len(v) == 3 {
|
823
|
+
add = "\x00"
|
824
|
+
} else {
|
825
|
+
log.Panicf("no data for long form of %q", v)
|
826
|
+
}
|
827
|
+
lang.s[i] += add
|
828
|
+
}
|
829
|
+
b.writeConst("lang", tag.Index(lang.join()))
|
830
|
+
|
831
|
+
b.writeConst("langNoIndexOffset", len(b.lang.s))
|
832
|
+
|
833
|
+
// space of all valid 3-letter language identifiers.
|
834
|
+
b.writeBitVector("langNoIndex", b.langNoIndex.slice())
|
835
|
+
|
836
|
+
altLangIndex := []uint16{}
|
837
|
+
for i, s := range altLangISO3.slice() {
|
838
|
+
altLangISO3.s[i] += string([]byte{byte(len(altLangIndex))})
|
839
|
+
if i > 0 {
|
840
|
+
idx := b.lang.index(altLangISO3.update[s])
|
841
|
+
altLangIndex = append(altLangIndex, uint16(idx))
|
842
|
+
}
|
843
|
+
}
|
844
|
+
b.writeConst("altLangISO3", tag.Index(altLangISO3.join()))
|
845
|
+
b.writeSlice("altLangIndex", altLangIndex)
|
846
|
+
|
847
|
+
b.writeSortedMap("langAliasMap", &langAliasMap, b.langIndex)
|
848
|
+
types := make([]langAliasType, len(langAliasMap.s))
|
849
|
+
for i, s := range langAliasMap.s {
|
850
|
+
types[i] = aliasTypeMap[s]
|
851
|
+
}
|
852
|
+
b.writeSlice("langAliasTypes", types)
|
853
|
+
}
|
854
|
+
|
855
|
+
var scriptConsts = []string{
|
856
|
+
"Latn", "Hani", "Hans", "Hant", "Qaaa", "Qaai", "Qabx", "Zinh", "Zyyy",
|
857
|
+
"Zzzz",
|
858
|
+
}
|
859
|
+
|
860
|
+
func (b *builder) writeScript() {
|
861
|
+
b.writeConsts(b.script.index, scriptConsts...)
|
862
|
+
b.writeConst("script", tag.Index(b.script.join()))
|
863
|
+
|
864
|
+
supp := make([]uint8, len(b.lang.slice()))
|
865
|
+
for i, v := range b.lang.slice()[1:] {
|
866
|
+
if sc := b.registry[v].suppressScript; sc != "" {
|
867
|
+
supp[i+1] = uint8(b.script.index(sc))
|
868
|
+
}
|
869
|
+
}
|
870
|
+
b.writeSlice("suppressScript", supp)
|
871
|
+
|
872
|
+
// There is only one deprecated script in CLDR. This value is hard-coded.
|
873
|
+
// We check here if the code must be updated.
|
874
|
+
for _, a := range b.supp.Metadata.Alias.ScriptAlias {
|
875
|
+
if a.Type != "Qaai" {
|
876
|
+
log.Panicf("unexpected deprecated stript %q", a.Type)
|
877
|
+
}
|
878
|
+
}
|
879
|
+
}
|
880
|
+
|
881
|
+
func parseM49(s string) int16 {
|
882
|
+
if len(s) == 0 {
|
883
|
+
return 0
|
884
|
+
}
|
885
|
+
v, err := strconv.ParseUint(s, 10, 10)
|
886
|
+
failOnError(err)
|
887
|
+
return int16(v)
|
888
|
+
}
|
889
|
+
|
890
|
+
var regionConsts = []string{
|
891
|
+
"001", "419", "BR", "CA", "ES", "GB", "MD", "PT", "UK", "US",
|
892
|
+
"ZZ", "XA", "XC", "XK", // Unofficial tag for Kosovo.
|
893
|
+
}
|
894
|
+
|
895
|
+
func (b *builder) writeRegion() {
|
896
|
+
b.writeConsts(b.region.index, regionConsts...)
|
897
|
+
|
898
|
+
isoOffset := b.region.index("AA")
|
899
|
+
m49map := make([]int16, len(b.region.slice()))
|
900
|
+
fromM49map := make(map[int16]int)
|
901
|
+
altRegionISO3 := ""
|
902
|
+
altRegionIDs := []uint16{}
|
903
|
+
|
904
|
+
b.writeConst("isoRegionOffset", isoOffset)
|
905
|
+
|
906
|
+
// 2-letter region lookup and mapping to numeric codes.
|
907
|
+
regionISO := b.region.clone()
|
908
|
+
regionISO.s = regionISO.s[isoOffset:]
|
909
|
+
regionISO.sorted = false
|
910
|
+
|
911
|
+
regionTypes := make([]byte, len(b.region.s))
|
912
|
+
|
913
|
+
// Is the region valid BCP 47?
|
914
|
+
for s, e := range b.registry {
|
915
|
+
if len(s) == 2 && s == strings.ToUpper(s) {
|
916
|
+
i := b.region.index(s)
|
917
|
+
for _, d := range e.description {
|
918
|
+
if strings.Contains(d, "Private use") {
|
919
|
+
regionTypes[i] = iso3166UserAssigned
|
920
|
+
}
|
921
|
+
}
|
922
|
+
regionTypes[i] |= bcp47Region
|
923
|
+
}
|
924
|
+
}
|
925
|
+
|
926
|
+
// Is the region a valid ccTLD?
|
927
|
+
r := gen.OpenIANAFile("domains/root/db")
|
928
|
+
defer r.Close()
|
929
|
+
|
930
|
+
buf, err := ioutil.ReadAll(r)
|
931
|
+
failOnError(err)
|
932
|
+
re := regexp.MustCompile(`"/domains/root/db/([a-z]{2}).html"`)
|
933
|
+
for _, m := range re.FindAllSubmatch(buf, -1) {
|
934
|
+
i := b.region.index(strings.ToUpper(string(m[1])))
|
935
|
+
regionTypes[i] |= ccTLD
|
936
|
+
}
|
937
|
+
|
938
|
+
b.writeSlice("regionTypes", regionTypes)
|
939
|
+
|
940
|
+
iso3Set := make(map[string]int)
|
941
|
+
update := func(iso2, iso3 string) {
|
942
|
+
i := regionISO.index(iso2)
|
943
|
+
if j, ok := iso3Set[iso3]; !ok && iso3[0] == iso2[0] {
|
944
|
+
regionISO.s[i] += iso3[1:]
|
945
|
+
iso3Set[iso3] = -1
|
946
|
+
} else {
|
947
|
+
if ok && j >= 0 {
|
948
|
+
regionISO.s[i] += string([]byte{0, byte(j)})
|
949
|
+
} else {
|
950
|
+
iso3Set[iso3] = len(altRegionISO3)
|
951
|
+
regionISO.s[i] += string([]byte{0, byte(len(altRegionISO3))})
|
952
|
+
altRegionISO3 += iso3
|
953
|
+
altRegionIDs = append(altRegionIDs, uint16(isoOffset+i))
|
954
|
+
}
|
955
|
+
}
|
956
|
+
}
|
957
|
+
for _, tc := range b.supp.CodeMappings.TerritoryCodes {
|
958
|
+
i := regionISO.index(tc.Type) + isoOffset
|
959
|
+
if d := m49map[i]; d != 0 {
|
960
|
+
log.Panicf("%s found as a duplicate UN.M49 code of %03d", tc.Numeric, d)
|
961
|
+
}
|
962
|
+
m49 := parseM49(tc.Numeric)
|
963
|
+
m49map[i] = m49
|
964
|
+
if r := fromM49map[m49]; r == 0 {
|
965
|
+
fromM49map[m49] = i
|
966
|
+
} else if r != i {
|
967
|
+
dep := b.registry[regionISO.s[r-isoOffset]].deprecated
|
968
|
+
if t := b.registry[tc.Type]; t != nil && dep != "" && (t.deprecated == "" || t.deprecated > dep) {
|
969
|
+
fromM49map[m49] = i
|
970
|
+
}
|
971
|
+
}
|
972
|
+
}
|
973
|
+
for _, ta := range b.supp.Metadata.Alias.TerritoryAlias {
|
974
|
+
if len(ta.Type) == 3 && ta.Type[0] <= '9' && len(ta.Replacement) == 2 {
|
975
|
+
from := parseM49(ta.Type)
|
976
|
+
if r := fromM49map[from]; r == 0 {
|
977
|
+
fromM49map[from] = regionISO.index(ta.Replacement) + isoOffset
|
978
|
+
}
|
979
|
+
}
|
980
|
+
}
|
981
|
+
for _, tc := range b.supp.CodeMappings.TerritoryCodes {
|
982
|
+
if len(tc.Alpha3) == 3 {
|
983
|
+
update(tc.Type, tc.Alpha3)
|
984
|
+
}
|
985
|
+
}
|
986
|
+
// This entries are not included in territoryCodes. Mostly 3-letter variants
|
987
|
+
// of deleted codes and an entry for QU.
|
988
|
+
for _, m := range []struct{ iso2, iso3 string }{
|
989
|
+
{"CT", "CTE"},
|
990
|
+
{"DY", "DHY"},
|
991
|
+
{"HV", "HVO"},
|
992
|
+
{"JT", "JTN"},
|
993
|
+
{"MI", "MID"},
|
994
|
+
{"NH", "NHB"},
|
995
|
+
{"NQ", "ATN"},
|
996
|
+
{"PC", "PCI"},
|
997
|
+
{"PU", "PUS"},
|
998
|
+
{"PZ", "PCZ"},
|
999
|
+
{"RH", "RHO"},
|
1000
|
+
{"VD", "VDR"},
|
1001
|
+
{"WK", "WAK"},
|
1002
|
+
// These three-letter codes are used for others as well.
|
1003
|
+
{"FQ", "ATF"},
|
1004
|
+
} {
|
1005
|
+
update(m.iso2, m.iso3)
|
1006
|
+
}
|
1007
|
+
for i, s := range regionISO.s {
|
1008
|
+
if len(s) != 4 {
|
1009
|
+
regionISO.s[i] = s + " "
|
1010
|
+
}
|
1011
|
+
}
|
1012
|
+
b.writeConst("regionISO", tag.Index(regionISO.join()))
|
1013
|
+
b.writeConst("altRegionISO3", altRegionISO3)
|
1014
|
+
b.writeSlice("altRegionIDs", altRegionIDs)
|
1015
|
+
|
1016
|
+
// Create list of deprecated regions.
|
1017
|
+
// TODO: consider inserting SF -> FI. Not included by CLDR, but is the only
|
1018
|
+
// Transitionally-reserved mapping not included.
|
1019
|
+
regionOldMap := stringSet{}
|
1020
|
+
// Include regions in territoryAlias (not all are in the IANA registry!)
|
1021
|
+
for _, reg := range b.supp.Metadata.Alias.TerritoryAlias {
|
1022
|
+
if len(reg.Type) == 2 && reg.Reason == "deprecated" && len(reg.Replacement) == 2 {
|
1023
|
+
regionOldMap.add(reg.Type)
|
1024
|
+
regionOldMap.updateLater(reg.Type, reg.Replacement)
|
1025
|
+
i, _ := regionISO.find(reg.Type)
|
1026
|
+
j, _ := regionISO.find(reg.Replacement)
|
1027
|
+
if k := m49map[i+isoOffset]; k == 0 {
|
1028
|
+
m49map[i+isoOffset] = m49map[j+isoOffset]
|
1029
|
+
}
|
1030
|
+
}
|
1031
|
+
}
|
1032
|
+
b.writeSortedMap("regionOldMap", ®ionOldMap, func(s string) uint16 {
|
1033
|
+
return uint16(b.region.index(s))
|
1034
|
+
})
|
1035
|
+
// 3-digit region lookup, groupings.
|
1036
|
+
for i := 1; i < isoOffset; i++ {
|
1037
|
+
m := parseM49(b.region.s[i])
|
1038
|
+
m49map[i] = m
|
1039
|
+
fromM49map[m] = i
|
1040
|
+
}
|
1041
|
+
b.writeSlice("m49", m49map)
|
1042
|
+
|
1043
|
+
const (
|
1044
|
+
searchBits = 7
|
1045
|
+
regionBits = 9
|
1046
|
+
)
|
1047
|
+
if len(m49map) >= 1<<regionBits {
|
1048
|
+
log.Fatalf("Maximum number of regions exceeded: %d > %d", len(m49map), 1<<regionBits)
|
1049
|
+
}
|
1050
|
+
m49Index := [9]int16{}
|
1051
|
+
fromM49 := []uint16{}
|
1052
|
+
m49 := []int{}
|
1053
|
+
for k, _ := range fromM49map {
|
1054
|
+
m49 = append(m49, int(k))
|
1055
|
+
}
|
1056
|
+
sort.Ints(m49)
|
1057
|
+
for _, k := range m49[1:] {
|
1058
|
+
val := (k & (1<<searchBits - 1)) << regionBits
|
1059
|
+
fromM49 = append(fromM49, uint16(val|fromM49map[int16(k)]))
|
1060
|
+
m49Index[1:][k>>searchBits] = int16(len(fromM49))
|
1061
|
+
}
|
1062
|
+
b.writeSlice("m49Index", m49Index)
|
1063
|
+
b.writeSlice("fromM49", fromM49)
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
const (
|
1067
|
+
// TODO: put these lists in regionTypes as user data? Could be used for
|
1068
|
+
// various optimizations and refinements and could be exposed in the API.
|
1069
|
+
iso3166Except = "AC CP DG EA EU FX IC SU TA UK"
|
1070
|
+
iso3166Trans = "AN BU CS NT TP YU ZR" // SF is not in our set of Regions.
|
1071
|
+
// DY and RH are actually not deleted, but indeterminately reserved.
|
1072
|
+
iso3166DelCLDR = "CT DD DY FQ HV JT MI NH NQ PC PU PZ RH VD WK YD"
|
1073
|
+
)
|
1074
|
+
|
1075
|
+
const (
|
1076
|
+
iso3166UserAssigned = 1 << iota
|
1077
|
+
ccTLD
|
1078
|
+
bcp47Region
|
1079
|
+
)
|
1080
|
+
|
1081
|
+
func find(list []string, s string) int {
|
1082
|
+
for i, t := range list {
|
1083
|
+
if t == s {
|
1084
|
+
return i
|
1085
|
+
}
|
1086
|
+
}
|
1087
|
+
return -1
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
// writeVariants generates per-variant information and creates a map from variant
|
1091
|
+
// name to index value. We assign index values such that sorting multiple
|
1092
|
+
// variants by index value will result in the correct order.
|
1093
|
+
// There are two types of variants: specialized and general. Specialized variants
|
1094
|
+
// are only applicable to certain language or language-script pairs. Generalized
|
1095
|
+
// variants apply to any language. Generalized variants always sort after
|
1096
|
+
// specialized variants. We will therefore always assign a higher index value
|
1097
|
+
// to a generalized variant than any other variant. Generalized variants are
|
1098
|
+
// sorted alphabetically among themselves.
|
1099
|
+
// Specialized variants may also sort after other specialized variants. Such
|
1100
|
+
// variants will be ordered after any of the variants they may follow.
|
1101
|
+
// We assume that if a variant x is followed by a variant y, then for any prefix
|
1102
|
+
// p of x, p-x is a prefix of y. This allows us to order tags based on the
|
1103
|
+
// maximum of the length of any of its prefixes.
|
1104
|
+
// TODO: it is possible to define a set of Prefix values on variants such that
|
1105
|
+
// a total order cannot be defined to the point that this algorithm breaks.
|
1106
|
+
// In other words, we cannot guarantee the same order of variants for the
|
1107
|
+
// future using the same algorithm or for non-compliant combinations of
|
1108
|
+
// variants. For this reason, consider using simple alphabetic sorting
|
1109
|
+
// of variants and ignore Prefix restrictions altogether.
|
1110
|
+
func (b *builder) writeVariant() {
|
1111
|
+
generalized := stringSet{}
|
1112
|
+
specialized := stringSet{}
|
1113
|
+
specializedExtend := stringSet{}
|
1114
|
+
// Collate the variants by type and check assumptions.
|
1115
|
+
for _, v := range b.variant.slice() {
|
1116
|
+
e := b.registry[v]
|
1117
|
+
if len(e.prefix) == 0 {
|
1118
|
+
generalized.add(v)
|
1119
|
+
continue
|
1120
|
+
}
|
1121
|
+
c := strings.Split(e.prefix[0], "-")
|
1122
|
+
hasScriptOrRegion := false
|
1123
|
+
if len(c) > 1 {
|
1124
|
+
_, hasScriptOrRegion = b.script.find(c[1])
|
1125
|
+
if !hasScriptOrRegion {
|
1126
|
+
_, hasScriptOrRegion = b.region.find(c[1])
|
1127
|
+
|
1128
|
+
}
|
1129
|
+
}
|
1130
|
+
if len(c) == 1 || len(c) == 2 && hasScriptOrRegion {
|
1131
|
+
// Variant is preceded by a language.
|
1132
|
+
specialized.add(v)
|
1133
|
+
continue
|
1134
|
+
}
|
1135
|
+
// Variant is preceded by another variant.
|
1136
|
+
specializedExtend.add(v)
|
1137
|
+
prefix := c[0] + "-"
|
1138
|
+
if hasScriptOrRegion {
|
1139
|
+
prefix += c[1]
|
1140
|
+
}
|
1141
|
+
for _, p := range e.prefix {
|
1142
|
+
// Verify that the prefix minus the last element is a prefix of the
|
1143
|
+
// predecessor element.
|
1144
|
+
i := strings.LastIndex(p, "-")
|
1145
|
+
pred := b.registry[p[i+1:]]
|
1146
|
+
if find(pred.prefix, p[:i]) < 0 {
|
1147
|
+
log.Fatalf("prefix %q for variant %q not consistent with predecessor spec", p, v)
|
1148
|
+
}
|
1149
|
+
// The sorting used below does not work in the general case. It works
|
1150
|
+
// if we assume that variants that may be followed by others only have
|
1151
|
+
// prefixes of the same length. Verify this.
|
1152
|
+
count := strings.Count(p[:i], "-")
|
1153
|
+
for _, q := range pred.prefix {
|
1154
|
+
if c := strings.Count(q, "-"); c != count {
|
1155
|
+
log.Fatalf("variant %q preceding %q has a prefix %q of size %d; want %d", p[i+1:], v, q, c, count)
|
1156
|
+
}
|
1157
|
+
}
|
1158
|
+
if !strings.HasPrefix(p, prefix) {
|
1159
|
+
log.Fatalf("prefix %q of variant %q should start with %q", p, v, prefix)
|
1160
|
+
}
|
1161
|
+
}
|
1162
|
+
}
|
1163
|
+
|
1164
|
+
// Sort extended variants.
|
1165
|
+
a := specializedExtend.s
|
1166
|
+
less := func(v, w string) bool {
|
1167
|
+
// Sort by the maximum number of elements.
|
1168
|
+
maxCount := func(s string) (max int) {
|
1169
|
+
for _, p := range b.registry[s].prefix {
|
1170
|
+
if c := strings.Count(p, "-"); c > max {
|
1171
|
+
max = c
|
1172
|
+
}
|
1173
|
+
}
|
1174
|
+
return
|
1175
|
+
}
|
1176
|
+
if cv, cw := maxCount(v), maxCount(w); cv != cw {
|
1177
|
+
return cv < cw
|
1178
|
+
}
|
1179
|
+
// Sort by name as tie breaker.
|
1180
|
+
return v < w
|
1181
|
+
}
|
1182
|
+
sort.Sort(funcSorter{less, sort.StringSlice(a)})
|
1183
|
+
specializedExtend.frozen = true
|
1184
|
+
|
1185
|
+
// Create index from variant name to index.
|
1186
|
+
variantIndex := make(map[string]uint8)
|
1187
|
+
add := func(s []string) {
|
1188
|
+
for _, v := range s {
|
1189
|
+
variantIndex[v] = uint8(len(variantIndex))
|
1190
|
+
}
|
1191
|
+
}
|
1192
|
+
add(specialized.slice())
|
1193
|
+
add(specializedExtend.s)
|
1194
|
+
numSpecialized := len(variantIndex)
|
1195
|
+
add(generalized.slice())
|
1196
|
+
if n := len(variantIndex); n > 255 {
|
1197
|
+
log.Fatalf("maximum number of variants exceeded: was %d; want <= 255", n)
|
1198
|
+
}
|
1199
|
+
b.writeMap("variantIndex", variantIndex)
|
1200
|
+
b.writeConst("variantNumSpecialized", numSpecialized)
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
func (b *builder) writeLanguageInfo() {
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
// writeLikelyData writes tables that are used both for finding parent relations and for
|
1207
|
+
// language matching. Each entry contains additional bits to indicate the status of the
|
1208
|
+
// data to know when it cannot be used for parent relations.
|
1209
|
+
func (b *builder) writeLikelyData() {
|
1210
|
+
const (
|
1211
|
+
isList = 1 << iota
|
1212
|
+
scriptInFrom
|
1213
|
+
regionInFrom
|
1214
|
+
)
|
1215
|
+
type ( // generated types
|
1216
|
+
likelyScriptRegion struct {
|
1217
|
+
region uint16
|
1218
|
+
script uint8
|
1219
|
+
flags uint8
|
1220
|
+
}
|
1221
|
+
likelyLangScript struct {
|
1222
|
+
lang uint16
|
1223
|
+
script uint8
|
1224
|
+
flags uint8
|
1225
|
+
}
|
1226
|
+
likelyLangRegion struct {
|
1227
|
+
lang uint16
|
1228
|
+
region uint16
|
1229
|
+
}
|
1230
|
+
// likelyTag is used for getting likely tags for group regions, where
|
1231
|
+
// the likely region might be a region contained in the group.
|
1232
|
+
likelyTag struct {
|
1233
|
+
lang uint16
|
1234
|
+
region uint16
|
1235
|
+
script uint8
|
1236
|
+
}
|
1237
|
+
)
|
1238
|
+
var ( // generated variables
|
1239
|
+
likelyRegionGroup = make([]likelyTag, len(b.groups))
|
1240
|
+
likelyLang = make([]likelyScriptRegion, len(b.lang.s))
|
1241
|
+
likelyRegion = make([]likelyLangScript, len(b.region.s))
|
1242
|
+
likelyScript = make([]likelyLangRegion, len(b.script.s))
|
1243
|
+
likelyLangList = []likelyScriptRegion{}
|
1244
|
+
likelyRegionList = []likelyLangScript{}
|
1245
|
+
)
|
1246
|
+
type fromTo struct {
|
1247
|
+
from, to []string
|
1248
|
+
}
|
1249
|
+
langToOther := map[int][]fromTo{}
|
1250
|
+
regionToOther := map[int][]fromTo{}
|
1251
|
+
for _, m := range b.supp.LikelySubtags.LikelySubtag {
|
1252
|
+
from := strings.Split(m.From, "_")
|
1253
|
+
to := strings.Split(m.To, "_")
|
1254
|
+
if len(to) != 3 {
|
1255
|
+
log.Fatalf("invalid number of subtags in %q: found %d, want 3", m.To, len(to))
|
1256
|
+
}
|
1257
|
+
if len(from) > 3 {
|
1258
|
+
log.Fatalf("invalid number of subtags: found %d, want 1-3", len(from))
|
1259
|
+
}
|
1260
|
+
if from[0] != to[0] && from[0] != "und" {
|
1261
|
+
log.Fatalf("unexpected language change in expansion: %s -> %s", from, to)
|
1262
|
+
}
|
1263
|
+
if len(from) == 3 {
|
1264
|
+
if from[2] != to[2] {
|
1265
|
+
log.Fatalf("unexpected region change in expansion: %s -> %s", from, to)
|
1266
|
+
}
|
1267
|
+
if from[0] != "und" {
|
1268
|
+
log.Fatalf("unexpected fully specified from tag: %s -> %s", from, to)
|
1269
|
+
}
|
1270
|
+
}
|
1271
|
+
if len(from) == 1 || from[0] != "und" {
|
1272
|
+
id := 0
|
1273
|
+
if from[0] != "und" {
|
1274
|
+
id = b.lang.index(from[0])
|
1275
|
+
}
|
1276
|
+
langToOther[id] = append(langToOther[id], fromTo{from, to})
|
1277
|
+
} else if len(from) == 2 && len(from[1]) == 4 {
|
1278
|
+
sid := b.script.index(from[1])
|
1279
|
+
likelyScript[sid].lang = uint16(b.langIndex(to[0]))
|
1280
|
+
likelyScript[sid].region = uint16(b.region.index(to[2]))
|
1281
|
+
} else {
|
1282
|
+
r := b.region.index(from[len(from)-1])
|
1283
|
+
if id, ok := b.groups[r]; ok {
|
1284
|
+
if from[0] != "und" {
|
1285
|
+
log.Fatalf("region changed unexpectedly: %s -> %s", from, to)
|
1286
|
+
}
|
1287
|
+
likelyRegionGroup[id].lang = uint16(b.langIndex(to[0]))
|
1288
|
+
likelyRegionGroup[id].script = uint8(b.script.index(to[1]))
|
1289
|
+
likelyRegionGroup[id].region = uint16(b.region.index(to[2]))
|
1290
|
+
} else {
|
1291
|
+
regionToOther[r] = append(regionToOther[r], fromTo{from, to})
|
1292
|
+
}
|
1293
|
+
}
|
1294
|
+
}
|
1295
|
+
b.writeType(likelyLangRegion{})
|
1296
|
+
b.writeSlice("likelyScript", likelyScript)
|
1297
|
+
|
1298
|
+
for id := range b.lang.s {
|
1299
|
+
list := langToOther[id]
|
1300
|
+
if len(list) == 1 {
|
1301
|
+
likelyLang[id].region = uint16(b.region.index(list[0].to[2]))
|
1302
|
+
likelyLang[id].script = uint8(b.script.index(list[0].to[1]))
|
1303
|
+
} else if len(list) > 1 {
|
1304
|
+
likelyLang[id].flags = isList
|
1305
|
+
likelyLang[id].region = uint16(len(likelyLangList))
|
1306
|
+
likelyLang[id].script = uint8(len(list))
|
1307
|
+
for _, x := range list {
|
1308
|
+
flags := uint8(0)
|
1309
|
+
if len(x.from) > 1 {
|
1310
|
+
if x.from[1] == x.to[2] {
|
1311
|
+
flags = regionInFrom
|
1312
|
+
} else {
|
1313
|
+
flags = scriptInFrom
|
1314
|
+
}
|
1315
|
+
}
|
1316
|
+
likelyLangList = append(likelyLangList, likelyScriptRegion{
|
1317
|
+
region: uint16(b.region.index(x.to[2])),
|
1318
|
+
script: uint8(b.script.index(x.to[1])),
|
1319
|
+
flags: flags,
|
1320
|
+
})
|
1321
|
+
}
|
1322
|
+
}
|
1323
|
+
}
|
1324
|
+
// TODO: merge suppressScript data with this table.
|
1325
|
+
b.writeType(likelyScriptRegion{})
|
1326
|
+
b.writeSlice("likelyLang", likelyLang)
|
1327
|
+
b.writeSlice("likelyLangList", likelyLangList)
|
1328
|
+
|
1329
|
+
for id := range b.region.s {
|
1330
|
+
list := regionToOther[id]
|
1331
|
+
if len(list) == 1 {
|
1332
|
+
likelyRegion[id].lang = uint16(b.langIndex(list[0].to[0]))
|
1333
|
+
likelyRegion[id].script = uint8(b.script.index(list[0].to[1]))
|
1334
|
+
if len(list[0].from) > 2 {
|
1335
|
+
likelyRegion[id].flags = scriptInFrom
|
1336
|
+
}
|
1337
|
+
} else if len(list) > 1 {
|
1338
|
+
likelyRegion[id].flags = isList
|
1339
|
+
likelyRegion[id].lang = uint16(len(likelyRegionList))
|
1340
|
+
likelyRegion[id].script = uint8(len(list))
|
1341
|
+
for i, x := range list {
|
1342
|
+
if len(x.from) == 2 && i != 0 || i > 0 && len(x.from) != 3 {
|
1343
|
+
log.Fatalf("unspecified script must be first in list: %v at %d", x.from, i)
|
1344
|
+
}
|
1345
|
+
x := likelyLangScript{
|
1346
|
+
lang: uint16(b.langIndex(x.to[0])),
|
1347
|
+
script: uint8(b.script.index(x.to[1])),
|
1348
|
+
}
|
1349
|
+
if len(list[0].from) > 2 {
|
1350
|
+
x.flags = scriptInFrom
|
1351
|
+
}
|
1352
|
+
likelyRegionList = append(likelyRegionList, x)
|
1353
|
+
}
|
1354
|
+
}
|
1355
|
+
}
|
1356
|
+
b.writeType(likelyLangScript{})
|
1357
|
+
b.writeSlice("likelyRegion", likelyRegion)
|
1358
|
+
b.writeSlice("likelyRegionList", likelyRegionList)
|
1359
|
+
|
1360
|
+
b.writeType(likelyTag{})
|
1361
|
+
b.writeSlice("likelyRegionGroup", likelyRegionGroup)
|
1362
|
+
}
|
1363
|
+
|
1364
|
+
type mutualIntelligibility struct {
|
1365
|
+
want, have uint16
|
1366
|
+
distance uint8
|
1367
|
+
oneway bool
|
1368
|
+
}
|
1369
|
+
|
1370
|
+
type scriptIntelligibility struct {
|
1371
|
+
wantLang, haveLang uint16
|
1372
|
+
wantScript, haveScript uint8
|
1373
|
+
distance uint8
|
1374
|
+
// Always oneway
|
1375
|
+
}
|
1376
|
+
|
1377
|
+
type regionIntelligibility struct {
|
1378
|
+
lang uint16 // compact language id
|
1379
|
+
script uint8 // 0 means any
|
1380
|
+
group uint8 // 0 means any; if bit 7 is set it means inverse
|
1381
|
+
distance uint8
|
1382
|
+
// Always twoway.
|
1383
|
+
}
|
1384
|
+
|
1385
|
+
// writeMatchData writes tables with languages and scripts for which there is
|
1386
|
+
// mutual intelligibility. The data is based on CLDR's languageMatching data.
|
1387
|
+
// Note that we use a different algorithm than the one defined by CLDR and that
|
1388
|
+
// we slightly modify the data. For example, we convert scores to confidence levels.
|
1389
|
+
// We also drop all region-related data as we use a different algorithm to
|
1390
|
+
// determine region equivalence.
|
1391
|
+
func (b *builder) writeMatchData() {
|
1392
|
+
lm := b.supp.LanguageMatching.LanguageMatches
|
1393
|
+
cldr.MakeSlice(&lm).SelectAnyOf("type", "written_new")
|
1394
|
+
|
1395
|
+
regionHierarchy := map[string][]string{}
|
1396
|
+
for _, g := range b.supp.TerritoryContainment.Group {
|
1397
|
+
regions := strings.Split(g.Contains, " ")
|
1398
|
+
regionHierarchy[g.Type] = append(regionHierarchy[g.Type], regions...)
|
1399
|
+
}
|
1400
|
+
regionToGroups := make([]uint8, len(b.region.s))
|
1401
|
+
|
1402
|
+
idToIndex := map[string]uint8{}
|
1403
|
+
for i, mv := range lm[0].MatchVariable {
|
1404
|
+
if i > 6 {
|
1405
|
+
log.Fatalf("Too many groups: %d", i)
|
1406
|
+
}
|
1407
|
+
idToIndex[mv.Id] = uint8(i + 1)
|
1408
|
+
// TODO: also handle '-'
|
1409
|
+
for _, r := range strings.Split(mv.Value, "+") {
|
1410
|
+
todo := []string{r}
|
1411
|
+
for k := 0; k < len(todo); k++ {
|
1412
|
+
r := todo[k]
|
1413
|
+
regionToGroups[b.region.index(r)] |= 1 << uint8(i)
|
1414
|
+
todo = append(todo, regionHierarchy[r]...)
|
1415
|
+
}
|
1416
|
+
}
|
1417
|
+
}
|
1418
|
+
b.writeSlice("regionToGroups", regionToGroups)
|
1419
|
+
|
1420
|
+
// maps language id to in- and out-of-group region.
|
1421
|
+
paradigmLocales := [][3]uint16{}
|
1422
|
+
locales := strings.Split(lm[0].ParadigmLocales[0].Locales, " ")
|
1423
|
+
for i := 0; i < len(locales); i += 2 {
|
1424
|
+
x := [3]uint16{}
|
1425
|
+
for j := 0; j < 2; j++ {
|
1426
|
+
pc := strings.SplitN(locales[i+j], "-", 2)
|
1427
|
+
x[0] = b.langIndex(pc[0])
|
1428
|
+
if len(pc) == 2 {
|
1429
|
+
x[1+j] = uint16(b.region.index(pc[1]))
|
1430
|
+
}
|
1431
|
+
}
|
1432
|
+
paradigmLocales = append(paradigmLocales, x)
|
1433
|
+
}
|
1434
|
+
b.writeSlice("paradigmLocales", paradigmLocales)
|
1435
|
+
|
1436
|
+
b.writeType(mutualIntelligibility{})
|
1437
|
+
b.writeType(scriptIntelligibility{})
|
1438
|
+
b.writeType(regionIntelligibility{})
|
1439
|
+
|
1440
|
+
matchLang := []mutualIntelligibility{}
|
1441
|
+
matchScript := []scriptIntelligibility{}
|
1442
|
+
matchRegion := []regionIntelligibility{}
|
1443
|
+
// Convert the languageMatch entries in lists keyed by desired language.
|
1444
|
+
for _, m := range lm[0].LanguageMatch {
|
1445
|
+
// Different versions of CLDR use different separators.
|
1446
|
+
desired := strings.Replace(m.Desired, "-", "_", -1)
|
1447
|
+
supported := strings.Replace(m.Supported, "-", "_", -1)
|
1448
|
+
d := strings.Split(desired, "_")
|
1449
|
+
s := strings.Split(supported, "_")
|
1450
|
+
if len(d) != len(s) {
|
1451
|
+
log.Fatalf("not supported: desired=%q; supported=%q", desired, supported)
|
1452
|
+
continue
|
1453
|
+
}
|
1454
|
+
distance, _ := strconv.ParseInt(m.Distance, 10, 8)
|
1455
|
+
switch len(d) {
|
1456
|
+
case 2:
|
1457
|
+
if desired == supported && desired == "*_*" {
|
1458
|
+
continue
|
1459
|
+
}
|
1460
|
+
// language-script pair.
|
1461
|
+
matchScript = append(matchScript, scriptIntelligibility{
|
1462
|
+
wantLang: uint16(b.langIndex(d[0])),
|
1463
|
+
haveLang: uint16(b.langIndex(s[0])),
|
1464
|
+
wantScript: uint8(b.script.index(d[1])),
|
1465
|
+
haveScript: uint8(b.script.index(s[1])),
|
1466
|
+
distance: uint8(distance),
|
1467
|
+
})
|
1468
|
+
if m.Oneway != "true" {
|
1469
|
+
matchScript = append(matchScript, scriptIntelligibility{
|
1470
|
+
wantLang: uint16(b.langIndex(s[0])),
|
1471
|
+
haveLang: uint16(b.langIndex(d[0])),
|
1472
|
+
wantScript: uint8(b.script.index(s[1])),
|
1473
|
+
haveScript: uint8(b.script.index(d[1])),
|
1474
|
+
distance: uint8(distance),
|
1475
|
+
})
|
1476
|
+
}
|
1477
|
+
case 1:
|
1478
|
+
if desired == supported && desired == "*" {
|
1479
|
+
continue
|
1480
|
+
}
|
1481
|
+
if distance == 1 {
|
1482
|
+
// nb == no is already handled by macro mapping. Check there
|
1483
|
+
// really is only this case.
|
1484
|
+
if d[0] != "no" || s[0] != "nb" {
|
1485
|
+
log.Fatalf("unhandled equivalence %s == %s", s[0], d[0])
|
1486
|
+
}
|
1487
|
+
continue
|
1488
|
+
}
|
1489
|
+
// TODO: consider dropping oneway field and just doubling the entry.
|
1490
|
+
matchLang = append(matchLang, mutualIntelligibility{
|
1491
|
+
want: uint16(b.langIndex(d[0])),
|
1492
|
+
have: uint16(b.langIndex(s[0])),
|
1493
|
+
distance: uint8(distance),
|
1494
|
+
oneway: m.Oneway == "true",
|
1495
|
+
})
|
1496
|
+
case 3:
|
1497
|
+
if desired == supported && desired == "*_*_*" {
|
1498
|
+
continue
|
1499
|
+
}
|
1500
|
+
if desired != supported { // (Weird but correct.)
|
1501
|
+
log.Fatalf("not supported: desired=%q; supported=%q", desired, supported)
|
1502
|
+
continue
|
1503
|
+
}
|
1504
|
+
ri := regionIntelligibility{
|
1505
|
+
lang: b.langIndex(d[0]),
|
1506
|
+
distance: uint8(distance),
|
1507
|
+
}
|
1508
|
+
if d[1] != "*" {
|
1509
|
+
ri.script = uint8(b.script.index(d[1]))
|
1510
|
+
}
|
1511
|
+
switch {
|
1512
|
+
case d[2] == "*":
|
1513
|
+
ri.group = 0x80 // not contained in anything
|
1514
|
+
case strings.HasPrefix(d[2], "$!"):
|
1515
|
+
ri.group = 0x80
|
1516
|
+
d[2] = "$" + d[2][len("$!"):]
|
1517
|
+
fallthrough
|
1518
|
+
case strings.HasPrefix(d[2], "$"):
|
1519
|
+
ri.group |= idToIndex[d[2]]
|
1520
|
+
}
|
1521
|
+
matchRegion = append(matchRegion, ri)
|
1522
|
+
default:
|
1523
|
+
log.Fatalf("not supported: desired=%q; supported=%q", desired, supported)
|
1524
|
+
}
|
1525
|
+
}
|
1526
|
+
sort.SliceStable(matchLang, func(i, j int) bool {
|
1527
|
+
return matchLang[i].distance < matchLang[j].distance
|
1528
|
+
})
|
1529
|
+
b.writeSlice("matchLang", matchLang)
|
1530
|
+
|
1531
|
+
sort.SliceStable(matchScript, func(i, j int) bool {
|
1532
|
+
return matchScript[i].distance < matchScript[j].distance
|
1533
|
+
})
|
1534
|
+
b.writeSlice("matchScript", matchScript)
|
1535
|
+
|
1536
|
+
sort.SliceStable(matchRegion, func(i, j int) bool {
|
1537
|
+
return matchRegion[i].distance < matchRegion[j].distance
|
1538
|
+
})
|
1539
|
+
b.writeSlice("matchRegion", matchRegion)
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
func (b *builder) writeRegionInclusionData() {
|
1543
|
+
var (
|
1544
|
+
// mm holds for each group the set of groups with a distance of 1.
|
1545
|
+
mm = make(map[int][]index)
|
1546
|
+
|
1547
|
+
// containment holds for each group the transitive closure of
|
1548
|
+
// containment of other groups.
|
1549
|
+
containment = make(map[index][]index)
|
1550
|
+
)
|
1551
|
+
for _, g := range b.supp.TerritoryContainment.Group {
|
1552
|
+
// Skip UN and EURO zone as they are flattening the containment
|
1553
|
+
// relationship.
|
1554
|
+
if g.Type == "EZ" || g.Type == "UN" {
|
1555
|
+
continue
|
1556
|
+
}
|
1557
|
+
group := b.region.index(g.Type)
|
1558
|
+
groupIdx := b.groups[group]
|
1559
|
+
for _, mem := range strings.Split(g.Contains, " ") {
|
1560
|
+
r := b.region.index(mem)
|
1561
|
+
mm[r] = append(mm[r], groupIdx)
|
1562
|
+
if g, ok := b.groups[r]; ok {
|
1563
|
+
mm[group] = append(mm[group], g)
|
1564
|
+
containment[groupIdx] = append(containment[groupIdx], g)
|
1565
|
+
}
|
1566
|
+
}
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
regionContainment := make([]uint64, len(b.groups))
|
1570
|
+
for _, g := range b.groups {
|
1571
|
+
l := containment[g]
|
1572
|
+
|
1573
|
+
// Compute the transitive closure of containment.
|
1574
|
+
for i := 0; i < len(l); i++ {
|
1575
|
+
l = append(l, containment[l[i]]...)
|
1576
|
+
}
|
1577
|
+
|
1578
|
+
// Compute the bitmask.
|
1579
|
+
regionContainment[g] = 1 << g
|
1580
|
+
for _, v := range l {
|
1581
|
+
regionContainment[g] |= 1 << v
|
1582
|
+
}
|
1583
|
+
}
|
1584
|
+
b.writeSlice("regionContainment", regionContainment)
|
1585
|
+
|
1586
|
+
regionInclusion := make([]uint8, len(b.region.s))
|
1587
|
+
bvs := make(map[uint64]index)
|
1588
|
+
// Make the first bitvector positions correspond with the groups.
|
1589
|
+
for r, i := range b.groups {
|
1590
|
+
bv := uint64(1 << i)
|
1591
|
+
for _, g := range mm[r] {
|
1592
|
+
bv |= 1 << g
|
1593
|
+
}
|
1594
|
+
bvs[bv] = i
|
1595
|
+
regionInclusion[r] = uint8(bvs[bv])
|
1596
|
+
}
|
1597
|
+
for r := 1; r < len(b.region.s); r++ {
|
1598
|
+
if _, ok := b.groups[r]; !ok {
|
1599
|
+
bv := uint64(0)
|
1600
|
+
for _, g := range mm[r] {
|
1601
|
+
bv |= 1 << g
|
1602
|
+
}
|
1603
|
+
if bv == 0 {
|
1604
|
+
// Pick the world for unspecified regions.
|
1605
|
+
bv = 1 << b.groups[b.region.index("001")]
|
1606
|
+
}
|
1607
|
+
if _, ok := bvs[bv]; !ok {
|
1608
|
+
bvs[bv] = index(len(bvs))
|
1609
|
+
}
|
1610
|
+
regionInclusion[r] = uint8(bvs[bv])
|
1611
|
+
}
|
1612
|
+
}
|
1613
|
+
b.writeSlice("regionInclusion", regionInclusion)
|
1614
|
+
regionInclusionBits := make([]uint64, len(bvs))
|
1615
|
+
for k, v := range bvs {
|
1616
|
+
regionInclusionBits[v] = uint64(k)
|
1617
|
+
}
|
1618
|
+
// Add bit vectors for increasingly large distances until a fixed point is reached.
|
1619
|
+
regionInclusionNext := []uint8{}
|
1620
|
+
for i := 0; i < len(regionInclusionBits); i++ {
|
1621
|
+
bits := regionInclusionBits[i]
|
1622
|
+
next := bits
|
1623
|
+
for i := uint(0); i < uint(len(b.groups)); i++ {
|
1624
|
+
if bits&(1<<i) != 0 {
|
1625
|
+
next |= regionInclusionBits[i]
|
1626
|
+
}
|
1627
|
+
}
|
1628
|
+
if _, ok := bvs[next]; !ok {
|
1629
|
+
bvs[next] = index(len(bvs))
|
1630
|
+
regionInclusionBits = append(regionInclusionBits, next)
|
1631
|
+
}
|
1632
|
+
regionInclusionNext = append(regionInclusionNext, uint8(bvs[next]))
|
1633
|
+
}
|
1634
|
+
b.writeSlice("regionInclusionBits", regionInclusionBits)
|
1635
|
+
b.writeSlice("regionInclusionNext", regionInclusionNext)
|
1636
|
+
}
|
1637
|
+
|
1638
|
+
type parentRel struct {
|
1639
|
+
lang uint16
|
1640
|
+
script uint8
|
1641
|
+
maxScript uint8
|
1642
|
+
toRegion uint16
|
1643
|
+
fromRegion []uint16
|
1644
|
+
}
|
1645
|
+
|
1646
|
+
func (b *builder) writeParents() {
|
1647
|
+
b.writeType(parentRel{})
|
1648
|
+
|
1649
|
+
parents := []parentRel{}
|
1650
|
+
|
1651
|
+
// Construct parent overrides.
|
1652
|
+
n := 0
|
1653
|
+
for _, p := range b.data.Supplemental().ParentLocales.ParentLocale {
|
1654
|
+
// Skipping non-standard scripts to root is implemented using addTags.
|
1655
|
+
if p.Parent == "root" {
|
1656
|
+
continue
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
sub := strings.Split(p.Parent, "_")
|
1660
|
+
parent := parentRel{lang: b.langIndex(sub[0])}
|
1661
|
+
if len(sub) == 2 {
|
1662
|
+
// TODO: check that all undefined scripts are indeed Latn in these
|
1663
|
+
// cases.
|
1664
|
+
parent.maxScript = uint8(b.script.index("Latn"))
|
1665
|
+
parent.toRegion = uint16(b.region.index(sub[1]))
|
1666
|
+
} else {
|
1667
|
+
parent.script = uint8(b.script.index(sub[1]))
|
1668
|
+
parent.maxScript = parent.script
|
1669
|
+
parent.toRegion = uint16(b.region.index(sub[2]))
|
1670
|
+
}
|
1671
|
+
for _, c := range strings.Split(p.Locales, " ") {
|
1672
|
+
region := b.region.index(c[strings.LastIndex(c, "_")+1:])
|
1673
|
+
parent.fromRegion = append(parent.fromRegion, uint16(region))
|
1674
|
+
}
|
1675
|
+
parents = append(parents, parent)
|
1676
|
+
n += len(parent.fromRegion)
|
1677
|
+
}
|
1678
|
+
b.writeSliceAddSize("parents", n*2, parents)
|
1679
|
+
}
|
1680
|
+
|
1681
|
+
func main() {
|
1682
|
+
gen.Init()
|
1683
|
+
|
1684
|
+
gen.Repackage("gen_common.go", "common.go", "language")
|
1685
|
+
|
1686
|
+
w := gen.NewCodeWriter()
|
1687
|
+
defer w.WriteGoFile("tables.go", "language")
|
1688
|
+
|
1689
|
+
fmt.Fprintln(w, `import "golang.org/x/text/internal/tag"`)
|
1690
|
+
|
1691
|
+
b := newBuilder(w)
|
1692
|
+
gen.WriteCLDRVersion(w)
|
1693
|
+
|
1694
|
+
b.parseIndices()
|
1695
|
+
b.writeType(fromTo{})
|
1696
|
+
b.writeLanguage()
|
1697
|
+
b.writeScript()
|
1698
|
+
b.writeRegion()
|
1699
|
+
b.writeVariant()
|
1700
|
+
// TODO: b.writeLocale()
|
1701
|
+
b.computeRegionGroups()
|
1702
|
+
b.writeLikelyData()
|
1703
|
+
b.writeMatchData()
|
1704
|
+
b.writeRegionInclusionData()
|
1705
|
+
b.writeParents()
|
1706
|
+
}
|