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

Function dumpInst

regexp/copy.go:182–223  ·  view source on GitHub ↗
(b *bytes.Buffer, i *syntax.Inst)

Source from the content-addressed store, hash-verified

180}
181
182func dumpInst(b *bytes.Buffer, i *syntax.Inst) {
183 switch i.Op {
184 case syntax.InstAlt:
185 bw(b, "alt -> ", u32(i.Out), ", ", u32(i.Arg))
186 case syntax.InstAltMatch:
187 bw(b, "altmatch -> ", u32(i.Out), ", ", u32(i.Arg))
188 case syntax.InstCapture:
189 bw(b, "cap ", u32(i.Arg), " -> ", u32(i.Out))
190 case syntax.InstEmptyWidth:
191 bw(b, "empty ", u32(i.Arg), " -> ", u32(i.Out))
192 case syntax.InstMatch:
193 bw(b, "match")
194 case syntax.InstFail:
195 bw(b, "fail")
196 case syntax.InstNop:
197 bw(b, "nop -> ", u32(i.Out))
198 case instByteRange:
199 fmt.Fprintf(b, "byte %02x-%02x", (i.Arg>>8)&0xFF, i.Arg&0xFF)
200 if i.Arg&argFold != 0 {
201 bw(b, "/i")
202 }
203 bw(b, " -> ", u32(i.Out))
204
205 // Should not happen
206 case syntax.InstRune:
207 if i.Rune == nil {
208 // shouldn't happen
209 bw(b, "rune <nil>")
210 }
211 bw(b, "rune ", strconv.QuoteToASCII(string(i.Rune)))
212 if syntax.Flags(i.Arg)&syntax.FoldCase != 0 {
213 bw(b, "/i")
214 }
215 bw(b, " -> ", u32(i.Out))
216 case syntax.InstRune1:
217 bw(b, "rune1 ", strconv.QuoteToASCII(string(i.Rune)), " -> ", u32(i.Out))
218 case syntax.InstRuneAny:
219 bw(b, "any -> ", u32(i.Out))
220 case syntax.InstRuneAnyNotNL:
221 bw(b, "anynotnl -> ", u32(i.Out))
222 }
223}

Callers 2

instStringFunction · 0.85
dumpProgFunction · 0.85

Calls 2

bwFunction · 0.85
u32Function · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…