本文整理匯總了Golang中io.Writer.restore方法的典型用法代碼示例。如果您正苦於以下問題:Golang Writer.restore方法的具體用法?Golang Writer.restore怎麽用?Golang Writer.restore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.Writer
的用法示例。
在下文中一共展示了Writer.restore方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Compile
//.........這裏部分代碼省略.........
case TypeClass:
ko.cJump(false, "matchClass(%d)", t.Classes[node.String()].Index)
chgok.pos = true
case TypePredicate:
ko.cJump(false, "(%v)", node)
case TypeAction:
w.lnPrint("do(%d)", node.(Action).GetId())
chgok.thPos = true
case TypeCommit:
ko.cJump(false, "(commit(thunkPosition0))")
chgko.thPos = true
case TypeBegin:
if t.Actions != nil {
w.lnPrint("begin = position")
}
case TypeEnd:
if t.Actions != nil {
w.lnPrint("end = position")
}
case TypeAlternate:
list := node.(List)
ok := w.newLabel()
element := list.Front()
if ok.unsafe() {
w.begin()
ok.save()
}
var next *label
for element.Next() != nil {
next = w.newLabel()
cko, _ := updateFlags(compile(element.Value.(Node), next))
ok.jump()
if next.used {
ok.lrestore(next, cko.pos, cko.thPos)
}
element = element.Next()
}
if next == nil || next.used {
updateFlags(compile(element.Value.(Node), ko))
}
if ok.unsafe() {
w.end()
}
if ok.used {
ok.label()
}
case TypeUnorderedAlternate:
list := node.(List)
done, ok := ko, w.newLabel()
w.begin()
done.cJump(true, "position == len(p.Buffer)")
w.lnPrint("switch p.Buffer[position] {")
element := list.Front()
for ; element != nil; element = element.Next() {
sequence := element.Value.(List).Front()
class := sequence.Value.(List).Front().Value.(Node).(Token).GetClass()
node := sequence.Next().Value.(Node)
if element.Next() == nil {
if class.len() > 2 {
w.lnPrint("default:")
w.indent++
updateFlags(compile(node, done))
w.indent--
break
}