MCPcopy Create free account
hub / github.com/dlclark/regexp2 / opcodeSize

Function opcodeSize

syntax/code.go:188–207  ·  view source on GitHub ↗
(op InstOp)

Source from the content-addressed store, hash-verified

186}
187
188func opcodeSize(op InstOp) int {
189 op &= Mask
190
191 switch op {
192 case Nothing, Bol, Eol, Boundary, Nonboundary, ECMABoundary, NonECMABoundary, Beginning, Start, EndZ,
193 End, Nullmark, Setmark, Getmark, Setjump, Backjump, Forejump, Stop, UpdateBumpalong:
194 return 1
195
196 case One, Notone, Multi, Ref, Testref, Goto, Nullcount, Setcount, Lazybranch, Branchmark, Lazybranchmark,
197 Prune, Set:
198 return 2
199
200 case Capturemark, Branchcount, Lazybranchcount, Onerep, Notonerep, Oneloop, Notoneloop, Onelazy, Notonelazy,
201 Setlazy, Setrep, Setloop, Oneloopatomic, Notoneloopatomic, Setloopatomic:
202 return 3
203
204 default:
205 panic(fmt.Errorf("unexpected op code: %v", op))
206 }
207}
208
209var codeStr = []string{
210 "Onerep", "Notonerep", "Setrep",

Callers 2

captureSlotsInUseFunction · 0.85
DumpMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected