MCPcopy Create free account
hub / github.com/araddon/qlbridge / LexEngineKeyValue

Function LexEngineKeyValue

lex/dialect_sql.go:937–968  ·  view source on GitHub ↗

LexEngineKeyValue key value pairs Start with identity for key/value pairs supports keyword DEFAULT supports non-quoted values

(l *Lexer)

Source from the content-addressed store, hash-verified

935// supports non-quoted values
936//
937func LexEngineKeyValue(l *Lexer) StateFn {
938
939 l.SkipWhiteSpaces()
940 if l.IsEnd() {
941 return nil
942 }
943 r := l.Peek()
944 if r == '=' {
945 l.ConsumeWord("=")
946 l.Emit(TokenEqual)
947 l.Push("LexEngineKeyValue", LexEngineKeyValue)
948 return LexExpression
949 }
950 word := strings.ToLower(l.PeekWord())
951 //u.Debugf("LexEngineKeyValue %q peek= %v", word, l.PeekX(10))
952 switch word {
953 case "with":
954 return nil
955 case "default":
956 l.ConsumeWord(word)
957 l.Emit(TokenDefault)
958 return LexEngineKeyValue
959 case "=":
960 return LexExpression
961 }
962 if l.isIdentity() {
963 l.Push("LexEngineKeyValue", LexEngineKeyValue)
964 return LexExpression
965 }
966 u.Debugf("Did not find key-value? %v", l.PeekX(20))
967 return nil
968}

Callers

nothing calls this directly

Calls 9

SkipWhiteSpacesMethod · 0.80
ConsumeWordMethod · 0.80
EmitMethod · 0.80
PushMethod · 0.80
PeekWordMethod · 0.80
isIdentityMethod · 0.80
PeekXMethod · 0.80
IsEndMethod · 0.65
PeekMethod · 0.65

Tested by

no test coverage detected