func (bracket *RightBracketToken) Validate(tokens []AnyToken) (retryToken AnyToken, err error) {
	stat := bracket.Stat
	if stat.RBLevel < 1 {
		return nil, fmt.Errorf("wrong right round bracket without start:%d", stat.StartIndex)
	}
	prevs := getPrevTokens(tokens, 1)
	p0 := prevs[0]
	if p0, ok := p0.(*LeftBracketToken); ok && !p0.Stat.Logics["IsFunc"] {
		return nil, fmt.Errorf("empty expression")
	}
	return
}
Validate for RightBracketToken
package expression
import (
	"fmt"
	"log"
	"sort"
	"strconv"
	"unicode"
	"github.com/fefit/fet/types"
	"github.com/fefit/fet/utils"
)
type Indexs = types.Indexs
type Type int
type Runes []rune
type Flags map[string]bool
type Operator struct {
	Runes    Runes
	Priority int
}
type Expression struct {
	Parser  *Parser
	Initial bool
}
type Node struct {
	Left      *Node     
	Right     *Node     
	Root      *Node     
	Token     AnyToken  
	Type      string    
	Operator  string    
	Arguments []*Node   
	Function  *Node     
}
type OperatorList struct {
	Keys   []string
	Values map[string]*Operator
}
const (
	Quote              = '"'
	LeftRoundBracket   = '('
	RightRoundBracket  = ')'
	LeftSquareBracket  = '['
	RightSquareBracket = ']'
	Minus              = '-'
	Plus               = '+'
	Underline          = '_'
	Translate          = '\\'
	Space              = ' '
	Bitor              = "bitor"
	Dollar             = '$'
	VarSymbol          = '`'
)
var (
	operators = [][]string{
		{","},
		{"||"},
		{"&&"},
		{Bitor},
		{"^"},
		{"&"},
		{"==", "!="},
		{">=", "<=", "<", ">"},
		{"+", "-"},
		{"*", "/", "%"},
		{"**"},
		{"!"},
		{".", "|", ":", "(", ")", "[", "]"},
	}
	keywordOperators = map[string]string{
		"bitor": "bitor",
		"and":   "&&",
		"or":    "||",
		"not":   "!",
		"eq":    "==",
		"ne":    "!=",
		"lt":    "<",
		"le":    "<=",
		"gt":    ">",
		"ge":    ">=",
	}
	operatorList = func() OperatorList {
		preIndex := 8      
		ignoreIndex := 12  
		keys, values := []string{}, map[string]*Operator{}
		keys = append(keys, operators[preIndex]...)
		for i, total := 0, len(operators); i < total; i++ {
			ops := operators[i]
			for j, count := 0, len(ops); j < count; j++ {
				key := ops[j]
				values[key] = &Operator{
					Priority: i,
					Runes:    Runes(key),
				}
				if i == preIndex || (i == ignoreIndex && j > 2) {
					continue
				}
				keys = append(keys, key)
			}
		}
		return OperatorList{
			Keys:   keys,
			Values: values,
		}
	}()
	bases = map[rune]int{
		'b': 2,
		'o': 8,
		'x': 16,
	}
)
type Any interface{}
type AnyToken interface {
	Add(s rune) (bool, bool, bool, error)
	Validate(prevTokens []AnyToken) (AnyToken, error)
	SetStat(stat *TokenStat)
	GetStat() *TokenStat
}
func typeOf(token Any) string {
	name := fmt.Sprintf("%T", token)
	rns := Runes(name)
	total := len(rns)
	for total >= 0 {
		total--
		if r := rns[total]; r == '.' {
			break
		}
	}
	return string(rns[total+1:])
}
func getNoSpaceTokens(tokens []AnyToken, num int) (isPrevSpace bool, result []AnyToken) {
	isTwo := num == 2
	if num != 1 && !isTwo {
		log.Fatal("wrong num argments:getNoSpaceTokens")
	}
	prevs := getPrevTokens(tokens, num*2)
	p0, p1 := prevs[0], prevs[1]
	val, match := p0, p1
	if _, isSpace := p0.(*SpaceToken); isSpace {
		val = p1
		isPrevSpace = true
		if isTwo {
			p2, p3 := prevs[2], prevs[3]
			if _, isStillSpace := p2.(*SpaceToken); isStillSpace {
				match = p3
			} else {
				match = p2
			}
		}
	}
	result = append(result, val)
	if isTwo {
		result = append(result, match)
	}
	return
}
type TokenStat struct {
	StartIndex int
	Index      int
	ParseIndex int
	RBLevel    int
	RBSubLevel int
	SBLevel    int
	SBSubLevel int
	Logics     Flags
	Context    *Runes
	Values     Runes
}
type Token struct {
	IsComplete bool
	IsBegin    bool
	Stat       *TokenStat
}
type ValidateNextFn func(token AnyToken) error
func getPrevTokens(tokens []AnyToken, num int) []AnyToken {
	i, count, prevTokens := 1, len(tokens), []AnyToken{}
	for i <= num {
		if count >= i {
			prevTokens = append(prevTokens, tokens[count-i])
		} else {
			prevTokens = append(prevTokens, nil)
		}
		i++
	}
	return prevTokens
}
func (token *Token) GetStat() *TokenStat {
	return token.Stat
}
func (token *Token) Validate(tokens []AnyToken) (retryToken AnyToken, err error) {
	return
}
func (token *Token) Judge() (ok bool, isComplete bool, retry bool, err error) {
	if token.IsBegin {
		token.IsComplete = true
		isComplete = true
	}
	return
}
func (token *Token) AddBracket(s rune, bracket rune) (ok bool, isComplete bool, retry bool, err error) {
	if s == bracket {
		ok = true
		isComplete = true
		stat := token.Stat
		stat.Values = append(stat.Values, bracket)
	}
	return
}
func (token *Token) SetStat(stat *TokenStat) {
	token.Stat = stat
}
type LeftBracketToken struct {
	Token
}
func (bracket *LeftBracketToken) Add(s rune) (ok bool, isComplete bool, retry bool, err error) {
	return bracket.AddBracket(s, LeftRoundBracket)
}
func (bracket *LeftBracketToken) Validate(tokens []AnyToken) (retryToken AnyToken, err error) {
	hasSpace, prevs := getNoSpaceTokens(tokens, 1)
	prev := prevs[0]
	if prev == nil {
		return
	}
	switch prev.(type) {
	case *OperatorToken, *LeftBracketToken:
	case *IdentifierToken, *RightSquareBracketToken:
		if hasSpace {
			return nil, fmt.Errorf("wrong space between function name and (")
		}
		stat := bracket.Stat
		stat.Logics = Flags{
			"IsFunc": true,
		}
	default:
		return nil, fmt.Errorf("wrong left round bracket previous token")
	}
	return
}
type RightBracketToken struct {
	Token
}
func (bracket *RightBracketToken) Add(s rune) (ok bool, isComplete bool, retry bool, err error) {
	return bracket.AddBracket(s, RightRoundBracket)
}