func (class *tCharClass) GetRuneAt(i int32) rune {
	for _, r := range class.Ranges {
		if i < r.Size {
			return r.Start + rune(i)
		}
		i -= r.Size
	}
	panic("index out of bounds")
}
GetRuneAt gets a rune from CharClass as a contiguous array of runes.
package regen
import (
	"fmt"
)
type tCharClass struct {
	Ranges    []tCharClassRange
	TotalSize int32
}
type tCharClassRange struct {
	Start rune
	Size  int32
}
func newCharClass(start rune, end rune) *tCharClass {
	charRange := newCharClassRange(start, end)
	return &tCharClass{
		Ranges:    []tCharClassRange{charRange},
		TotalSize: charRange.Size,
	}
}
func parseCharClass(runes []rune) *tCharClass {
	var totalSize int32
	numRanges := len(runes) / 2
	ranges := make([]tCharClassRange, numRanges, numRanges)
	for i := 0; i < numRanges; i++ {
		start := runes[i*2]
		end := runes[i*2+1]
		if start == 0 {
			start = 1
		}
		r := newCharClassRange(start, end)
		ranges[i] = r
		totalSize += r.Size
	}
	return &tCharClass{ranges, totalSize}
}