text_tables.go 1002 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package plist
  2. type characterSet [4]uint64
  3. func (s *characterSet) Contains(ch rune) bool {
  4. return ch >= 0 && ch <= 255 && s.ContainsByte(byte(ch))
  5. }
  6. func (s *characterSet) ContainsByte(ch byte) bool {
  7. return (s[ch/64]&(1<<(ch%64)) > 0)
  8. }
  9. // Bitmap of characters that must be inside a quoted string
  10. // when written to an old-style property list
  11. // Low bits represent lower characters, and each uint64 represents 64 characters.
  12. var gsQuotable = characterSet{
  13. 0x78001385ffffffff,
  14. 0xa800000138000000,
  15. 0xffffffffffffffff,
  16. 0xffffffffffffffff,
  17. }
  18. // 7f instead of 3f in the top line: CFOldStylePlist.c says . is valid, but they quote it.
  19. var osQuotable = characterSet{
  20. 0xf4007f6fffffffff,
  21. 0xf8000001f8000001,
  22. 0xffffffffffffffff,
  23. 0xffffffffffffffff,
  24. }
  25. var whitespace = characterSet{
  26. 0x0000000100003f00,
  27. 0x0000000000000000,
  28. 0x0000000000000000,
  29. 0x0000000000000000,
  30. }
  31. var newlineCharacterSet = characterSet{
  32. 0x0000000000002400,
  33. 0x0000000000000000,
  34. 0x0000000000000000,
  35. 0x0000000000000000,
  36. }