~shulhan/asciidoctor-go

ref: v0.1.0 asciidoctor-go/inline_parser_state.go -rw-r--r-- 439 bytes
4c1ded16Shulhan Release asciidoctor-go v0.1.0 (2021-03-06) 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package asciidoctor

type inlineParserState struct {
	stack []int
}

func (pis *inlineParserState) push(c int) {
	pis.stack = append(pis.stack, c)
}

func (pis *inlineParserState) pop() (c int) {
	size := len(pis.stack)
	if size > 0 {
		c = pis.stack[size-1]
		pis.stack = pis.stack[:size-1]
	}
	return c
}

func (pis *inlineParserState) has(c int) bool {
	for _, r := range pis.stack {
		if r == c {
			return true
		}
	}
	return false
}