Home | History | Annotate | Download | only in path

Lines Matching refs:chunk

42 		var chunk string
43 star, chunk, pattern = scanChunk(pattern)
44 if star && chunk == "" {
49 t, ok, err := matchChunk(chunk, name)
50 // if we're the last chunk, make sure we've exhausted the name
64 t, ok, err := matchChunk(chunk, name[i+1:])
66 // if we're the last chunk, make sure we exhausted the name
85 func scanChunk(pattern string) (star bool, chunk, rest string) {
113 // matchChunk checks whether chunk matches the beginning of s.
115 // Chunk is all single-character operators: literals, char classes, and ?.
116 func matchChunk(chunk, s string) (rest string, ok bool, err error) {
117 for len(chunk) > 0 {
121 switch chunk[0] {
126 chunk = chunk[1:]
129 if len(chunk) > 0 && chunk[0] == '^' {
131 chunk = chunk[1:]
137 if len(chunk) > 0 && chunk[0] == ']' && nrange > 0 {
138 chunk = chunk[1:]
142 if lo, chunk, err = getEsc(chunk); err != nil {
146 if chunk[0] == '-' {
147 if hi, chunk, err = getEsc(chunk[1:]); err != nil {
166 chunk = chunk[1:]
169 chunk = chunk[1:]
170 if len(chunk) == 0 {
177 if chunk[0] != s[0] {
181 chunk = chunk[1:]
187 // getEsc gets a possibly-escaped character from chunk, for a character class.
188 func getEsc(chunk string) (r rune, nchunk string, err error) {
189 if len(chunk) == 0 || chunk[0] == '-' || chunk[0] == ']' {
193 if chunk[0] == '\\' {
194 chunk = chunk[1:]
195 if len(chunk) == 0 {
200 r, n := utf8.DecodeRuneInString(chunk)
204 nchunk = chunk[n:]