func (s *Lexer) lexWhitespace() (tok Token, lit string) {
	var buf bytes.Buffer
	buf.WriteRune(s.read())
	for {
		if ch := s.read(); ch == eof {
			break
		} else if !isWhitespace(ch) {
			s.unread()
			break
		} else {
			buf.WriteRune(ch)
		}
	}
	return WS, buf.String()
}
lexWhitespace consumes the current rune and all contiguous whitespace.
package query
import (
	"bufio"
	"bytes"
	"io"
)
var eof = rune(0)
type Lexer struct {
	r *bufio.Reader
}
func NewLexer(r io.Reader) *Lexer {
	return &Lexer{r: bufio.NewReader(r)}
}
func (s *Lexer) read() rune {
	ch, _, err := s.r.ReadRune()
	if err != nil {
		return eof
	}
	return ch
}
func (s *Lexer) unread() { _ = s.r.UnreadRune() }
func (s *Lexer) Lex() (tok Token, lit string) {
	ch := s.read()
	if isWhitespace(ch) {
		s.unread()
		return s.lexWhitespace()
	} else if ch == eof {
		return EOF, ""
	} else if ch == '(' {
		return LPAREN, "("
	} else if ch == ')' {
		return RPAREN, ")"
	} else if ch == ':' {
		return COLON, ":"
	}
	s.unread()
	tok, lit = s.lexString()
	if kw, ok := Lookup(lit); ok {
		return kw, lit
	}
	return tok, lit
}