1
0
Fork 0
mirror of https://github.com/diamondburned/cchat-discord.git synced 2024-11-01 20:34:27 +00:00
cchat-discord/internal/segments/renderer/link.go

22 lines
425 B
Go
Raw Normal View History

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)
}