// parseUntilTag parses until it reaches the specified tag node, returning a parse error otherwise.
551881
func (t *Tree) parseUntilTag(start Pos, names ...string) (*BodyNode, error) {
	n := NewBodyNode(start)
	for {
		switch tok := t.peek(); tok.tokenType {
		case tokenEOF:
			return n, newUnexpectedEOFError(tok)

		case tokenTagOpen:
			t.next()
			tok, err := t.expect(tokenName)
			if err != nil {
				return n, err
			}
			if contains(names, tok.value) {
				return n, nil
			}
			t.backup3()
			o, err := t.parse()
			if err != nil {
				return n, err
			}
			n.Append(o)

		default:
			o, err := t.parse()
			if err != nil {
				return n, err
			}
			n.Append(o)
		}
	}
}
394640
func (c IndexEntries) IntsByTag(tag int) []int64 {
	ix := c.IndexByTag(tag)
	if ix != nil && ix.Value != nil {
		vals := make([]int64, ix.ItemCount)

		for i := 0; i < int(ix.ItemCount); i++ {
			switch ix.Type {
			case IndexDataTypeChar, IndexDataTypeInt8:
				vals[i] = int64(ix.Value.([]int8)[i])

			case IndexDataTypeInt16:
				vals[i] = int64(ix.Value.([]int16)[i])

			case IndexDataTypeInt32:
				vals[i] = int64(ix.Value.([]int32)[i])

			case IndexDataTypeInt64:
				vals[i] = ix.Value.([]int64)[i]
			}
		}

		return vals
	}

	return nil
}
754500
func tag(s interface{}, field string, tag string) (string, bool) {
	st := reflect.TypeOf(s)

	if st.Kind() == reflect.Ptr {
		st = st.Elem()
	}

	for i := 0; i <= st.NumField()-1; i++ {
		f := st.Field(i)

		if f.Name == field {
			if value, ok := f.Tag.Lookup(tag); ok {
				return value, true
			}
		}
	}

	return "", false
}
634919
func ParseInstanceTag(t string) (*api.Tag, error) {
	switch chunks := strings.SplitN(t, ":", 2); {
	case len(chunks) != 2:
		return nil, fmt.Errorf("%q doesn't look like a tag (a key:value pair)", t)
	case len(t) > 400:
		return nil, fmt.Errorf("the tag is too long, should be <=400 chars: %q", t)
	case !tagKeyRe.MatchString(chunks[0]):
		return nil, fmt.Errorf("invalid tag key in %q (should match %q)", t, tagKeyReStr)
	case strings.HasPrefix(chunks[1], " ") || strings.HasSuffix(chunks[1], " "):
		return nil, fmt.Errorf("invalid tag value in %q (should not start or end with ' ')", t)
	case !tagValRe.MatchString(chunks[1]):
		return nil, fmt.Errorf("invalid tag value in %q (should match %q)", t, tagValReStr)
	default:
		return &api.Tag{
			Key:   chunks[0],
			Value: chunks[1],
		}, nil
	}
}
203689
func parseRepositoryTag(repos string) (string, string) {
	n := strings.LastIndex(repos, ":")
	if n < 0 {
		return repos, ""
	}
	if tag := repos[n+1:]; !strings.Contains(tag, "/") {
		return repos[:n], tag
	}
	return repos, ""
}
427258
func (f *Field) AddTag(tag string) FieldInterface {
	f.tag[tag] = struct{}{}
	return f
}
1090284
func (mv *Validator) WithTag(tag string) *Validator {
	v := mv.copy()
	v.SetTag(tag)
	return v
}
100152
func (o *ListTasksParams) WithTags(tags []string) *ListTasksParams {
	o.SetTags(tags)
	return o
}
269027
func InstanceTags() ([]string, error) {
	var s []string
	j, err := Get("instance/tags")
	if err != nil {
		return nil, err
	}
	if err := json.NewDecoder(strings.NewReader(j)).Decode(&s); err != nil {
		return nil, err
	}
	return s, nil
}
594471
func (a *Annotator) Tag(tags ...TagValueGenerator) *Annotator {
	if a == nil {
		return a
	}
	tagMap := make(map[TagKey]interface{}, len(tags))
	for _, t := range tags {
		v := t.GenerateErrorTagValue()
		tagMap[v.Key] = v.Value
	}
	if len(tagMap) > 0 {
		if a.ctx.tags == nil {
			a.ctx.tags = tagMap
		} else {
			for k, v := range tagMap {
				a.ctx.tags[k] = v
			}
		}
	}
	return a
}
655981
func (b *block) Tag() (names.Tag, error) {
	tag, err := names.ParseTag(b.doc.Tag)
	if err != nil {
		return nil, errors.Annotatef(err, "getting block information")
	}
	return tag, nil
}
642870
func (f *FieldSetType) AddTag(tag string) *FieldSetType {
	f.tags[tag] = struct{}{}
	return f
}
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
}
257398
func (p *parser) parseTag() (node, error) {
	token := p.read()
	switch token.typ {
	case tokenIdentifier:
		return p.parseVar(token, true)
	case tokenRawStart:
		return p.parseRawTag()
	case tokenRawAlt:
		return p.parseVar(p.read(), false)
	case tokenComment:
		return p.parseComment()
	case tokenSectionInverse:
		return p.parseSection(true)
	case tokenSectionStart:
		return p.parseSection(false)
	case tokenPartial:
		return p.parsePartial()
	}
	return nil, p.errorf(token, "unreachable code %s", token)
}
591971
func (t *tree) beginTag() ast.Node {
	switch token := t.next(); token.typ {
	case itemNamespace:
		return t.parseNamespace(token)
	case itemTemplate:
		return t.parseTemplate(token)
	case itemIf:
		t.notmsg(token)
		return t.parseIf(token)
	case itemMsg:
		t.notmsg(token)
		return t.parseMsg(token)
	case itemPlural:
		return t.parsePlural(token)
	case itemForeach, itemFor:
		t.notmsg(token)
		return t.parseFor(token)
	case itemSwitch:
		t.notmsg(token)
		return t.parseSwitch(token, itemSwitchEnd)
	case itemCall:
		return t.parseCall(token)
	case itemLiteral:
		t.expect(itemRightDelim, "literal")
		literalText := t.expect(itemText, "literal")
		n := &ast.RawTextNode{literalText.pos, []byte(literalText.val)}
		t.expect(itemLeftDelim, "literal")
		t.expect(itemLiteralEnd, "literal")
		t.expect(itemRightDelim, "literal")
		return n
	case itemCss:
		return t.parseCss(token)
	case itemLog:
		t.expect(itemRightDelim, "log")
		logBody := t.itemList(itemLogEnd)
		t.expect(itemRightDelim, "log")
		return &ast.LogNode{token.pos, logBody}
	case itemDebugger:
		t.expect(itemRightDelim, "debugger")
		return &ast.DebuggerNode{token.pos}
	case itemLet:
		return t.parseLet(token)
	case itemAlias:
		t.parseAlias(token)
		return nil
	case itemNil, itemSpace, itemTab, itemNewline, itemCarriageReturn, itemLeftBrace, itemRightBrace:
		t.expect(itemRightDelim, "special char")
		return &ast.RawTextNode{token.pos, []byte(specialChars[token.typ])}
	case itemIdent, itemDollarIdent, itemNull, itemBool, itemFloat, itemInteger, itemString, itemNegate, itemNot, itemLeftBracket:
		// print is implicit, so the tag may also begin with any value type or unary op.
		t.backup()
		fallthrough
	case itemPrint:
		return t.parsePrint(token)
	default:
		t.unexpected(token, "tag")
	}
	return nil
}
566920
func DecodeTag(s storer.EncodedObjectStorer, o plumbing.EncodedObject) (*Tag, error) {
	t := &Tag{s: s}
	if err := t.Decode(o); err != nil {
		return nil, err
	}

	return t, nil
}
267825
func (c *SearchCall) Tag(tag ...string) *SearchCall {
	c.urlParams_.SetMulti("tag", append([]string{}, tag...))
	return c
}