package jen

import (
	
	
	
	
)

// Tag renders a struct tag
func ( map[string]string) *Statement {
	return newStatement().Tag()
}

// Tag renders a struct tag
func ( *Group) ( map[string]string) *Statement {
	// notest
	// don't think this can ever be used in valid code?
	 := Tag()
	.items = append(.items, )
	return 
}

// Tag renders a struct tag
func ( *Statement) ( map[string]string) *Statement {
	 := tag{
		items: ,
	}
	* = append(*, )
	return 
}

type tag struct {
	items map[string]string
}

func ( tag) ( *File) bool {
	return len(.items) == 0
}

func ( tag) ( *File,  io.Writer,  *Statement) error {

	if .isNull() {
		// notest
		// render won't be called if t is null
		return nil
	}

	var  string

	var  []string
	for  := range .items {
		 = append(, )
	}
	sort.Strings()

	for ,  := range  {
		 := .items[]
		if len() > 0 {
			 += " "
		}
		 += fmt.Sprintf(`%s:%q`, , )
	}

	if strconv.CanBackquote() {
		 = "`" +  + "`"
	} else {
		 = strconv.Quote()
	}

	if ,  := .Write([]byte());  != nil {
		return 
	}

	return nil
}