func (p *SpecPath) String() string {
	return *(*string)(p)
}
String converts string from SpecPath
package yaml
import (
	"fmt"
	"path"
	"regexp"
	"strconv"
	"strings"
)
var (
	pathRegexp       = regexp.MustCompile(`^[^.]+(\.dependencies\[\d+\]\.[^.]+)*$`)
	dependencyRegexp = regexp.MustCompile(`dependencies\[(\d+)\]`)
	baseRegexp       = regexp.MustCompile(`(^|dependencies\[\d+\]\.)([^.]+)$`)
)
type SpecPath string
func (p *SpecPath) Parent() *SpecPath {
	matches := pathRegexp.FindStringSubmatch(p.String())
	if len(matches) <= 1 {
		return nil
	}
	if matches[len(matches)-1] == "" {
		return nil
	}
	val := (SpecPath)(strings.TrimSuffix(p.String(), matches[len(matches)-1]))
	return &val
}
func (p *SpecPath) Dependencies(i int, index string) *SpecPath {
	matches := pathRegexp.FindStringSubmatch(p.String())
	if len(matches) == 0 {
		return nil
	}
	val := SpecPath(fmt.Sprintf("%s.dependencies[%d].%s", p.String(), i, index))
	return &val
}
func (p *SpecPath) Name() string {
	matches := baseRegexp.FindStringSubmatch(p.String())
	if len(matches) == 0 {
		return ""
	}
	return matches[2]
}
func (p *SpecPath) Base() string {
	return path.Base(p.Name())
}
func (p *SpecPath) Index() int {
	matches := dependencyRegexp.FindAllStringSubmatch(*(*string)(p), -1)
	if len(matches) == 0 {
		return -1
	}
	n, err := strconv.Atoi(matches[len(matches)-1][1])
	if err != nil {
		return -1
	}
	return n
}