coverage.go 730 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2014 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. package language
  5. // BaseLanguages returns the list of all supported base languages. It generates
  6. // the list by traversing the internal structures.
  7. func BaseLanguages() []Language {
  8. base := make([]Language, 0, NumLanguages)
  9. for i := 0; i < langNoIndexOffset; i++ {
  10. // We included "und" already for the value 0.
  11. if i != nonCanonicalUnd {
  12. base = append(base, Language(i))
  13. }
  14. }
  15. i := langNoIndexOffset
  16. for _, v := range langNoIndex {
  17. for k := 0; k < 8; k++ {
  18. if v&1 == 1 {
  19. base = append(base, Language(i))
  20. }
  21. v >>= 1
  22. i++
  23. }
  24. }
  25. return base
  26. }