本文整理汇总了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)
}
}