本文整理匯總了Golang中code/google/com/p/codesearch/sparse.Set類的典型用法代碼示例。如果您正苦於以下問題:Golang Set類的具體用法?Golang Set怎麽用?Golang Set使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Set類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: stepByte
// stepByte steps runq to nextq consuming c and then expanding according to flag.
// It returns true if a match ends immediately before c.
// c is either an input byte or endText.
func (m *matcher) stepByte(runq, nextq *sparse.Set, c int, flag syntax.EmptyOp) (match bool) {
nextq.Reset()
m.addq(nextq, uint32(m.prog.Start), flag)
for _, id := range runq.Dense() {
i := &m.prog.Inst[id]
switch i.Op {
default:
continue
case syntax.InstMatch:
match = true
continue
case instByteRange:
if c == endText {
break
}
lo := int((i.Arg >> 8) & 0xFF)
hi := int(i.Arg & 0xFF)
ch := c
if i.Arg&argFold != 0 && 'a' <= ch && ch <= 'z' {
ch += 'A' - 'a'
}
if lo <= ch && ch <= hi {
m.addq(nextq, i.Out, flag)
}
}
}
return
}
示例2: addq
// addq adds id to the queue, expanding according to flag.
func (m *matcher) addq(q *sparse.Set, id uint32, flag syntax.EmptyOp) {
if q.Has(id) {
return
}
q.Add(id)
i := &m.prog.Inst[id]
switch i.Op {
case syntax.InstCapture, syntax.InstNop:
m.addq(q, i.Out, flag)
case syntax.InstAlt, syntax.InstAltMatch:
m.addq(q, i.Out, flag)
m.addq(q, i.Arg, flag)
case syntax.InstEmptyWidth:
if syntax.EmptyOp(i.Arg)&^flag == 0 {
m.addq(q, i.Out, flag)
}
}
}
示例3: stepEmpty
// stepEmpty steps runq to nextq expanding according to flag.
func (m *matcher) stepEmpty(runq, nextq *sparse.Set, flag syntax.EmptyOp) {
nextq.Reset()
for _, id := range runq.Dense() {
m.addq(nextq, id, flag)
}
}