1
0
mirror of https://github.com/golang/go synced 2024-11-22 04:04:40 -07:00

unicode: various documentation tweaks

The comment on IsOneOf regarding Latin-1 was an implementation detail:
when the function is called internally, that condition is true. It used to matter,
but now the comment is a dreg. The function works fine if the character is
Latin-1, so we just delete the comment.

Fixes #2966.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5655047
This commit is contained in:
Rob Pike 2012-02-10 14:30:44 +11:00
parent 0357af80b4
commit 989e611a7b
4 changed files with 6 additions and 7 deletions

View File

@ -53,7 +53,6 @@ func IsPrint(r rune) bool {
} }
// IsOneOf reports whether the rune is a member of one of the ranges. // IsOneOf reports whether the rune is a member of one of the ranges.
// The rune is known to be above Latin-1.
func IsOneOf(set []*RangeTable, r rune) bool { func IsOneOf(set []*RangeTable, r rune) bool {
for _, inside := range set { for _, inside := range set {
if Is(inside, r) { if Is(inside, r) {
@ -65,7 +64,7 @@ func IsOneOf(set []*RangeTable, r rune) bool {
// IsControl reports whether the rune is a control character. // IsControl reports whether the rune is a control character.
// The C (Other) Unicode category includes more code points // The C (Other) Unicode category includes more code points
// such as surrogates; use Is(C, rune) to test for them. // such as surrogates; use Is(C, r) to test for them.
func IsControl(r rune) bool { func IsControl(r rune) bool {
if uint32(r) <= MaxLatin1 { if uint32(r) <= MaxLatin1 {
return properties[uint8(r)]&pC != 0 return properties[uint8(r)]&pC != 0

View File

@ -60,8 +60,8 @@ type CaseRange struct {
// Methods of SpecialCase customize (by overriding) the standard mappings. // Methods of SpecialCase customize (by overriding) the standard mappings.
type SpecialCase []CaseRange type SpecialCase []CaseRange
//BUG(r): Provide a mechanism for full case folding (those that involve // BUG(r): There is no mechanism for full case folding, that is, for
// multiple runes in the input or output). // characters that involve multiple runes in the input or output.
// Indices into the Delta arrays inside CaseRanges for case mapping. // Indices into the Delta arrays inside CaseRanges for case mapping.
const ( const (
@ -288,7 +288,7 @@ type foldPair struct {
// SimpleFold iterates over Unicode code points equivalent under // SimpleFold iterates over Unicode code points equivalent under
// the Unicode-defined simple case folding. Among the code points // the Unicode-defined simple case folding. Among the code points
// equivalent to rune (including rune itself), SimpleFold returns the // equivalent to rune (including rune itself), SimpleFold returns the
// smallest r >= rune if one exists, or else the smallest r >= 0. // smallest rune >= r if one exists, or else the smallest rune >= 0.
// //
// For example: // For example:
// SimpleFold('A') = 'a' // SimpleFold('A') = 'a'

View File

@ -417,7 +417,7 @@ func printCategories() {
fmt.Printf("const Version = %q\n\n", version()) fmt.Printf("const Version = %q\n\n", version())
if *tablelist == "all" { if *tablelist == "all" {
fmt.Println("// Categories is the set of Unicode data tables.") fmt.Println("// Categories is the set of Unicode category tables.")
fmt.Println("var Categories = map[string] *RangeTable {") fmt.Println("var Categories = map[string] *RangeTable {")
for _, k := range allCategories() { for _, k := range allCategories() {
fmt.Printf("\t%q: %s,\n", k, k) fmt.Printf("\t%q: %s,\n", k, k)

View File

@ -7,7 +7,7 @@ package unicode
// Version is the Unicode edition from which the tables are derived. // Version is the Unicode edition from which the tables are derived.
const Version = "6.0.0" const Version = "6.0.0"
// Categories is the set of Unicode data tables. // Categories is the set of Unicode category tables.
var Categories = map[string]*RangeTable{ var Categories = map[string]*RangeTable{
"C": C, "C": C,
"Cc": Cc, "Cc": Cc,