ranges_test.go 1.4 KB

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