func (p *Matcher) Tokener() Tokener {
	return p.requireScanner()
}
Tokener returns the scanner.
package tpl
import (
	"errors"
	"go/token"
)
var (
	ErrNoGrammar = errors.New("no grammar")
)
type Matcher struct {
	Grammar  Grammar
	Scanner  Tokener
	ScanMode ScanMode
	Init     func()
}
type TokenizeError struct {
	Pos token.Position
	Msg string
}
func (p *TokenizeError) Error() string {
	return p.Msg
}
func (p *Matcher) Code() string {
	return Code(p.Grammar, p.requireScanner())
}
func (p *Matcher) Tokenize(src []byte, fname string) (tokens []Token, err error) {
	fset := token.NewFileSet()
	file := fset.AddFile(fname, -1, len(src))
	s := p.requireScanner()
	var errTok *TokenizeError
	onError := func(pos token.Position, msg string) {
		errTok = &TokenizeError{pos, msg}
	}
	s.Init(file, src, onError, p.ScanMode)
	for {
		token := s.Scan()
		if errTok != nil {
			return tokens, errTok
		}
		tokens = append(tokens, token)
		if token.Kind == EOF {  
			tokens = tokens[:len(tokens)-1]
			break
		}
	}
	return
}
func (p *Matcher) requireScanner() Tokener {
	s := p.Scanner
	if s == nil {
		s = new(Scanner)
		p.Scanner = s
	}
	return s
}