aboutsummaryrefslogblamecommitdiff
path: root/internal/lexer/statefunc.go
blob: 8d0e42afe8dfae6da828163937aab5b2d39b113e (plain) (tree)
1
2
3
             
 
                                     













                                                      
package lexer

type stateFunc func(*Lexer) stateFunc

type stateStack []stateFunc

func (ss *stateStack) Push(s stateFunc) {
	*ss = append(*ss, s)
}

func (ss *stateStack) Pop() (s stateFunc) {
	if len(*ss) == 0 {
		return nil
	}
	*ss, s = (*ss)[:len(*ss)-1], (*ss)[len(*ss)-1]
	return s
}