MCPcopy Index your code
hub / github.com/google/codesearch / stepByte

Method stepByte

regexp/match.go:158–185  ·  view source on GitHub ↗

stepByte steps runq to nextq consuming c and then expanding according to flag. It returns true if a match ends immediately before c. c is either an input byte or endText.

(runq, nextq *sparse.Set, c int, flag syntax.EmptyOp)

Source from the content-addressed store, hash-verified

156// It returns true if a match ends immediately before c.
157// c is either an input byte or endText.
158func (m *matcher) stepByte(runq, nextq *sparse.Set, c int, flag syntax.EmptyOp) (match bool) {
159 nextq.Reset()
160 m.addq(nextq, uint32(m.prog.Start), flag)
161 for _, id := range runq.Dense() {
162 i := &m.prog.Inst[id]
163 switch i.Op {
164 default:
165 continue
166 case syntax.InstMatch:
167 match = true
168 continue
169 case instByteRange:
170 if c == endText {
171 break
172 }
173 lo := int((i.Arg >> 8) & 0xFF)
174 hi := int(i.Arg & 0xFF)
175 ch := c
176 if i.Arg&argFold != 0 && 'a' <= ch && ch <= 'z' {
177 ch += 'A' - 'a'
178 }
179 if lo <= ch && ch <= hi {
180 m.addq(nextq, i.Out, flag)
181 }
182 }
183 }
184 return
185}
186
187// addq adds id to the queue, expanding according to flag.
188func (m *matcher) addq(q *sparse.Set, id uint32, flag syntax.EmptyOp) {

Callers 1

computeNextMethod · 0.95

Calls 3

addqMethod · 0.95
ResetMethod · 0.80
DenseMethod · 0.80

Tested by

no test coverage detected