func (l *lexer) nextItem() tokenItem {
	return <-l.items
}
nextItem returns the next tokenItem from the input.
Called by the parser, not in the lexing goroutine.
package parse
import (
	"fmt"
	"strings"
	"unicode"
	"unicode/utf8"
)
type tokenItem struct {
	tok  token   
	pos  Pos     
	val  string  
	line int     
}
func (i tokenItem) String() string {
	switch {
	case i.tok == EOF:
		return "EOF"
	case i.tok == ERROR:
		return i.val
	case i.tok > keyword_beg && i.tok < keyword_end:
		return fmt.Sprintf("%d: <%s>", i.tok, i.val)
	}
	return fmt.Sprintf("%d: %q", i.tok, i.val)
}
var key = map[string]token{
	"model": MODEL,
	"tab":   TABLE,
	"view":  VIEW,
	"cnt":   COUNTER,
}
const (
	leftDelim  = "{{"
	rightDelim = "}}"
	eof        = -1
)
type stateFn func(*lexer) stateFn
type lexer struct {
	name       string          
	input      string          
	pos        Pos             
	start      Pos             
	width      Pos             
	items      chan tokenItem  
	parenDepth int             
	line       int             
	startLine  int             
}
func (l *lexer) next() rune {
	if int(l.pos) >= len(l.input) {
		l.width = 0
		return eof
	}
	r, w := utf8.DecodeRuneInString(l.input[l.pos:])
	l.width = Pos(w)
	l.pos += l.width
	if r == '\n' {
		l.line++
	}
	return r
}
func (l *lexer) peek() rune {
	r := l.next()
	l.backup()
	return r
}
func (l *lexer) backup() {
	l.pos -= l.width
	if l.width == 1 && l.input[l.pos] == '\n' {
		l.line--
	}
}
func (l *lexer) emit(t token) {
	l.items <- tokenItem{t, l.start, l.input[l.start:l.pos], l.startLine}
	l.start = l.pos
	l.startLine = l.line
}
func (l *lexer) ignore() {
	l.line += strings.Count(l.input[l.start:l.pos], "\n")
	l.start = l.pos
	l.startLine = l.line
}
func (l *lexer) errorf(format string, args ...interface{}) stateFn {
	l.items <- tokenItem{ERROR, l.start, fmt.Sprintf(format, args...), l.startLine}
	return nil
}