// ExtractHighlightPostTag returns the first found HighlightPostTagOption from the
// given variadic arguments or nil otherwise.
430418
func ExtractHighlightPostTag(opts ...interface{}) *opt.HighlightPostTagOption {
	for _, o := range opts {
		if v, ok := o.(*opt.HighlightPostTagOption); ok {
			return v
		}
	}
	return nil
}
437927
func NewHighlightRectArgs(x int, y int, width int, height int) *HighlightRectArgs {
	args := new(HighlightRectArgs)
	args.X = x
	args.Y = y
	args.Width = width
	args.Height = height
	return args
}
326893
func (r Tag) GetAllTagTypes() (resp []datatypes.Tag_Type, err error) {
	err = r.Session.DoRequest("SoftLayer_Tag", "getAllTagTypes", nil, &r.Options, &resp)
	return
}
461082
func POSTagShortcut(l Lexeme) (POSTag, bool) {
	switch l.LexemeType {
	case Number:
		return CD, true
	case Punctuation:
		switch l.Value {
		case ",":
			return COMMA, true
		case ".":
			return FULLSTOP, true
		case "``":
			return OPENQUOTE, true
		case "''":
			return CLOSEQUOTE, true
		case ":":
			return COLON, true
		case "#":
			return HASHSIGN, true
		case "(":
			return LEFTBRACE, true
		case ")":
			return RIGHTBRACE, true
		default:
			return X, false
		}
	case Symbol:
		return SYM, true
	case URI:
		return ADD, true
	case Date:
		return CD, true
	case Time:
		return CD, true
	case EOF:
		return X, true
	}
	return X, false
}
354927
func (s *TextArrayOptions) SetHighlightEnabled(v bool) *TextArrayOptions {
	s.HighlightEnabled = &v
	return s
}
116244
func (a *SetInspectModeArgs) SetHighlightConfig(highlightConfig HighlightConfig) *SetInspectModeArgs {
	a.HighlightConfig = &highlightConfig
	return a
}
270533
func ExtractTag(path string) string {
	match := tagExp.FindStringSubmatch(path)
	// match is []string{"whole match", "submatch"} when successful

	if len(match) != 2 {
		return ""
	}
	return match[1]
}
1352190
func extractWhitespaceTag(message ValidMessage) (plain MessagePlaintext, versions int) {
	wsPos := bytes.Index(message, whitespaceTagHeader)
	currentData := message[wsPos+len(whitespaceTagHeader):]

	for {
		aw, r, has := nextAllWhite(currentData)
		if !has {
			break
		}
		currentData = r
		if bytes.Equal(aw, otrV3{}.whitespaceTag()) {
			versions |= (1 << 3)
		} else if bytes.Equal(aw, otrV2{}.whitespaceTag()) {
			versions |= (1 << 2)
		}
	}

	plain = makeCopy(append(message[:wsPos], currentData...))
	return
}
178414
func (a *ActionAPI) FindActionTagsByPrefix(arg params.FindTags) (params.FindTagsResults, error) {
	if err := a.checkCanRead(); err != nil {
		return params.FindTagsResults{}, errors.Trace(err)
	}

	response := params.FindTagsResults{Matches: make(map[string][]params.Entity)}
	for _, prefix := range arg.Prefixes {
		m, err := a.state.Model()
		if err != nil {
			return params.FindTagsResults{}, errors.Trace(err)
		}
		found := m.FindActionTagsByPrefix(prefix)
		matches := make([]params.Entity, len(found))
		for i, tag := range found {
			matches[i] = params.Entity{Tag: tag.String()}
		}
		response.Matches[prefix] = matches
	}
	return response, nil
}
1174641
func TagsExtractMeta(tags map[string]interface{}) (InstanceCNS, map[string]interface{}) {
	nativeCNS := InstanceCNS{}
	nativeTags := make(map[string]interface{}, len(tags))
	for k, raw := range tags {
		if _, found := reservedInstanceCNSTags[k]; found {
			switch k {
			case CNSTagDisable:
				b := raw.(bool)
				nativeCNS.Disable = b
			case CNSTagReversePTR:
				s := raw.(string)
				nativeCNS.ReversePTR = s
			case CNSTagServices:
				nativeCNS.Services = strings.Split(raw.(string), ",")
			default:
				// TODO(seanc@): should assert, logic fail
			}
		} else {
			nativeTags[k] = raw
		}
	}

	return nativeCNS, nativeTags
}
322762
func (a memory) GetTagsForToken(token string) ([]string, error) {

	// look for an existing token
	entry, err := a.findMemoryToken(token)
	if err != nil {
		return nil, err
	}

	// convert tags from map to slice
	var tags []string
	for _, tag := range entry.ToSlice() {
		tags = append(tags, tag.(string))
	}

	return tags, nil
}
318542
func (list *List) PrintHighlight(element string) int {
	newIndent := len(list.indent) - 3
	indent := ""

	if newIndent > 1 {
		indent = strings.Repeat(" ", newIndent)
	}

	list.colors.Highlight.Set()
	bytes, _ := list.Print(indent + list.chooser + element)
	color.Unset()

	return bytes
}
770525
func extractTag(key string, lines []string) string {
	val, present := types.ExtractCommentTags("+", lines)[key]
	if !present || len(val) < 1 {
		return ""
	}

	return val[0]
}
1191105
func (c *Client) ListTags(p *ListTagsParameter) ([]*Tag, error) {
	obj, err := c.Request("listTags", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.([]*Tag), err
}
95021
func Extract(name, tag string) (found bool, value string, err error) {
	for tag != "" {
		// skip leading space
		i := 0
		for i < len(tag) && tag[i] == ' ' {
			i++
		}
		tag = tag[i:]
		if tag == "" {
			break
		}

		// scan to colon.
		// a space or a quote is a syntax error
		i = 0
		for i < len(tag) && tag[i] != ' ' && tag[i] != ':' && tag[i] != '"' {
			i++
		}
		if i+1 >= len(tag) || tag[i] != ':' || tag[i+1] != '"' {
			return false, "", errInvalidTag
		}
		foundName := string(tag[:i])
		tag = tag[i+1:]

		// scan quoted string to find value
		i = 1
		for i < len(tag) && tag[i] != '"' {
			if tag[i] == '\\' {
				i++
			}
			i++
		}
		if i >= len(tag) {
			return false, "", errInvalidTag
		}
		qvalue := string(tag[:i+1])
		tag = tag[i+1:]

		if foundName == name {
			value, err := strconv.Unquote(qvalue)
			if err != nil {
				return false, "", err
			}
			return true, value, nil
		}
	}
	return false, "", nil
}
1129451
func (s *handler) DetachTag(id vim.ManagedObjectReference, tag vim.VslmTagEntry) vim.BaseMethodFault {
	t := s.findTag(tag)
	if t == nil {
		return new(vim.NotFound)
	}
	delete(s.Association[t.ID], internal.AssociatedObject(id))
	return nil
}
642870
func (f *FieldSetType) AddTag(tag string) *FieldSetType {
	f.tags[tag] = struct{}{}
	return f
}