// Parses a new tag
500284
func ParseTag(readSeeker io.ReadSeeker) *Tag {
	header := ParseHeader(readSeeker)

	if header == nil {
		return nil
	}

	t := NewTag(header.version)
	t.Header = header

	var frame Framer
	size := int(t.size)
	for size > 0 {
		frame = t.frameConstructor(readSeeker)

		if frame == nil {
			break
		}

		id := frame.Id()
		t.frames[id] = append(t.frames[id], frame)
		frame.setOwner(t)

		size -= t.frameHeaderSize + int(frame.Size())
	}

	t.padding = uint(size)
	if _, err := readSeeker.Seek(int64(HeaderSize+t.Size()), os.SEEK_SET); err != nil {
		return nil
	}

	return t
}
984505
func ParseTags(m string) Tags {
	maxNum := 5
	tags := make(Tags)
	var r rune
	var i_s int = 0

	for i := 0; i < len(m); i += i_s {
		r, i_s = utf8.DecodeRuneInString(m[i:])
		if r == '#' {
			var j_s int
			var v rune
			var j int
			for j = i; j < len(m); j += j_s {
				v, j_s = utf8.DecodeRuneInString(m[j:])
				if isTagBreak(v) {
					break
				}
			}
			tag := Tag(m[i:j])
			//fmt.Printf("i: %d, j: %d, tag: %s\n", i, j, tag)
			if len(tags) >= maxNum {
				break
			}
			tags[tag] = struct{}{}
			i = j
			i_s = 0
		}
	}
	return tags
}
534611
func (t *PEP425Tag) TagString() string {
	return strings.Join([]string{t.Python, t.Abi, t.Platform}, "-")
}
439275
func ParseReader(rd io.Reader, opts Options) (*Tag, error) {
	tag := NewEmptyTag()
	err := tag.parse(rd, opts)
	return tag, err
}
551345
func New(msg string, tags ...TagValueGenerator) error {
	tse := &terminalStackError{
		errors.New(msg), stackFrameInfo{forStack: captureStack(1)}, nil}
	if len(tags) > 0 {
		tse.tags = make(map[TagKey]interface{}, len(tags))
		for _, t := range tags {
			v := t.GenerateErrorTagValue()
			tse.tags[v.Key] = v.Value
		}
	}
	return tse
}
146973
func (z *Tokenizer) readTag(saveAttr bool) {
	z.attr = z.attr[:0]
	z.nAttrReturned = 0
	// Read the tag name and attribute key/value pairs.
	z.readTagName()
	if z.skipWhiteSpace(); z.err != nil {
		return
	}
	for {
		c := z.readByte()
		if z.err != nil || c == '>' {
			break
		}
		z.raw.end--
		z.readTagAttrKey()
		z.readTagAttrVal()
		// Save pendingAttr if saveAttr and that attribute has a non-empty key.
		if saveAttr && z.pendingAttr[0].start != z.pendingAttr[0].end {
			z.attr = append(z.attr, z.pendingAttr)
		}
		if z.skipWhiteSpace(); z.err != nil {
			break
		}
	}
}
267825
func (c *SearchCall) Tag(tag ...string) *SearchCall {
	c.urlParams_.SetMulti("tag", append([]string{}, tag...))
	return c
}
828050
func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool {
	var handle, suffix []byte

	start_mark := parser.mark

	// Check if the tag is in the canonical form.
	if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) {
		return false
	}

	if parser.buffer[parser.buffer_pos+1] == '<' {
		// Keep the handle as ''

		// Eat '!<'
		skip(parser)
		skip(parser)

		// Consume the tag value.
		if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) {
			return false
		}

		// Check for '>' and eat it.
		if parser.buffer[parser.buffer_pos] != '>' {
			yaml_parser_set_scanner_error(parser, "while scanning a tag",
				start_mark, "did not find the expected '>'")
			return false
		}

		skip(parser)
	} else {
		// The tag has either the '!suffix' or the '!handle!suffix' form.

		// First, try to scan a handle.
		if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) {
			return false
		}

		// Check if it is, indeed, handle.
		if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' {
			// Scan the suffix now.
			if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) {
				return false
			}
		} else {
			// It wasn't a handle after all.  Scan the rest of the tag.
			if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) {
				return false
			}

			// Set the handle to '!'.
			handle = []byte{'!'}

			// A special case: the '!' tag.  Set the handle to '' and the
			// suffix to '!'.
			if len(suffix) == 0 {
				handle, suffix = suffix, handle
			}
		}
	}

	// Check the character which ends the tag.
	if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) {
		return false
	}
	if !is_blankz(parser.buffer, parser.buffer_pos) {
		yaml_parser_set_scanner_error(parser, "while scanning a tag",
			start_mark, "did not find expected whitespace or line break")
		return false
	}

	end_mark := parser.mark

	// Create a token.
	*token = yaml_token_t{
		typ:        yaml_TAG_TOKEN,
		start_mark: start_mark,
		end_mark:   end_mark,
		value:      handle,
		suffix:     suffix,
	}
	return true
}
1112030
func (f *Field) Tag(key string) string {
	return f.field.Tag.Get(key)
}
507723
func NormalizeTag(tag string) string {
	tag = strings.ToLower(tag)
	return strings.Replace(tag, "_", "-", -1)
}
202452
func (mr *MockEntityMockRecorder) Tag() *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tag", reflect.TypeOf((*MockEntity)(nil).Tag))
}
1176164
func (r *Relation) Tag() names.Tag {
	return names.NewRelationTag(r.doc.Key)
}
731278
func (search *Search) Tags(tag string) (*SearchResult, error) {
	insta := search.inst
	body, err := insta.sendRequest(
		&reqOptions{
			Endpoint: urlSearchTag,
			Query: map[string]string{
				"is_typeahead": "true",
				"rank_token":   insta.rankToken,
				"q":            tag,
			},
		},
	)
	if err != nil {
		return nil, err
	}

	res := &SearchResult{}
	err = json.Unmarshal(body, res)
	return res, err
}
751662
func (c *Manager) CreateTag(ctx context.Context, tag *Tag) (string, error) {
	// create avoids the annoyance of CreateTag requiring a "description" key to be included in the request,
	// even though the field value can be empty.
	type create struct {
		Name        string `json:"name"`
		Description string `json:"description"`
		CategoryID  string `json:"category_id"`
	}
	spec := struct {
		Tag create `json:"create_spec"`
	}{
		Tag: create{
			Name:        tag.Name,
			Description: tag.Description,
			CategoryID:  tag.CategoryID,
		},
	}
	if isName(tag.CategoryID) {
		cat, err := c.GetCategory(ctx, tag.CategoryID)
		if err != nil {
			return "", err
		}
		spec.Tag.CategoryID = cat.ID
	}
	url := internal.URL(c, internal.TagPath)
	var res string
	return res, c.Do(ctx, url.Request(http.MethodPost, spec), &res)
}
175102
func NewTag(code int, value DataType) *Tag {
	tag := new(Tag)
	tag.Code = code
	tag.Value = value
	return tag
}
836367
func Tag(c context.Context, v string) context.Context {
	return context.WithValue(c, &clockTagKey, append(Tags(c), v))
}
216614
func (r *Record) Tag(tag []byte) (v Aux, ok bool) {
	if len(tag) < 2 {
		panic("sam: tag too short")
	}
	for _, aux := range r.AuxFields {
		if aux.matches(tag) {
			return aux, true
		}
	}
	return nil, false
}