本文整理汇总了Golang中github.com/araddon/qlbridge/lex.Lexer.SkipWhiteSpaces方法的典型用法代码示例。如果您正苦于以下问题:Golang Lexer.SkipWhiteSpaces方法的具体用法?Golang Lexer.SkipWhiteSpaces怎么用?Golang Lexer.SkipWhiteSpaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/araddon/qlbridge/lex.Lexer
的用法示例。
在下文中一共展示了Lexer.SkipWhiteSpaces方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: LexMaybe
// Custom lexer for our maybe hash function
//
// SUBSCRIBE
// valuect(item) AS stuff
// FROM maybe(stuff)
// WHERE x = y
//
func LexMaybe(l *lex.Lexer) lex.StateFn {
l.SkipWhiteSpaces()
keyWord := strings.ToLower(l.PeekWord())
switch keyWord {
case "maybe":
l.ConsumeWord("maybe")
l.Emit(lex.TokenIdentity)
return lex.LexExpressionOrIdentity
}
return lex.LexExpressionOrIdentity
}
示例2: LexInfluxName
// lex value
//
// SIMPLE_NAME_VALUE | TABLE_NAME_VALUE | REGEX_VALUE
func LexInfluxName(l *lex.Lexer) lex.StateFn {
l.SkipWhiteSpaces()
firstChar := l.Peek()
u.Debugf("LexInfluxName: %v", string(firstChar))
switch firstChar {
case '"':
return lex.LexValue(l)
case '/':
// a regex
return lex.LexRegex(l)
}
return lex.LexIdentifier
}
示例3: LexColumnsInflux
// Handle influx columns
// SELECT
// valuect(item) AS stuff SHORTDESC "stuff" KIND INT
//
// Examples:
//
// (colx = y OR colb = b)
// cola = 'a5'p
// cola != "a5", colb = "a6"
// REPLACE(cola,"stuff") != "hello"
// FirstName = REPLACE(LOWER(name," "))
// cola IN (1,2,3)
// cola LIKE "abc"
// eq(name,"bob") AND age > 5
//
func LexColumnsInflux(l *lex.Lexer) lex.StateFn {
l.SkipWhiteSpaces()
keyWord := strings.ToLower(l.PeekWord())
u.Debugf("LexColumnsInflux r= '%v'", string(keyWord))
switch keyWord {
case "if":
l.ConsumeWord("if")
l.Emit(lex.TokenIf)
l.Push("LexColumnsInflux", LexColumnsInflux)
return lex.LexColumns
case "shortdesc":
l.ConsumeWord("shortdesc")
l.Emit(TokenShortDesc)
l.Push("LexColumnsInflux", LexColumnsInflux)
l.Push("lexIdentifier", lex.LexValue)
return nil
case "longdesc":
l.ConsumeWord("longdesc")
l.Emit(TokenLongDesc)
l.Push("LexColumnsInflux", LexColumnsInflux)
l.Push("lexIdentifier", lex.LexValue)
return nil
case "kind":
l.ConsumeWord("kind")
l.Emit(TokenKind)
l.Push("LexColumnsInflux", lex.LexColumns)
l.Push("lexIdentifier", lex.LexIdentifier)
return nil
}
return lex.LexSelectClause
}