]> Cypherpunks.ru repositories - gostls13.git/commitdiff
unicode: add available godoc link
authorcui fliter <imcusg@gmail.com>
Sat, 4 Nov 2023 08:42:48 +0000 (16:42 +0800)
committerHeschi Kreinick <heschi@google.com>
Mon, 6 Nov 2023 20:02:46 +0000 (20:02 +0000)
Change-Id: I2273274249f05b0492950c27dc5a654422cefc79
Reviewed-on: https://go-review.googlesource.com/c/go/+/539856
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: shuang cui <imcusg@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
src/unicode/graphic.go
src/unicode/letter.go
src/unicode/utf8/utf8.go

index 2af29778bf39693727d32cbbbd49ea78eb841a4a..aa62f2a4f91d37fdd3d1d118a8ffce9d8be2a157 100644 (file)
@@ -32,7 +32,7 @@ var PrintRanges = []*RangeTable{
 
 // IsGraphic reports whether the rune is defined as a Graphic by Unicode.
 // Such characters include letters, marks, numbers, punctuation, symbols, and
-// spaces, from categories L, M, N, P, S, Zs.
+// spaces, from categories [L], [M], [N], [P], [S], [Zs].
 func IsGraphic(r rune) bool {
        // We convert to uint32 to avoid the extra test for negative,
        // and in the index we convert to uint8 to avoid the range check.
@@ -44,8 +44,8 @@ func IsGraphic(r rune) bool {
 
 // IsPrint reports whether the rune is defined as printable by Go. Such
 // characters include letters, marks, numbers, punctuation, symbols, and the
-// ASCII space character, from categories L, M, N, P, S and the ASCII space
-// character. This categorization is the same as IsGraphic except that the
+// ASCII space character, from categories [L], [M], [N], [P], [S] and the ASCII space
+// character. This categorization is the same as [IsGraphic] except that the
 // only spacing character is ASCII space, U+0020.
 func IsPrint(r rune) bool {
        if uint32(r) <= MaxLatin1 {
@@ -76,8 +76,8 @@ func In(r rune, ranges ...*RangeTable) bool {
 }
 
 // IsControl reports whether the rune is a control character.
-// The C (Other) Unicode category includes more code points
-// such as surrogates; use Is(C, r) to test for them.
+// The [C] ([Other]) Unicode category includes more code points
+// such as surrogates; use [Is](C, r) to test for them.
 func IsControl(r rune) bool {
        if uint32(r) <= MaxLatin1 {
                return properties[uint8(r)]&pC != 0
@@ -86,7 +86,7 @@ func IsControl(r rune) bool {
        return false
 }
 
-// IsLetter reports whether the rune is a letter (category L).
+// IsLetter reports whether the rune is a letter (category [L]).
 func IsLetter(r rune) bool {
        if uint32(r) <= MaxLatin1 {
                return properties[uint8(r)]&(pLmask) != 0
@@ -94,13 +94,13 @@ func IsLetter(r rune) bool {
        return isExcludingLatin(Letter, r)
 }
 
-// IsMark reports whether the rune is a mark character (category M).
+// IsMark reports whether the rune is a mark character (category [M]).
 func IsMark(r rune) bool {
        // There are no mark characters in Latin-1.
        return isExcludingLatin(Mark, r)
 }
 
-// IsNumber reports whether the rune is a number (category N).
+// IsNumber reports whether the rune is a number (category [N]).
 func IsNumber(r rune) bool {
        if uint32(r) <= MaxLatin1 {
                return properties[uint8(r)]&pN != 0
@@ -109,7 +109,7 @@ func IsNumber(r rune) bool {
 }
 
 // IsPunct reports whether the rune is a Unicode punctuation character
-// (category P).
+// (category [P]).
 func IsPunct(r rune) bool {
        if uint32(r) <= MaxLatin1 {
                return properties[uint8(r)]&pP != 0
@@ -124,7 +124,7 @@ func IsPunct(r rune) bool {
 //     '\t', '\n', '\v', '\f', '\r', ' ', U+0085 (NEL), U+00A0 (NBSP).
 //
 // Other definitions of spacing characters are set by category
-// Z and property Pattern_White_Space.
+// Z and property [Pattern_White_Space].
 func IsSpace(r rune) bool {
        // This property isn't the same as Z; special-case it.
        if uint32(r) <= MaxLatin1 {
index f64dfc9af5e169a02a49ad1106178115f4e2340a..9e2cead631974d9ccc22a059b2c2da1c894ec4c5 100644 (file)
@@ -76,9 +76,9 @@ const (
 
 type d [MaxCase]rune // to make the CaseRanges text shorter
 
-// If the Delta field of a CaseRange is UpperLower, it means
+// If the Delta field of a [CaseRange] is UpperLower, it means
 // this CaseRange represents a sequence of the form (say)
-// Upper Lower Upper Lower.
+// [Upper] [Lower] [Upper] [Lower].
 const (
        UpperLower = MaxRune + 1 // (Cannot be a valid delta.)
 )
@@ -244,7 +244,7 @@ func to(_case int, r rune, caseRange []CaseRange) (mappedRune rune, foundMapping
        return r, false
 }
 
-// To maps the rune to the specified case: UpperCase, LowerCase, or TitleCase.
+// To maps the rune to the specified case: [UpperCase], [LowerCase], or [TitleCase].
 func To(_case int, r rune) rune {
        r, _ = to(_case, r, CaseRanges)
        return r
index 1e9f666e235d3540a0233fec52d3cdc40b34e475..71d6bf18d01b531159c0dcc74b14566c8c36fcc6 100644 (file)
@@ -141,7 +141,7 @@ func FullRuneInString(s string) bool {
 }
 
 // DecodeRune unpacks the first UTF-8 encoding in p and returns the rune and
-// its width in bytes. If p is empty it returns (RuneError, 0). Otherwise, if
+// its width in bytes. If p is empty it returns ([RuneError], 0). Otherwise, if
 // the encoding is invalid, it returns (RuneError, 1). Both are impossible
 // results for correct, non-empty UTF-8.
 //
@@ -188,8 +188,8 @@ func DecodeRune(p []byte) (r rune, size int) {
        return rune(p0&mask4)<<18 | rune(b1&maskx)<<12 | rune(b2&maskx)<<6 | rune(b3&maskx), 4
 }
 
-// DecodeRuneInString is like DecodeRune but its input is a string. If s is
-// empty it returns (RuneError, 0). Otherwise, if the encoding is invalid, it
+// DecodeRuneInString is like [DecodeRune] but its input is a string. If s is
+// empty it returns ([RuneError], 0). Otherwise, if the encoding is invalid, it
 // returns (RuneError, 1). Both are impossible results for correct, non-empty
 // UTF-8.
 //
@@ -237,7 +237,7 @@ func DecodeRuneInString(s string) (r rune, size int) {
 }
 
 // DecodeLastRune unpacks the last UTF-8 encoding in p and returns the rune and
-// its width in bytes. If p is empty it returns (RuneError, 0). Otherwise, if
+// its width in bytes. If p is empty it returns ([RuneError], 0). Otherwise, if
 // the encoding is invalid, it returns (RuneError, 1). Both are impossible
 // results for correct, non-empty UTF-8.
 //
@@ -276,8 +276,8 @@ func DecodeLastRune(p []byte) (r rune, size int) {
        return r, size
 }
 
-// DecodeLastRuneInString is like DecodeLastRune but its input is a string. If
-// s is empty it returns (RuneError, 0). Otherwise, if the encoding is invalid,
+// DecodeLastRuneInString is like [DecodeLastRune] but its input is a string. If
+// s is empty it returns ([RuneError], 0). Otherwise, if the encoding is invalid,
 // it returns (RuneError, 1). Both are impossible results for correct,
 // non-empty UTF-8.
 //
@@ -337,7 +337,7 @@ func RuneLen(r rune) int {
 }
 
 // EncodeRune writes into p (which must be large enough) the UTF-8 encoding of the rune.
-// If the rune is out of range, it writes the encoding of RuneError.
+// If the rune is out of range, it writes the encoding of [RuneError].
 // It returns the number of bytes written.
 func EncodeRune(p []byte, r rune) int {
        // Negative values are erroneous. Making it unsigned addresses the problem.
@@ -371,7 +371,7 @@ func EncodeRune(p []byte, r rune) int {
 
 // AppendRune appends the UTF-8 encoding of r to the end of p and
 // returns the extended buffer. If the rune is out of range,
-// it appends the encoding of RuneError.
+// it appends the encoding of [RuneError].
 func AppendRune(p []byte, r rune) []byte {
        // This function is inlineable for fast handling of ASCII.
        if uint32(r) <= rune1Max {
@@ -433,7 +433,7 @@ func RuneCount(p []byte) int {
        return n
 }
 
-// RuneCountInString is like RuneCount but its input is a string.
+// RuneCountInString is like [RuneCount] but its input is a string.
 func RuneCountInString(s string) (n int) {
        ns := len(s)
        for i := 0; i < ns; n++ {