MCPcopy Create free account
hub / github.com/google/codesearch / appendRange

Function appendRange

regexp/copy.go:52–74  ·  view source on GitHub ↗

appendRange returns the result of appending the range lo-hi to the class r.

(r []rune, lo, hi rune)

Source from the content-addressed store, hash-verified

50
51// appendRange returns the result of appending the range lo-hi to the class r.
52func appendRange(r []rune, lo, hi rune) []rune {
53 // Expand last range or next to last range if it overlaps or abuts.
54 // Checking two ranges helps when appending case-folded
55 // alphabets, so that one range can be expanding A-Z and the
56 // other expanding a-z.
57 n := len(r)
58 for i := 2; i <= 4; i += 2 { // twice, using i=2, i=4
59 if n >= i {
60 rlo, rhi := r[n-i], r[n-i+1]
61 if lo <= rhi+1 && rlo <= hi+1 {
62 if lo < rlo {
63 r[n-i] = lo
64 }
65 if hi > rhi {
66 r[n-i+1] = hi
67 }
68 return r
69 }
70 }
71 }
72
73 return append(r, lo, hi)
74}
75
76const (
77 // minimum and maximum runes involved in folding.

Callers 1

appendFoldedRangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…