promql/lex.go
func lexValueSequence(l *lexer) stateFn {
	switch r := l.next(); {
	case r == eof:
		return lexStatements
	case isSpace(r):
		l.emit(ItemSpace)
		lexSpace(l)
	case r == '+':
		l.emit(ItemADD)
	case r == '-':
		l.emit(ItemSUB)
	case r == 'x':
		l.emit(ItemTimes)
	case r == '_':
		l.emit(ItemBlank)
	case isDigit(r) || (r == '.' && isDigit(l.peek())):
		l.backup()
		lexNumber(l)
	case isAlpha(r):
		l.backup()
		// We might lex invalid items here but this will be caught by the parser.
		return lexKeywordOrIdentifier
	default:
		return l.errorf("unexpected character in series sequence: %q", r)
	}
	return lexValueSequence
}
func lexValueSequence(l *lexer) stateFn {
	switch r := l.next(); {
	case r == eof:
		return lexStatements
	case isSpace(r):
		l.emit(ItemSpace)
		lexSpace(l)
	case r == '+':
		l.emit(ItemADD)
	case r == '-':
		l.emit(ItemSUB)
	case r == 'x':
		l.emit(ItemTimes)
	case r == '_':
		l.emit(ItemBlank)
	case isDigit(r) || (r == '.' && isDigit(l.peek())):
		l.backup()
		lexNumber(l)
	case isAlpha(r):
		l.backup()
		// We might lex invalid items here but this will be caught by the parser.
		return lexKeywordOrIdentifier
	default:
		return l.errorf("unexpected character in series sequence: %q", r)
	}
	return lexValueSequence
}
func lexValueSequence ( l * lexer ) stateFn { switch r := l . next ( ) ; { case r == eof : return lexStatements case isSpace ( r ) : l . emit ( ItemSpace ) lexSpace ( l ) case r == '+' : l . emit ( ItemADD ) case r == '-' : l . emit ( ItemSUB ) case r == 'x' : l . emit ( ItemTimes ) case r == '_' : l . emit ( ItemBlank ) case isDigit ( r ) || ( r == '.' && isDigit ( l . peek ( ) ) ) : l . backup ( ) lexNumber ( l ) case isAlpha ( r ) : l . backup ( ) // We might lex invalid items here but this will be caught by the parser. return lexKeywordOrIdentifier default : return l . errorf ( " " , r ) } return lexValueSequence }
// lexValueSequence scans a value sequence of a series description.
lexValueSequence scans a value sequence of a series description .