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

Method init

regexp/match.go:128–145  ·  view source on GitHub ↗

init initializes the matcher.

(prog *syntax.Prog)

Source from the content-addressed store, hash-verified

126
127// init initializes the matcher.
128func (m *matcher) init(prog *syntax.Prog) error {
129 m.prog = prog
130 m.dstate = make(map[string]*dstate)
131
132 m.z1.q.Init(uint32(len(prog.Inst)))
133 m.z2.q.Init(uint32(len(prog.Inst)))
134
135 m.addq(&m.z1.q, uint32(prog.Start), syntax.EmptyBeginLine|syntax.EmptyBeginText)
136 m.z1.flag = flagBOL | flagBOT
137 m.start = m.cache(&m.z1)
138
139 m.z1.q.Reset()
140 m.addq(&m.z1.q, uint32(prog.Start), syntax.EmptyBeginLine)
141 m.z1.flag = flagBOL
142 m.startLine = m.cache(&m.z1)
143
144 return nil
145}
146
147// stepEmpty steps runq to nextq expanding according to flag.
148func (m *matcher) stepEmpty(runq, nextq *sparse.Set, flag syntax.EmptyOp) {

Callers 1

CompileFunction · 0.45

Calls 4

addqMethod · 0.95
cacheMethod · 0.95
InitMethod · 0.80
ResetMethod · 0.80

Tested by

no test coverage detected