本文整理匯總了Golang中io.Writer.saveBlock方法的典型用法代碼示例。如果您正苦於以下問題:Golang Writer.saveBlock方法的具體用法?Golang Writer.saveBlock怎麽用?Golang Writer.saveBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.Writer
的用法示例。
在下文中一共展示了Writer.saveBlock方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Compile
//.........這裏部分代碼省略.........
w.lnPrint("case %s:", strings.Join(cs, ", "))
w.indent++
ko.jump()
w.indent--
w.lnPrint("default:")
w.indent++
if peek == TypeDot {
w.lnPrint("position++")
chgok.pos = true
}
}
for element := element0; element != nil; element = element.Next() {
cko, cok := compile(element.Value.(Node), ko)
if element.Next() == nil {
if chgok.pos {
cko.pos = true
}
if chgok.thPos {
cko.thPos = true
}
}
updateFlags(cko, cok)
}
if peek != 0 {
w.indent--
w.lnPrint("}")
}
case TypePeekFor:
sub := node.(List).Front().Value.(Node)
if canCompilePeek(sub, false, ko) {
return
}
l := w.newLabel()
l.saveBlock()
cko, cok := compile(sub, ko)
l.lrestore(nil, cok.pos, cok.thPos)
chgko = cko
case TypePeekNot:
sub := node.(List).Front().Value.(Node)
if canCompilePeek(sub, true, ko) {
return
}
ok := w.newLabel()
ok.saveBlock()
cko, cok := compile(sub, ok)
ko.jump()
if ok.used {
ok.restore(cko.pos, cko.thPos)
}
chgko = cok
case TypeQuery:
sub := node.(List).Front().Value.(Node)
switch sub.GetType() {
case TypeCharacter:
w.lnPrint("matchChar('%v')", sub)
chgok.pos = true
return
case TypeDot:
w.lnPrint("matchDot()")
chgok.pos = true
return
}
qko := w.newLabel()
qok := w.newLabel()
qko.saveBlock()
cko, cok := compile(sub, qko)