aboutsummaryrefslogtreecommitdiff
path: root/parser/statefunc.go
blob: 69d70984f60fea143b5bb5a2a4b9367205913775 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package parser

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
}