mirror of
https://github.com/diamondburned/cchat-discord.git
synced 2024-12-23 12:56:42 +00:00
22 lines
425 B
Go
22 lines
425 B
Go
package renderer
|
|
|
|
// LinkState is used for ast.Link segments.
|
|
type LinkState struct {
|
|
Linkstack []int // stack of starting integers
|
|
}
|
|
|
|
func (ls *LinkState) Append(l int) {
|
|
ls.Linkstack = append(ls.Linkstack, l)
|
|
}
|
|
|
|
func (ls *LinkState) Pop() int {
|
|
ilast := len(ls.Linkstack) - 1
|
|
start := ls.Linkstack[ilast]
|
|
ls.Linkstack = ls.Linkstack[:ilast]
|
|
return start
|
|
}
|
|
|
|
func (ls LinkState) Len() int {
|
|
return len(ls.Linkstack)
|
|
}
|