本文整理汇总了Golang中github.com/pschlump/lexie/com.DbPrintf函数的典型用法代码示例。如果您正苦于以下问题:Golang DbPrintf函数的具体用法?Golang DbPrintf怎么用?Golang DbPrintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DbPrintf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ParseRe
func (lr *LexReType) ParseRe(ss string) {
com.DbPrintf("db2", "at %s\n", com.LF())
lr.SetBuf(ss)
com.DbPrintf("db2", "at %s\n", com.LF())
lr.parseExpression(0, 0, nil)
com.DbPrintf("db2", "at %s\n", com.LF())
}
开发者ID:pschlump,项目名称:lexie,代码行数:7,代码来源:re.go
示例2: DumpParseNodesChild
//
// What can I see at the top of a RE
//
// LR_Text //
// LR_EOF //
// LR_DOT // . -- Match any char
// LR_STAR // * -- Error if 1st char
// LR_PLUS // + -- Error if 1st char
// LR_QUEST // ? -- Error if 1st char
// LR_B_CCL // [ -- Start of CCL Node
// LR_E_CCL // ]
// LR_OP_PAR // ( -- Start of Sub_Re
// LR_CL_PAR // )
// LR_CCL // [...] -- CCL Node (Above)
// LR_N_CCL // [^...] -- N_CCL Node
// LR_CARROT // ^ -- BOL
// LR_MINUS // - -- Text if not in CCL and not 1st char in CCL
//
// Item string
// LR_Tok LR_TokType
// Children []*ReTreeNodeType
// Next *ReTreeNodeType
//
func (lr *LexReType) DumpParseNodesChild(ch []ReTreeNodeType, d int) {
com.DbPrintf("DumpParseNodes", "\n%sDumpParseNodesChild: At %s\n", N4Blanks(d), com.LF())
for ii, vv := range ch {
com.DbPrintf("DumpParseNodes", "%sat %s [step %d] ", N4Blanks(d), com.LF(), ii)
com.DbPrintf("DumpParseNodes", "Item: [%s] %d=%s, N-Children=%d\n", vv.Item, vv.LR_Tok, NameOfLR_TokType(vv.LR_Tok), len(vv.Children))
if len(vv.Children) > 0 {
lr.DumpParseNodesChild(vv.Children, d+1)
}
}
com.DbPrintf("DumpParseNodes", "%sDumpParseNodesChild: Done %s\n\n", N4Blanks(d), com.LF())
}
开发者ID:pschlump,项目名称:lexie,代码行数:34,代码来源:re.go
示例3: ReplaceToken
// dfa.TokList.ReplaceToken ( dfa.MTab.Machine[ctx.St].Info.MatchLength, dfa.MTab.Machine[ctx.St].Info.ReplStr )
func (tl *TokenList) ReplaceToken(l int, s string) {
ii := len(tl.TL) - 1
lv := len(tl.TL[ii].AToken.Val)
tl.TL[ii].AToken.IsRepl = true
tl.TL[ii].AToken.ReplStr = s
if lv-l >= 1 {
tl.TL[ii].AToken.Val = tl.TL[ii].AToken.Val[0:lv-l] + s
} else {
com.DbPrintf("db_tok01", "Error: ReplaceToken has invalid data, %s\n", com.LF())
}
com.DbPrintf("db_tok01", "ReplaceToken: Match: ->%s<- Val: ->%s<-\n", tl.TL[ii].AToken.Match, tl.TL[ii].AToken.Val)
}
开发者ID:pschlump,项目名称:lexie,代码行数:13,代码来源:tok.go
示例4: DumpParseNodes
func (lr *LexReType) DumpParseNodes() {
com.DbPrintf("DumpParseNodes", "\nDumpParseNodes: At %s\n", com.LF())
for ii, vv := range lr.Tree.Children {
com.DbPrintf("DumpParseNodes", "at %s [step %d] ", com.LF(), ii)
com.DbPrintf("DumpParseNodes", "Item: [%s] %d=%s, N-Children=%d\n", vv.Item, vv.LR_Tok, NameOfLR_TokType(vv.LR_Tok), len(vv.Children))
if len(vv.Children) > 0 {
lr.DumpParseNodesChild(vv.Children, 1)
}
}
com.DbPrintf("DumpParseNodes", "DumpParseNodes: Done %s\n\n", com.LF())
com.DbPrintf("DumpParseNodesX", "DumpParseNodes: %s\n\n", com.SVarI(lr.Tree))
}
开发者ID:pschlump,项目名称:lexie,代码行数:12,代码来源:re.go
示例5: OutputActionFlags
func (lex *Lexie) OutputActionFlags(dfa *DFA_PoolType) {
com.DbPrintf("match", "Action Flags Are:\n")
// com. ConvertActionFlagToString(kk int) (rv string) {
dn := make(map[int]bool)
for _, vv := range dfa.Pool {
if vv.IsUsed {
if vv.Info.Action != 0 {
if _, ok := dn[vv.Info.Action]; !ok {
com.DbPrintf("match", " %2x: %s\n", vv.Info.Action, com.ConvertActionFlagToString(vv.Info.Action))
dn[vv.Info.Action] = true
}
}
}
}
}
开发者ID:pschlump,项目名称:lexie,代码行数:15,代码来源:match.go
示例6: GetPos
// Get the current line/col no and file name
func (pb *PBReadType) GetPos() (LineNo int, ColNo int, FileName string) {
com.DbPrintf("pbbuf02", "At: %s\n", com.LF())
if len(pb.PbBuffer) > 0 {
com.DbPrintf("pbbuf02", "From Buffer At: %s\n", com.LF())
LineNo = pb.PbBuffer[0].LineNo
ColNo = pb.PbBuffer[0].ColNo
FileName = pb.PbBuffer[0].FileName
} else {
com.DbPrintf("pbbuf02", "Not set At: %s\n", com.LF())
LineNo = 1
ColNo = 1
FileName = ""
}
return
}
开发者ID:pschlump,项目名称:lexie,代码行数:16,代码来源:pbread.go
示例7: OpenFile
// Open a file - this puts the file at the end of the input. This is used on the command line for a list of files
// in order. Each opened and added to the end of the list.
func (pb *PBReadType) OpenFile(fn string) (err error) {
com.DbPrintf("pbbuf01", "At: %s\n", com.LF())
pb.FileName = fn
pb.AbsFileName, _ = filepath.Abs(fn)
pb.FilesOpened[pb.AbsFileName] = true
// read file -> PbBuffer
b := &ABuffer{
FileName: fn,
AbsFileName: pb.AbsFileName,
LineNo: 1,
ColNo: 1,
}
pb.PbBuffer = append(pb.PbBuffer, b)
bb, err := ioutil.ReadFile(fn)
if err != nil {
return
}
b.EofOnFile = true
b.Pos = 0
var rn rune
var sz int
b.Buffer = make([]rune, 0, len(bb))
for ii := 0; ii < len(bb); ii += sz {
rn, sz = utf8.DecodeRune(bb[ii:])
b.Buffer = append(b.Buffer, rn)
}
return nil
}
开发者ID:pschlump,项目名称:lexie,代码行数:33,代码来源:pbread.go
示例8: NextRune
// Return the next rune. If runes have been pushed back then use those first.
func (pb *PBReadType) NextRune() (rn rune, done bool) {
com.DbPrintf("pbbuf01", "At: %s\n", com.LF())
done = false
if pb.PbTop > 0 {
pb.PbTop--
rn = pb.PbAFew[pb.PbTop]
} else if len(pb.PbBuffer) <= 0 {
done = true
// } else if len(pb.PbBuffer) == 1 && pb.PbBuffer[0].Pos >= len(pb.PbBuffer[0].Buffer) && !pb.PbBuffer[0].EofOnFile {
// Xyzzy - read in more form file - append
// so far case never happens because EofOnFile is constant true at init time.
} else if len(pb.PbBuffer) == 1 && pb.PbBuffer[0].Pos >= len(pb.PbBuffer[0].Buffer) && pb.PbBuffer[0].EofOnFile {
done = true
} else if len(pb.PbBuffer) > 1 && pb.PbBuffer[0].Pos >= len(pb.PbBuffer[0].Buffer) && pb.PbBuffer[0].EofOnFile {
pb.PbBuffer = pb.PbBuffer[1:]
return pb.NextRune()
} else {
//fmt.Printf("Just before core, Pos=%d\n", pb.PbBuffer[0].Pos)
//fmt.Printf("Just before core, Len 1=%d\n", len(pb.PbBuffer[0].Buffer))
if pb.PbBuffer[0].Pos >= len(pb.PbBuffer[0].Buffer) { // xyzzy --------------------- pjs - new code - not certain if correct ---------------------------------
done = true
} else {
rn = pb.PbBuffer[0].Buffer[pb.PbBuffer[0].Pos]
pb.PbBuffer[0].Pos++
if rn == '\n' {
pb.PbBuffer[0].LineNo++
pb.PbBuffer[0].ColNo = 1
} else {
pb.PbBuffer[0].ColNo++
}
}
}
return
}
开发者ID:pschlump,项目名称:lexie,代码行数:36,代码来源:pbread.go
示例9: FileSeen
// Have we already seen the specified file. Useful for require(fn)
func (pb *PBReadType) FileSeen(fn string) bool {
com.DbPrintf("pbbuf01", "At: %s\n", com.LF())
a, _ := filepath.Abs(fn)
if t, ok := pb.FilesOpened[a]; ok && t {
return true
}
return false
}
开发者ID:pschlump,项目名称:lexie,代码行数:9,代码来源:pbread.go
示例10: SetPos
// Set the line/col/file-name for the current buffer - Useful for constructing something like C/Pre processor's #line
func (pb *PBReadType) SetPos(LineNo int, ColNo int, FileName string) {
com.DbPrintf("pbbuf01", "At: %s\n", com.LF())
pb.pushbackIntoBuffer()
if len(pb.PbBuffer) > 0 {
pb.PbBuffer[0].LineNo = LineNo
pb.PbBuffer[0].ColNo = ColNo
pb.PbBuffer[0].FileName = FileName
}
return
}
开发者ID:pschlump,项目名称:lexie,代码行数:11,代码来源:pbread.go
示例11: PbRune
// Push back a single rune onto input. You can call this more than one time.
func (pb *PBReadType) PbRune(rn rune) {
com.DbPrintf("pbbuf01", "At: %s\n", com.LF())
if pb.PbTop >= MaxAFew { // Buffer is full
pb.pushbackIntoBuffer()
}
pb.PbAFew[pb.PbTop] = rn
pb.PbTop++
}
开发者ID:pschlump,项目名称:lexie,代码行数:11,代码来源:pbread.go
示例12: PbByteArray
// Push back a string. Will be converted from an array of byte to an array of runes.
func (pb *PBReadType) PbByteArray(s []byte) {
com.DbPrintf("pbbuf01", "At: %s\n", com.LF())
rns := make([]rune, 0, len(s))
var rn rune
var sz int
for ii := 0; ii < len(s); ii += sz {
rn, sz = utf8.DecodeRune(s[ii:])
rns = append(rns, rn)
}
pb.PbRuneArray(rns)
}
开发者ID:pschlump,项目名称:lexie,代码行数:12,代码来源:pbread.go
示例13: ParsePlist
func ParsePlist(pl string) (aa []string) {
t1 := pl_re.FindAllStringSubmatch(pl, -1)
if t1 != nil {
com.DbPrintf("in", "t1=%s\n", com.SVarI(t1))
for _, vv := range t1 {
if len(vv) > 3 && vv[2] != "" {
aa = append(aa, vv[2])
}
}
}
return
}
开发者ID:pschlump,项目名称:lexie,代码行数:12,代码来源:in.go
示例14: MapRune
// Map an input rune to one of the possible output subscripts
func (smap *SMapType) MapRune(rn rune) int {
x := int(rn) - smap.MinV
// fmt.Printf("x=%d, rn=%04x ( %s ), %s\n", x, rn, string(rn), com.LF())
if x > smap.MaxV {
// fmt.Printf("At %s\n", com.LF())
if y, ok := smap.M1[rn]; ok {
// fmt.Printf("At %s\n", com.LF())
return y
}
// fmt.Printf("At %s\n", com.LF())
return smap.NoMapTo
} else if x >= 0 {
com.DbPrintf("smap", "********************************** this one **************************, %s\n", string(rn))
v := smap.M0[x]
if v == smap.NoMapTo {
com.DbPrintf("smap", "********************************** No MAP - 28 case \n")
if unicode.IsDigit(rn) {
if y, ok := smap.M1[re.R_NUMERIC]; ok {
com.DbPrintf("smap", "********************************** case - numeric \n")
return y
}
} else if unicode.IsUpper(rn) {
if y, ok := smap.M1[re.R_UPPER]; ok {
com.DbPrintf("smap", "********************************** case - upper\n")
return y
}
} else if unicode.IsLower(rn) {
if y, ok := smap.M1[re.R_LOWER]; ok {
com.DbPrintf("smap", "********************************** case - lower\n")
return y
}
}
}
// fmt.Printf("At %s\n", com.LF())
return v
} else {
// fmt.Printf("At %s\n", com.LF())
return smap.NoMapTo
}
}
开发者ID:pschlump,项目名称:lexie,代码行数:41,代码来源:map-string.go
示例15: ParseNameValue
// Tok_Name=1 Tok_Name "T O K"
func ParseNameValue(nv string) (name string, value string) {
name, value = "", ""
t1 := pnv_re.FindAllStringSubmatch(nv, -1)
com.DbPrintf("in", "t1=%s\n", com.SVarI(t1))
if t1 != nil && len(t1[0]) > 0 {
name = t1[0][1]
if len(t1[0]) > 3 {
value = t1[0][3]
}
} else {
name = nv
}
return
}
开发者ID:pschlump,项目名称:lexie,代码行数:15,代码来源:in.go
示例16: ParseActionItem
// Rv(Name) Ignore(Xxx)
func ParseActionItem(act string) (aa string, pp string) {
aa, pp = "", ""
t1 := fx_re.FindAllStringSubmatch(act, -1)
if t1 != nil {
com.DbPrintf("in", "t1=%s\n", com.SVarI(t1))
aa = t1[0][1]
if len(t1[0]) > 1 {
pp = t1[0][2]
}
} else {
aa = act
}
return
}
开发者ID:pschlump,项目名称:lexie,代码行数:15,代码来源:in.go
示例17: LocatePattern
// -----------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------
//type ImRuleType struct {
// PatternType int // Pattern, Str0,1,2, $eof etc. // Pattern Stuff --------------------------------------------------------------------------------
// Pattern string //
func (Im *ImType) LocatePattern(ff *ImRuleType, in []*ImRuleType) (rv int) {
rv = -1
// fmt.Printf("LocatePattern for %s %d\n", ff.Pattern, ff.PatternType)
for kk, tt := range in {
// fmt.Printf(" Compare to %s %d\n", tt.Pattern, tt.PatternType)
if tt.PatternType == ff.PatternType && tt.Pattern == ff.Pattern {
com.DbPrintf("in", " Found\n")
return kk
}
}
// fmt.Printf(" NOT NOT NOT Found\n")
// Xyzzy - should add an error at this point?
// 2. Errors about missing machines in mixin not reported at all - see xyzzyMixin01
return
}
开发者ID:pschlump,项目名称:lexie,代码行数:20,代码来源:in.go
示例18: SaveDef
// -----------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------
func (Im *ImType) SaveDef(DefType string, Defs []string, line_no int, file_name string) {
if validateDefType(DefType) {
for _, nm := range Defs {
dd, ok := Im.Def.DefsAre[DefType]
if !ok {
dd = ImDefinedValueType{
Seq: 1,
WhoAmI: DefType,
NameValue: make(map[string]int),
NameValueStr: make(map[string]string),
Reverse: make(map[int]string),
SeenAt: make(map[string]ImSeenAtType),
}
}
// seq := dd.Seq
n, v := ParseNameValue(nm)
if n == "" && v == "" { // xyzzy100
return
}
com.DbPrintf("in", "Input: ->%s<- n >%s< v >%s<\n", nm, n, v)
if v != "" {
dd.NameValue[n] = -2 // //
if vv, ok1 := dd.NameValueStr[n]; !ok1 {
dd.NameValueStr[n] = v // //
} else {
if vv != v {
fmt.Printf("Error: Attempt to redfine %s from %s to %s - Probably an error\n", n, vv, v)
}
}
} else {
dd.NameValue[n] = -1 // //
if _, ok1 := dd.NameValueStr[n]; !ok1 {
dd.NameValueStr[n] = "" // //
}
}
// dd.Seq = seq + 1
sa := dd.SeenAt[n]
sa.LineNo = append(sa.LineNo, line_no)
sa.FileName = append(sa.FileName, file_name)
dd.SeenAt[n] = sa
Im.Def.DefsAre[DefType] = dd
}
}
// fmt.Printf("It Is:%+v\n", Im)
}
开发者ID:pschlump,项目名称:lexie,代码行数:47,代码来源:in.go
示例19: PbFile
// Place the contents of a file in buffers at the head so NextRune will pull from this next.
func (pb *PBReadType) PbFile(fn string) (err error) {
com.DbPrintf("pbbuf01", "At: %s\n", com.LF())
err = nil
pb.pushbackIntoBuffer()
pb.FileName = fn
pb.AbsFileName, _ = filepath.Abs(fn)
pb.FilesOpened[pb.AbsFileName] = true
// read file -> PbBuffer
b := &ABuffer{
FileName: fn,
AbsFileName: pb.AbsFileName,
LineNo: 1,
ColNo: 1,
}
// pb.PbBuffer = append(pb.PbBuffer, b)
// data = append([]string{"Prepend Item"}, data...)
pb.PbBuffer = append([]*ABuffer{b}, pb.PbBuffer...) // prepend
bb, err := ioutil.ReadFile(fn)
if err != nil {
return
}
b.EofOnFile = true
b.Pos = 0
var rn rune
var sz int
b.Buffer = make([]rune, 0, len(bb))
for ii := 0; ii < len(bb); ii += sz {
rn, sz = utf8.DecodeRune(bb[ii:])
b.Buffer = append(b.Buffer, rn)
}
return
}
开发者ID:pschlump,项目名称:lexie,代码行数:38,代码来源:pbread.go
示例20: DumpPool
func (dfa *DFA_PoolType) DumpPool(all bool) {
if all {
com.DbPrintf("db_DumpDFAPool", "Cur: %d Top: %d NextFree %d\n", dfa.Cur, dfa.Top, dfa.NextFree)
}
com.DbPrintf("db_DumpDFAPool", "\n---------------------------- DFA Output -----------------------------------------------\n")
com.DbPrintf("db_DumpDFAPool", "\nDFA InitState: %d, Sigma ->%s<-\n\n", dfa.InitState, dfa.Sigma)
pLnNo := com.DbOn("db_DFA_LnNo")
IfLnNo := func(s string) string {
if pLnNo {
t := fmt.Sprintf("[%3s]", s)
return t
}
return ""
}
com.DbPrintf("db_DumpDFAPool", "%3s%s: ", "St", IfLnNo("/Ln"))
com.DbPrintf("db_DumpDFAPool", " %12s %12s \u2714 \tEdges", "StateName", "StateSet")
com.DbPrintf("db_DumpDFAPool", "\n\n")
for ii, vv := range dfa.Pool {
if all || vv.IsUsed {
com.DbPrintf("db_DumpDFAPool", "%3d%s: ", ii, IfLnNo(vv.LineNo))
com.DbPrintf("db_DumpDFAPool", " %12s %12s %s :", vv.StateName, com.SVar(vv.StateSet), com.ChkOrBlank(vv.Visited))
if vv.Rv > 0 {
if vv.Is0Ch {
com.DbPrintf("db_DumpDFAPool", " \u03c4:Tau:%04d ", vv.Rv)
} else {
com.DbPrintf("db_DumpDFAPool", " T:%04d ", vv.Rv)
}
} else {
com.DbPrintf("db_DumpDFAPool", " ")
}
if com.DbOn("db_DumpDFAPool") {
fmt.Printf("\t E:")
for _, ww := range vv.Next2 {
if ww.Is0ChMatch {
fmt.Printf("//Found \u03c4 (%s) //", com.LF()) // Show a Tau(t) for a lambda that matchiens on else conditions.
}
if ww.IsLambda {
fmt.Printf("{ ERROR!! \u03bb %2d -> %2d %s} ", ww.From, ww.To, ww.LineNo)
} else {
// fmt.Printf("{ \"%s\" %2d -> %2d %s} ", ww.On, ww.From, ww.To, IfLnNo(ww.LineNo))
on, _ := utf8.DecodeRune([]byte(ww.On))
son := fmt.Sprintf("%q", ww.On)
switch on {
case re.R_DOT: // = '\uF8FA' // Any char in Sigma
son = "DOT/uF8FA"
case re.R_BOL: // = '\uF8F3' // Beginning of line
son = "BOL/uF8F3"
case re.R_EOL: // = '\uF8F4' // End of line
son = "EOL/uF8F4"
case re.R_NUMERIC: // = '\uF8F5'
son = "NUMERIC/uF8F5"
case re.R_LOWER: // = '\uF8F6'
son = "LOWER/uF8F6"
case re.R_UPPER: // = '\uF8F7'
son = "UPPER/uF8F7"
case re.R_ALPHA: // = '\uF8F8'
son = "ALPHA/uF8F8"
case re.R_ALPHNUM: // = '\uF8F9'
son = "ALPHANUM/uF8F9"
case re.R_EOF: // = '\uF8FB'
son = "EOF/uF8FB"
case re.R_not_CH: // = '\uF8FC' // On input lookup if the char is NOT in Signa then it is returned as this.
son = "else_CH/uF8Fc"
case re.R_N_CCL: // = '\uF8FD' // If char is not matched in this state then take this path
son = "N_CCL/uF8Fd"
case re.R_LAMBDA_MATCH: // = '\uF8FE'
son = "LambdaM/uF8FE"
}
fmt.Printf("{ %s %2d -> %2d %s} ", son, ww.From, ww.To, IfLnNo(ww.LineNo))
}
}
fmt.Printf("\n")
if vv.Info.Action != 0 || vv.Info.MatchLength != 0 {
// fmt.Printf("\t\t\tInfo: %s\n", com.SVar(vv.Info)) // xyzzy - output Info
// xyzzy - NextState info
fmt.Printf("\t\t\tDFA.Info: %s", nfa.DumpInfo(vv.Info))
// if ((vv.Info.Action&com.A_Pop) != 0 || (vv.Info.Action&com.A_Push) != 0 || (vv.Info.Action&com.A_Reset) != 0) && !vv.Info.HardMatch { // xyzzy8
fmt.Printf(" IsHard=%v (((false imples else case Rv!)))\n", vv.Info.HardMatch)
}
fmt.Printf("\n")
}
}
}
}
开发者ID:pschlump,项目名称:lexie,代码行数:84,代码来源:dfa.go
注:本文中的github.com/pschlump/lexie/com.DbPrintf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论