parse.go
func Parse(selector string) (Op, error) {
	segments := strings.Split(selector, ".")

	ops := make([]Op, 0, len(segments))
	for _, segment := range segments {
		key := strings.TrimSpace(segment)
		if key == "" {
			continue
		}

		if op, ok := parseArray(key); ok {
			ops = append(ops, op)
			continue
		}

		ops = append(ops, Dot(key))
	}

	return Chain(ops...), nil
}
func Parse(selector string) (Op, error) {
	segments := strings.Split(selector, ".")

	ops := make([]Op, 0, len(segments))
	for _, segment := range segments {
		key := strings.TrimSpace(segment)
		if key == "" {
			continue
		}

		if op, ok := parseArray(key); ok {
			ops = append(ops, op)
			continue
		}

		ops = append(ops, Dot(key))
	}

	return Chain(ops...), nil
}
func Parse ( selector string ) ( Op , error ) { segments := strings . Split ( selector , " " ) ops := make ( [ ] Op , 0 , len ( segments ) ) for _ , segment := range segments { key := strings . TrimSpace ( segment ) if key == " " { continue } if op , ok := parseArray ( key ) ; ok { ops = append ( ops , op ) continue } ops = append ( ops , Dot ( key ) ) } return Chain ( ops ... ) , nil }
// Parse takes a string representation of a selector and returns the corresponding Op definition
Parse takes a string representation of a selector and returns the corresponding Op definition