func (l *lexer) curInput() string {
	return l.input[l.start:l.pos]
}
curInput returns the current pending input of the lexer.
package lexer
import (
	"fmt"
	"unicode/utf8"
)
type Lexer interface {
	Next() Token
}
type stateFn func(*lexer) stateFn
type lexer struct {
	input       string  
	start       int     
	startLine   int     
	startCol    int     
	pos         int     
	col         int     
	width       int     
	line        int     
	prevLineCol int     
	curRune     rune    
	tokens chan Token  
}
func Lex(input string) Lexer {
	l := &lexer{
		input:     input,
		startLine: 1,
		startCol:  1,
		col:       1,
		line:      1,
		tokens:    make(chan Token, 2),
	}
	go l.run()
	return l
}
func (l *lexer) Next() (tk Token) {
	var ok bool
	tk, ok = <-l.tokens
	if !ok {
		tk = Token{Type: EOF}
	}
	return
}
func (l *lexer) run() {
	for state := lexTokenStart(l); state != nil; {
		state = state(l)
	}
	close(l.tokens)
}
func (l *lexer) emit(t TokenType) {
	l.tokens <- Token{
		Type:  t,
		Value: l.input[l.start:l.pos],
		Pos:   l.curPos(),
	}
	l.start = l.pos
	l.startLine = l.line
	l.startCol = l.col
}
func (l *lexer) next() rune {
	if l.pos >= len(l.input) {
		l.width = 0
		return eof
	}
	l.curRune, l.width = utf8.DecodeRuneInString(l.input[l.pos:])
	l.pos += l.width
	if l.curRune == newline {
		l.line++
		l.prevLineCol = l.col
		l.col = 0
	}
	l.col++
	return l.curRune
}
func (l *lexer) ignore() {
	l.start = l.pos
	l.startLine = l.line
	l.startCol = l.col
	l.curRune = eof
}
func (l *lexer) backup() {
	if l.curRune == newline {
		l.col = l.prevLineCol
		l.prevLineCol = -1
		l.line--
	} else {
		l.col--
	}
	l.pos -= l.width
	l.curRune = eof
}