func (s *regexFcd) fcIsEmpty() bool {
	return s.fcDepth == 0
}
True if the stack is empty.
package syntax
import (
	"bytes"
	"fmt"
	"strconv"
	"unicode"
	"unicode/utf8"
)
type Prefix struct {
	PrefixStr       []rune
	PrefixSet       CharSet
	CaseInsensitive bool
}
func getFirstCharsPrefix(tree *RegexTree) *Prefix {
	s := regexFcd{
		fcStack:  make([]regexFc, 32),
		intStack: make([]int, 32),
	}
	fc := s.regexFCFromRegexTree(tree)
	if fc == nil || fc.nullable || fc.cc.IsEmpty() {
		return nil
	}
	fcSet := fc.getFirstChars()
	return &Prefix{PrefixSet: fcSet, CaseInsensitive: fc.caseInsensitive}
}
type regexFcd struct {
	intStack        []int
	intDepth        int
	fcStack         []regexFc
	fcDepth         int
	skipAllChildren bool  
	skipchild       bool  
	failed          bool
}
func (s *regexFcd) regexFCFromRegexTree(tree *RegexTree) *regexFc {
	curNode := tree.root
	curChild := 0
	for {
		if len(curNode.children) == 0 {
			s.calculateFC(curNode.t, curNode, 0)
		} else if curChild < len(curNode.children) && !s.skipAllChildren {
			s.calculateFC(curNode.t|beforeChild, curNode, curChild)
			if !s.skipchild {
				curNode = curNode.children[curChild]
				s.pushInt(curChild)
				curChild = 0
			} else {
				curChild++
				s.skipchild = false
			}
			continue
		}
		s.skipAllChildren = false
		if s.intIsEmpty() {
			break
		}
		curChild = s.popInt()
		curNode = curNode.next
		s.calculateFC(curNode.t|afterChild, curNode, curChild)
		if s.failed {
			return nil
		}
		curChild++
	}
	if s.fcIsEmpty() {
		return nil
	}
	return s.popFC()
}
func (s *regexFcd) pushInt(I int) {
	if s.intDepth >= len(s.intStack) {
		expanded := make([]int, s.intDepth*2)
		copy(expanded, s.intStack)
		s.intStack = expanded
	}
	s.intStack[s.intDepth] = I
	s.intDepth++
}
func (s *regexFcd) intIsEmpty() bool {
	return s.intDepth == 0
}
func (s *regexFcd) popInt() int {
	s.intDepth--
	return s.intStack[s.intDepth]
}
func (s *regexFcd) pushFC(fc regexFc) {
	if s.fcDepth >= len(s.fcStack) {
		expanded := make([]regexFc, s.fcDepth*2)
		copy(expanded, s.fcStack)
		s.fcStack = expanded
	}
	s.fcStack[s.fcDepth] = fc
	s.fcDepth++
}