当前位置: 首页>>代码示例>>Golang>>正文


Golang com.DbPrintf函数代码示例

本文整理汇总了Golang中github.com/pschlump/lexie/com.DbPrintf函数的典型用法代码示例。如果您正苦于以下问题:Golang DbPrintf函数的具体用法?Golang DbPrintf怎么用?Golang DbPrintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DbPrintf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的github.com/pschlump/lexie/com.DbPrintf函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。