func Skip(n func(ctx *Context) int) Ruler {
	return &skip{n: n}
}
Skip returns a matching unit that skips n(ctx) bytes.
package bpl
import (
	"bufio"
	"errors"
	"io"
	"io/ioutil"
	"reflect"
	"github.com/qiniu/x/bufiox"
)
var (
	ErrVarNotAssigned = errors.New("variable is not assigned")
	ErrVarAssigned = errors.New("variable is already assigned")
	ErrNotEOF = errors.New("current position is not at EOF")
)
type nilType int
func (p nilType) Match(in *bufio.Reader, ctx *Context) (v interface{}, err error) {
	return nil, nil
}
func (p nilType) RetType() reflect.Type {
	return TyInterface
}
func (p nilType) SizeOf() int {
	return 0
}
var Nil Ruler = nilType(0)
type eof int
func (p eof) Match(in *bufio.Reader, ctx *Context) (v interface{}, err error) {
	_, err = in.Peek(1)
	if err == io.EOF {
		return nil, nil
	}
	return nil, ErrNotEOF
}
func (p eof) RetType() reflect.Type {
	return TyInterface
}
func (p eof) SizeOf() int {
	return 0
}
var EOF Ruler = eof(0)
type done int
func (p done) Match(in *bufio.Reader, ctx *Context) (v interface{}, err error) {
	_, err = in.WriteTo(ioutil.Discard)
	return
}
func (p done) RetType() reflect.Type {
	return TyInterface
}
func (p done) SizeOf() int {
	return -1
}
var Done Ruler = done(0)
type and struct {
	rs []Ruler
}
func (p *and) Match(in *bufio.Reader, ctx *Context) (v interface{}, err error) {
	for _, r := range p.rs {
		_, err = r.Match(in, ctx)
		if err != nil {
			return
		}
	}
	return ctx.Dom(), nil
}
func (p *and) RetType() reflect.Type {
	return TyInterface
}
func (p *and) SizeOf() int {
	return -1
}
func And(rs ...Ruler) Ruler {
	if len(rs) <= 1 {
		if len(rs) == 1 {
			return rs[0]
		}
		return Nil
	}
	return &and{rs: rs}
}
type seq struct {
	rs []Ruler
}
func (p *seq) Match(in *bufio.Reader, ctx *Context) (v interface{}, err error) {
	ret := ctx.requireVarSlice()
	for _, r := range p.rs {
		v, err = r.Match(in, ctx.NewSub())
		if err != nil {
			return
		}
		ret = append(ret, v)
	}
	ctx.dom = ret
	return ret, nil
}
func (p *seq) RetType() reflect.Type {
	return tyInterfaceSlice
}
func (p *seq) SizeOf() int {
	return -1
}
func Seq(rs ...Ruler) Ruler {
	return &seq{rs: rs}
}
type act struct {
	fn func(ctx *Context) error
}
func (p *act) Match(in *bufio.Reader, ctx *Context) (v interface{}, err error) {
	err = p.fn(ctx)
	if err != nil {
		return
	}
	return ctx.Dom(), nil
}
func (p *act) RetType() reflect.Type {
	return TyInterface
}
func (p *act) SizeOf() int {
	return -1
}
func Do(fn func(ctx *Context) error) Ruler {
	return &act{fn: fn}
}
type dyntype struct {
	r func(ctx *Context) (Ruler, error)
}
func (p *dyntype) Match(in *bufio.Reader, ctx *Context) (v interface{}, err error) {
	r, err := p.r(ctx)
	if err != nil {
		return
	}
	if r != nil {
		return r.Match(in, ctx)
	}
	return
}
func (p *dyntype) RetType() reflect.Type {
	return TyInterface
}
func (p *dyntype) SizeOf() int {
	return -1
}
func Dyntype(r func(ctx *Context) (Ruler, error)) Ruler {
	return &dyntype{r: r}
}
type read struct {
	n func(ctx *Context) int
	r Ruler
}
func (p *read) Match(in *bufio.Reader, ctx *Context) (v interface{}, err error) {
	n := p.n(ctx)
	b := make([]byte, n)
	_, err = io.ReadFull(in, b)
	if err != nil {
		return
	}
	in = bufiox.NewReaderBuffer(b)
	return MatchStream(p.r, in, ctx)
}
func (p *read) RetType() reflect.Type {
	return p.r.RetType()
}
func (p *read) SizeOf() int {
	return -1
}
func Read(n func(ctx *Context) int, r Ruler) Ruler {
	return &read{r: r, n: n}
}
type skip struct {
	n func(ctx *Context) int
}
func (p *skip) Match(in *bufio.Reader, ctx *Context) (v interface{}, err error) {
	n := p.n(ctx)
	v, err = in.Discard(n)
	return
}
func (p *skip) RetType() reflect.Type {
	return tyInt
}
func (p *skip) SizeOf() int {
	return -1
}