// lexKeyword lexes the BQL keywords.
321988
func lexKeyword(l *lexer) stateFn {
	input := l.input[l.pos:]
	f := func(r rune) bool {
		return !unicode.IsLetter(r)
	}
	if idx := strings.IndexFunc(input, f); idx >= 0 {
		input = input[:idx]
	}
	if strings.EqualFold(input, query) {
		consumeKeyword(l, ItemQuery)
		return lexSpace
	}
	if strings.EqualFold(input, insert) {
		consumeKeyword(l, ItemInsert)
		return lexSpace
	}
	if strings.EqualFold(input, delete) {
		consumeKeyword(l, ItemDelete)
		return lexSpace
	}
	if strings.EqualFold(input, create) {
		consumeKeyword(l, ItemCreate)
		return lexSpace
	}
	if strings.EqualFold(input, construct) {
		consumeKeyword(l, ItemConstruct)
		return lexSpace
	}
	if strings.EqualFold(input, deconstruct) {
		consumeKeyword(l, ItemDeconstruct)
		return lexSpace
	}
	if strings.EqualFold(input, drop) {
		consumeKeyword(l, ItemDrop)
		return lexSpace
	}
	if strings.EqualFold(input, graph) {
		consumeKeyword(l, ItemGraph)
		return lexSpace
	}
	if strings.EqualFold(input, data) {
		consumeKeyword(l, ItemData)
		return lexSpace
	}
	if strings.EqualFold(input, into) {
		consumeKeyword(l, ItemInto)
		return lexSpace
	}
	if strings.EqualFold(input, from) {
		consumeKeyword(l, ItemFrom)
		return lexSpace
	}
	if strings.EqualFold(input, where) {
		consumeKeyword(l, ItemWhere)
		return lexSpace
	}
	if strings.EqualFold(input, as) {
		consumeKeyword(l, ItemAs)
		return lexSpace
	}
	if strings.EqualFold(input, before) {
		consumeKeyword(l, ItemBefore)
		return lexSpace
	}
	if strings.EqualFold(input, after) {
		consumeKeyword(l, ItemAfter)
		return lexSpace
	}
	if strings.EqualFold(input, between) {
		consumeKeyword(l, ItemBetween)
		return lexSpace
	}
	if strings.EqualFold(input, count) {
		consumeKeyword(l, ItemCount)
		return lexSpace
	}
	if strings.EqualFold(input, distinct) {
		consumeKeyword(l, ItemDistinct)
		return lexSpace
	}
	if strings.EqualFold(input, sum) {
		consumeKeyword(l, ItemSum)
		return lexSpace
	}
	if strings.EqualFold(input, group) {
		consumeKeyword(l, ItemGroup)
		return lexSpace
	}
	if strings.EqualFold(input, by) {
		consumeKeyword(l, ItemBy)
		return lexSpace
	}
	if strings.EqualFold(input, order) {
		consumeKeyword(l, ItemOrder)
		return lexSpace
	}
	if strings.EqualFold(input, asc) {
		consumeKeyword(l, ItemAsc)
		return lexSpace
	}
	if strings.EqualFold(input, desc) {
		consumeKeyword(l, ItemDesc)
		return lexSpace
	}
	if strings.EqualFold(input, having) {
		consumeKeyword(l, ItemHaving)
		return lexSpace
	}
	if strings.EqualFold(input, limit) {
		consumeKeyword(l, ItemLimit)
		return lexSpace
	}
	if strings.EqualFold(input, not) {
		consumeKeyword(l, ItemNot)
		return lexSpace
	}
	if strings.EqualFold(input, and) {
		consumeKeyword(l, ItemAnd)
		return lexSpace
	}
	if strings.EqualFold(input, or) {
		consumeKeyword(l, ItemOr)
		return lexSpace
	}
	if strings.EqualFold(input, id) {
		consumeKeyword(l, ItemID)
		return lexSpace
	}
	if strings.EqualFold(input, typeKeyword) {
		consumeKeyword(l, ItemType)
		return lexSpace
	}
	if strings.EqualFold(input, atKeyword) {
		consumeKeyword(l, ItemAt)
		return lexSpace
	}
	if strings.EqualFold(input, inKeyword) {
		consumeKeyword(l, ItemIn)
		return lexSpace
	}
	if strings.EqualFold(input, showKeyword) {
		consumeKeyword(l, ItemShow)
		return lexSpace
	}
	if strings.EqualFold(input, graphsKeyword) {
		consumeKeyword(l, ItemGraphs)
		return lexSpace
	}
	for {
		r := l.next()
		if unicode.IsSpace(r) || r == eof {
			l.backup()
			break
		}
	}
	l.emitError("found unknown keyword")
	return nil
}
1169744
func lexToken(l *lexer) stateFn {
	for {
		{
			r := l.peek()
			switch r {
			case binding:
				l.next()
				return lexBinding
			case slash:
				return lexNode
			case underscore:
				l.next()
				return lexBlankNode
			case quote:
				return lexPredicateOrLiteral
			}
			if unicode.IsLetter(r) {
				return lexKeyword
			}
		}
		if state := isSingleSymbolToken(l, ItemLBracket, leftBracket); state != nil {
			return state
		}
		if state := isSingleSymbolToken(l, ItemRBracket, rightBracket); state != nil {
			return state
		}
		if state := isSingleSymbolToken(l, ItemLPar, leftPar); state != nil {
			return state
		}
		if state := isSingleSymbolToken(l, ItemRPar, rightPar); state != nil {
			return state
		}
		if state := isSingleSymbolToken(l, ItemSemicolon, semicolon); state != nil {
			return state
		}
		if state := isSingleSymbolToken(l, ItemDot, dot); state != nil {
			return state
		}
		if state := isSingleSymbolToken(l, ItemComma, comma); state != nil {
			return state
		}
		if state := isSingleSymbolToken(l, ItemLT, lt); state != nil {
			return state
		}
		if state := isSingleSymbolToken(l, ItemGT, gt); state != nil {
			return state
		}
		if state := isSingleSymbolToken(l, ItemEQ, eq); state != nil {
			return state
		}
		{
			r := l.next()
			if unicode.IsSpace(r) {
				l.ignore()
				continue
			}
			if l.next() == eof {
				break
			}
		}
	}
	l.emit(ItemEOF) // Useful to make EOF a token.
	return nil      // Stop the run loop.
}
76694
func LexRun(l Lexer) {
	for fn := l.GetEntryPoint(); fn != nil; {
		fn = fn(l)
	}
	close(l.Items())
}
260678
func LexColumnNames(l *Lexer) StateFn {
	l.SkipWhiteSpaces()
	r := l.Peek()
	//u.Debugf("LexColumnNames lr=%s  word=%q", string(r), l.PeekWord())
	switch r {
	case ',':
		l.Next()
		l.Emit(TokenComma)
		return LexColumnNames
	case ')':
		l.Next()
		l.Emit(TokenRightParenthesis)
		return nil
	case '(':
		l.Next()
		l.Emit(TokenLeftParenthesis)
		return LexColumnNames
	default:
		l.Push("LexColumnNames", LexColumnNames)
		return LexIdentifier
	}
}
307704
func lexKeyEnd(lx *lexer) stateFn {
	switch r := lx.next(); {
	case r == keySep:
		return lexSkip(lx, lexValue)
	case isWhitespace(r):
		return lexSkip(lx, lexKeyEnd)
	default:
		return lx.errorf("expected key separator %q, but got %q instead",
			keySep, r)
	}
}
876158
func lexMapKey(lx *lexer) stateFn {
	r := lx.peek()
	if unicode.IsSpace(r) {
		// Spaces signal we could be looking at a keyword, e.g. include.
		// Keywords will eat the keyword and set the appropriate return stateFn.
		return lx.keyCheckKeyword(lexMapKeyEnd, lexMapValueEnd)
	} else if isKeySeparator(r) {
		lx.emit(itemKey)
		return lexMapKeyEnd
	}
	lx.next()
	return lexMapKey
}
1285440
func Keyword(k string) ([]Emoji, error) {
	if names, ok := keywordLookup[k]; ok {
		es := []Emoji{}

		for _, n := range names {
			es = append(es, emojis[n])
		}

		return es, nil
	}

	return []Emoji{}, ErrUnknownKeyword
}
1233495
func lex(name, input, left, right string) *lexer {
	if left == "" {
		left = leftDelim
	}
	if right == "" {
		right = rightDelim
	}
	l := &lexer{
		name:       name,
		input:      input,
		leftDelim:  left,
		rightDelim: right,
		items:      make(chan item),
	}
	go l.run()
	return l
}
686431
func SetKeywords(p *dt.Plugin, khs ...dt.KeywordHandler) {
	p.Keywords = &dt.Keywords{
		Dict: map[string]dt.KeywordFn{},
	}
	for _, kh := range khs {
		for _, intent := range kh.Trigger.Intents {
			intent = strings.ToLower(intent)
			if !language.Contains(p.Trigger.Intents, intent) {
				p.Trigger.Intents = append(p.Trigger.Intents, intent)
			}
			key := "I_" + intent
			_, exists := p.Keywords.Dict[key]
			if exists {
				continue
			}
			p.Keywords.Dict[key] = kh.Fn
		}
		eng := porter2.Stemmer
		for _, cmd := range kh.Trigger.Commands {
			cmd = strings.ToLower(eng.Stem(cmd))
			if !language.Contains(p.Trigger.Commands, cmd) {
				p.Trigger.Commands = append(p.Trigger.Commands, cmd)
			}
			for _, obj := range kh.Trigger.Objects {
				obj = strings.ToLower(eng.Stem(obj))
				if !language.Contains(p.Trigger.Objects, obj) {
					p.Trigger.Objects = append(p.Trigger.Objects, obj)
				}
				key := "CO_" + cmd + "_" + obj
				p.Keywords.Dict[key] = kh.Fn
			}
		}
	}
}
369104
func lexMapQuotedKey(lx *lexer) stateFn {
	r := lx.peek()
	if r == sqStringEnd {
		lx.emit(itemKey)
		lx.next()
		return lexSkip(lx, lexMapKeyEnd)
	}
	lx.next()
	return lexMapQuotedKey
}
1250003
func lexDubQuotedKey(lx *lexer) stateFn {
	r := lx.peek()
	if r == dqStringEnd {
		lx.emit(itemKey)
		lx.next()
		return lexSkip(lx, lexKeyEnd)
	}
	lx.next()
	return lexDubQuotedKey
}
84728
func (t *Type) genericKeywords(tags []string) {
	for _, tag := range tags {
		nameValue := strings.Split(tag, "=")
		if len(nameValue) == 2 {
			name, val := nameValue[0], nameValue[1]
			switch name {
			case "title":
				t.Title = val
			case "description":
				t.Description = val
			}
		}
	}
}
760590
func (s *QualificationType) SetKeywords(v string) *QualificationType {
	s.Keywords = &v
	return s
}
71249
func lexChar(l *lexer) stateFn {
Loop:
	for {
		switch l.next() {
		case '\\':
			if r := l.next(); r != eof && r != '\n' {
				break
			}
			fallthrough
		case eof, '\n':
			return l.errorf("unterminated character constant")
		case '\'':
			break Loop
		}
	}
	l.emit(itemCharConstant)
	return lexInsideAction
}
375847
func (l *tomlLexer) lexVoid() tomlLexStateFn {
	for {
		next := l.peek()
		switch next {
		case '[':
			return l.lexTableKey
		case '#':
			return l.lexComment(l.lexVoid)
		case '=':
			return l.lexEqual
		case '\r':
			fallthrough
		case '\n':
			l.skip()
			continue
		}

		if isSpace(next) {
			l.skip()
		}

		if l.depth > 0 {
			return l.lexRvalue
		}

		if isKeyStartChar(next) {
			return l.lexKey
		}

		if next == eof {
			l.next()
			break
		}
	}

	l.emit(tokenEOF)
	return nil
}
1120195
func KeywordString(id int) string {
	str, ok := keywordStrings[id]
	if !ok {
		return ""
	}
	return str
}
1160734
func lexPredicate(l *lexer) stateFn {
	l.next()
	for done := false; !done; {
		switch r := l.next(); r {
		case backSlash:
			if nr := l.peek(); nr == quote {
				l.next()
				continue
			}
		case quote:
			l.backup()
			if !l.consume(anchor) {
				l.emitError("predicates require time anchor information; missing \"@[")
				return nil
			}
			var (
				nr     rune
				commas = 0
			)
			for {
				nr = l.next()
				if nr == comma {
					commas++
				}
				if nr == rightSquarePar || nr == eof {
					break
				}
			}
			if nr != rightSquarePar {
				l.emitError("predicate's time anchors should end with ] delimiter")
				return nil
			}
			if commas > 1 {
				l.emitError("predicate bounds should only have one , to separate bounds")
				return nil
			}
			if commas == 0 {
				l.emit(ItemPredicate)
			} else {
				l.emit(ItemPredicateBound)
			}
			done = true
		case eof:
			l.emitError("literals needs to be properly terminated; missing \" and type")
			return nil
		}
	}
	return lexSpace
}