func FindEnums(tokens []Tok) ([]Enum, error) {
	t := toks(tokens)
	var enums []Enum
	for len(t) > 0 {
		switch {
		case t.Try(TokOp, "{"):
			t.SkipBalanced("}")
		case t.Try(TokOp, "("):
			t.SkipBalanced(")")
		case t.Try(TokOp, "["):
			t.SkipBalanced("]")
		case t.Try(TokKeyword, "enum"):
			tag, _ := t.TryIdent()
			if t.Try(TokOp, "{") {
				for {
					if t.Try(TokOp, "}") {
						break
					}
					id, ok := t.TryIdent()
					if !ok {
						return nil, fmt.Errorf("expected identifier")
					}
					enums = append(enums, Enum{tag, id})
					if t.Try(TokOp, "=") {
						t.SkipBalanced(",", "}")
					}
					t.Try(TokOp, ",")
				}
			}
		default:
			t.Skip(1)
		}
	}
	return enums, nil
}
FindEnums finds top-level enumeration constants in toks.
package cparse
import (
	"fmt"
)
type Enum struct {
	Tag   Tok
	Ident Tok
}