func (c *CommonTokenStream) Sync(i int) bool {
	n := i - len(c.tokens) + 1  
	if n > 0 {
		fetched := c.fetch(n)
		return fetched >= n
	}
	return true
}
Sync makes sure index i in tokens has a token and returns true if a token is
located at index i and otherwise false.
package antlr
import (
	"strconv"
)
type CommonTokenStream struct {
	channel int
	fetchedEOF bool
	index int
	tokenSource TokenSource
	tokens []Token
}
func NewCommonTokenStream(lexer Lexer, channel int) *CommonTokenStream {
	return &CommonTokenStream{
		channel:     channel,
		index:       -1,
		tokenSource: lexer,
		tokens:      make([]Token, 0),
	}
}
func (c *CommonTokenStream) GetAllTokens() []Token {
	return c.tokens
}
func (c *CommonTokenStream) Mark() int {
	return 0
}
func (c *CommonTokenStream) Release(marker int) {}
func (c *CommonTokenStream) reset() {
	c.Seek(0)
}
func (c *CommonTokenStream) Seek(index int) {
	c.lazyInit()
	c.index = c.adjustSeekIndex(index)
}
func (c *CommonTokenStream) Get(index int) Token {
	c.lazyInit()
	return c.tokens[index]
}
func (c *CommonTokenStream) Consume() {
	SkipEOFCheck := false
	if c.index >= 0 {
		if c.fetchedEOF {
			SkipEOFCheck = c.index < len(c.tokens)-1
		} else {
			SkipEOFCheck = c.index < len(c.tokens)
		}
	} else {
		SkipEOFCheck = false
	}
	if !SkipEOFCheck && c.LA(1) == TokenEOF {
		panic("cannot consume EOF")
	}
	if c.Sync(c.index + 1) {
		c.index = c.adjustSeekIndex(c.index + 1)
	}
}