mirror of
https://github.com/golang/go
synced 2024-11-19 11:04:47 -07:00
exp/regexp/syntax: add Prog.NumCap
R=rsc, r CC=golang-dev https://golang.org/cl/4662083
This commit is contained in:
parent
4c986d86b1
commit
e3a773479d
@ -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
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,9 @@ import (
|
||||
|
||||
// A Prog is a compiled regular expression program.
|
||||
type Prog struct {
|
||||
Inst []Inst
|
||||
Start int // index of start instruction
|
||||
Inst []Inst
|
||||
Start int // index of start instruction
|
||||
NumCap int // number of InstCapture insts in re
|
||||
}
|
||||
|
||||
// An InstOp is an instruction opcode.
|
||||
|
Loading…
Reference in New Issue
Block a user