You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

58 lines
1.5 KiB

  1. // Copyright 2015 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. // +build ignore
  5. package main
  6. import (
  7. "unicode"
  8. "golang.org/x/text/internal/gen"
  9. "golang.org/x/text/internal/ucd"
  10. "golang.org/x/text/unicode/rangetable"
  11. )
  12. // These tables are hand-extracted from:
  13. // https://www.unicode.org/Public/8.0.0/ucd/extracted/DerivedBidiClass.txt
  14. func visitDefaults(fn func(r rune, c Class)) {
  15. // first write default values for ranges listed above.
  16. visitRunes(fn, AL, []rune{
  17. 0x0600, 0x07BF, // Arabic
  18. 0x08A0, 0x08FF, // Arabic Extended-A
  19. 0xFB50, 0xFDCF, // Arabic Presentation Forms
  20. 0xFDF0, 0xFDFF,
  21. 0xFE70, 0xFEFF,
  22. 0x0001EE00, 0x0001EEFF, // Arabic Mathematical Alpha Symbols
  23. })
  24. visitRunes(fn, R, []rune{
  25. 0x0590, 0x05FF, // Hebrew
  26. 0x07C0, 0x089F, // Nko et al.
  27. 0xFB1D, 0xFB4F,
  28. 0x00010800, 0x00010FFF, // Cypriot Syllabary et. al.
  29. 0x0001E800, 0x0001EDFF,
  30. 0x0001EF00, 0x0001EFFF,
  31. })
  32. visitRunes(fn, ET, []rune{ // European Terminator
  33. 0x20A0, 0x20Cf, // Currency symbols
  34. })
  35. rangetable.Visit(unicode.Noncharacter_Code_Point, func(r rune) {
  36. fn(r, BN) // Boundary Neutral
  37. })
  38. ucd.Parse(gen.OpenUCDFile("DerivedCoreProperties.txt"), func(p *ucd.Parser) {
  39. if p.String(1) == "Default_Ignorable_Code_Point" {
  40. fn(p.Rune(0), BN) // Boundary Neutral
  41. }
  42. })
  43. }
  44. func visitRunes(fn func(r rune, c Class), c Class, runes []rune) {
  45. for i := 0; i < len(runes); i += 2 {
  46. lo, hi := runes[i], runes[i+1]
  47. for j := lo; j <= hi; j++ {
  48. fn(j, c)
  49. }
  50. }
  51. }