Commit e3a77347 authored by Sam Thorogood's avatar Sam Thorogood Committed by Russ Cox

exp/regexp/syntax: add Prog.NumCap

R=rsc, r
CC=golang-dev
https://golang.org/cl/4662083
parent 4c986d86
......@@ -185,6 +185,10 @@ func (c *compiler) cap(arg uint32) frag {
f := c.inst(InstCapture)
f.out = patchList(f.i << 1)
c.p.Inst[f.i].Arg = arg
if c.p.NumCap < int(arg)+1 {
c.p.NumCap = int(arg) + 1
}
return f
}
......
......@@ -12,6 +12,7 @@ import (
type Prog struct {
Inst []Inst
Start int // index of start instruction
NumCap int // number of InstCapture insts in re
}
// An InstOp is an instruction opcode.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment