OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Package unicode provides data and functions to test some properties of | 5 // Package unicode provides data and functions to test some properties of |
6 // Unicode code points. | 6 // Unicode code points. |
7 package unicode | 7 package unicode |
8 | 8 |
| 9 // Tables are regenerated each time we update the Unicode version. |
| 10 //go:generate go run maketables.go -tables=all -output tables.go |
| 11 |
9 const ( | 12 const ( |
10 MaxRune = '\U0010FFFF' // Maximum valid Unicode code point. | 13 MaxRune = '\U0010FFFF' // Maximum valid Unicode code point. |
11 ReplacementChar = '\uFFFD' // Represents invalid code points. | 14 ReplacementChar = '\uFFFD' // Represents invalid code points. |
12 MaxASCII = '\u007F' // maximum ASCII value. | 15 MaxASCII = '\u007F' // maximum ASCII value. |
13 MaxLatin1 = '\u00FF' // maximum Latin-1 value. | 16 MaxLatin1 = '\u00FF' // maximum Latin-1 value. |
14 ) | 17 ) |
15 | 18 |
16 // RangeTable defines a set of Unicode code points by listing the ranges of | 19 // RangeTable defines a set of Unicode code points by listing the ranges of |
17 // code points within the set. The ranges are listed in two slices | 20 // code points within the set. The ranges are listed in two slices |
18 // to save space: a slice of 16-bit ranges and a slice of 32-bit ranges. | 21 // to save space: a slice of 16-bit ranges and a slice of 32-bit ranges. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 } | 348 } |
346 | 349 |
347 // No folding specified. This is a one- or two-element | 350 // No folding specified. This is a one- or two-element |
348 // equivalence class containing rune and ToLower(rune) | 351 // equivalence class containing rune and ToLower(rune) |
349 // and ToUpper(rune) if they are different from rune. | 352 // and ToUpper(rune) if they are different from rune. |
350 if l := ToLower(r); l != r { | 353 if l := ToLower(r); l != r { |
351 return l | 354 return l |
352 } | 355 } |
353 return ToUpper(r) | 356 return ToUpper(r) |
354 } | 357 } |
OLD | NEW |