// parseETLTag functions parses DOSA "etl" tag
504962
func parseETLTag(tag string) (string, ETLState, error) {
	fullETLTag := ""
	etlTag := ""
	matches := etlPattern0.FindStringSubmatch(tag)
	if len(matches) == 2 {
		fullETLTag = matches[0]
		etlTag = matches[1]
	}

	if len(matches) == 0 {
		return "", EtlOff, nil
	}

	// filter out "trailing comma"
	etlTag = strings.TrimRight(etlTag, " ,")

	var err error
	etlTag, err = NormalizeName(etlTag)
	if err != nil {
		return "", EtlOff, err
	}

	etlState, err := ToETLState(etlTag)
	if err != nil {
		return "", EtlOff, err
	}
	return fullETLTag, etlState, nil
}
884879
func tags(x interface{}) map[string]int {
	t := reflect.TypeOf(x)
	if t.Kind() == reflect.Ptr {
		t = t.Elem()
	}
	if t.Kind() != reflect.Struct {
		panic(errors.Errorf("expected struct, not %s", t))
	}

	if tagm := tagsForType[t]; tagm != nil {
		return tagm
	}
	panic(errors.Errorf("%s not found in type table", t))
}
1116556
func lexInsideTag(l *lexer) stateFn {
	switch r := l.next(); {
	case isSpaceEOL(r):
		l.ignore()
	case r == '/' && l.peek() == '}':
		return lexRightDelimEnd
	case r == '$', r == '.':
		l.backup()
		return lexIdent
	case r == '[':
		l.emit(itemLeftBracket)
	case r == ']':
		l.emit(itemRightBracket)
	case r == '?': // used by data refs and arithmetic
		switch l.next() {
		case '.':
			l.pos -= 2
			return lexIdent
		case '[':
			l.emit(itemQuestionKey)
		case ':':
			l.emit(itemElvis)
		default:
			l.backup()
			l.emit(itemTernIf)
		}
	case r == '-':
		return lexNegative(l)
	case r == '}':
		return lexRightDelim
	case r >= '0' && r <= '9':
		l.backup()
		return lexNumber
	case r == '*', r == '/', r == '%', r == '+', r == ':', r == '(', r == ')':
		// the single-character symbols
		l.emit(arithmeticItemsBySymbol[string(r)])
	case r == '>', r == '!', r == '<', r == '=' && l.peek() == '=':
		// 1 or 2 character symbols
		l.accept("*/%+-=!<>|&?:")
		sym := l.input[l.start:l.pos]
		item, ok := arithmeticItemsBySymbol[sym]
		if !ok {
			return l.errorf("unexpected symbol: %s", sym)
		}
		l.emit(item)
	case r == '"', r == '\'':
		return stringLexer(r)
	case r == '=':
		l.emit(itemEquals)
	case r == eof:
		return l.errorf("unclosed tag")
	case r == '|':
		l.emit(itemPipe)
	case isLetterOrUnderscore(r):
		l.backup()
		return lexIdent
	case r == ',':
		l.emit(itemComma)
	default:
		return l.errorf("unrecognized character in action: %#U", r)
	}

	return lexInsideTag
}
1359966
func (t *Tree) parseTag() (Node, error) {
	name, err := t.expect(tokenName)
	if err != nil {
		return nil, err
	}
	switch name.value {
	case "extends":
		return parseExtends(t, name.Pos)
	case "block":
		return parseBlock(t, name.Pos)
	case "if", "elseif":
		return parseIf(t, name.Pos)
	case "for":
		return parseFor(t, name.Pos)
	case "include":
		return parseInclude(t, name.Pos)
	case "embed":
		return parseEmbed(t, name.Pos)
	case "use":
		return parseUse(t, name.Pos)
	case "set":
		return parseSet(t, name.Pos)
	case "do":
		return parseDo(t, name.Pos)
	case "filter":
		return parseFilter(t, name.Pos)
	case "macro":
		return parseMacro(t, name.Pos)
	case "import":
		return parseImport(t, name.Pos)
	case "from":
		return parseFrom(t, name.Pos)
	default:
		return nil, newUnexpectedTokenError(name)
	}
}
793490
func (p *parser) parseLoadStmt() *LoadStmt {
	loadPos := p.nextToken() // consume LOAD
	lparen := p.consume(LPAREN)

	if p.tok != STRING {
		p.in.errorf(p.in.pos, "first operand of load statement must be a string literal")
	}
	module := p.parsePrimary().(*Literal)

	var from, to []*Ident
	for p.tok != RPAREN && p.tok != EOF {
		p.consume(COMMA)
		if p.tok == RPAREN {
			break // allow trailing comma
		}
		switch p.tok {
		case STRING:
			// load("module", "id")
			// To name is same as original.
			lit := p.parsePrimary().(*Literal)
			id := &Ident{
				NamePos: lit.TokenPos.add(`"`),
				Name:    lit.Value.(string),
			}
			to = append(to, id)
			from = append(from, id)

		case IDENT:
			// load("module", to="from")
			id := p.parseIdent()
			to = append(to, id)
			if p.tok != EQ {
				p.in.errorf(p.in.pos, `load operand must be "%[1]s" or %[1]s="originalname" (want '=' after %[1]s)`, id.Name)
			}
			p.consume(EQ)
			if p.tok != STRING {
				p.in.errorf(p.in.pos, `original name of loaded symbol must be quoted: %s="originalname"`, id.Name)
			}
			lit := p.parsePrimary().(*Literal)
			from = append(from, &Ident{
				NamePos: lit.TokenPos.add(`"`),
				Name:    lit.Value.(string),
			})

		case RPAREN:
			p.in.errorf(p.in.pos, "trailing comma in load statement")

		default:
			p.in.errorf(p.in.pos, `load operand must be "name" or localname="name" (got %#v)`, p.tok)
		}
	}
	rparen := p.consume(RPAREN)

	if len(to) == 0 {
		p.in.errorf(lparen, "load statement must import at least 1 symbol")
	}
	return &LoadStmt{
		Load:   loadPos,
		Module: module,
		To:     to,
		From:   from,
		Rparen: rparen,
	}
}
650517
func (feed *Feed) Tags(tag string) (*FeedTag, error) {
	insta := feed.inst
	body, err := insta.sendRequest(
		&reqOptions{
			Endpoint: fmt.Sprintf(urlFeedTag, tag),
			Query: map[string]string{
				"rank_token":     insta.rankToken,
				"ranked_content": "true",
			},
		},
	)
	if err != nil {
		return nil, err
	}
	res := &FeedTag{}
	err = json.Unmarshal(body, res)
	return res, err
}
474035
func FindEC2Tag(tags []*ec2.Tag, key string) (string, bool) {
	for _, tag := range tags {
		if key == aws.StringValue(tag.Key) {
			return aws.StringValue(tag.Value), true
		}
	}
	return "", false
}
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
}
803179
func (p *Plugin) AddTag(tag *Tag) *Tag {
	p.constructor.object.Tags = append(p.constructor.object.Tags, tag)

	return tag
}
53542
func (d *Dataset) Tags(index int) ([]string, error) {
	if index < 0 || index >= d.rows {
		return nil, ErrInvalidRowIndex
	}

	return d.tags[index], nil
}
1075796
func parseNameTag(tag, defaultName string) (string, string, error) {
	fullNameTag := ""
	name := defaultName

	matches := namePattern0.FindStringSubmatch(tag)
	if len(matches) == 2 {
		fullNameTag = matches[0]
		name = matches[1]
	}

	// filter out "trailing comma"
	name = strings.TrimRight(name, " ,")

	var err error
	name, err = NormalizeName(name)
	if err != nil {
		return "", "", err
	}

	return fullNameTag, name, nil
}
1188061
func parseFieldTag(structField reflect.StructField, dosaAnnotation string) (*ColumnDefinition, error) {
	typ, isPointer, err := typify(structField.Type)
	if err != nil {
		return nil, err
	}
	return parseField(typ, isPointer, structField.Name, dosaAnnotation)
}
130352
func (r *Route) Tag(value interface{}) *Route {
	if len(r.routes) > 0 {
		// this route is a composite one (a path with multiple methods)
		for _, route := range r.routes {
			route.Tag(value)
		}
		return r
	}
	if r.tags == nil {
		r.tags = []interface{}{}
	}
	r.tags = append(r.tags, value)
	return r
}
1357818
func (bltn *Bulletin) Tags() Tags {
	m := bltn.Wire.GetMessage()
	return ParseTags(m)
}
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
		}
	}
}
987591
func (c IndexEntries) BytesByTag(tag int) []byte {
	i := c.IndexByTag(tag)
	if i == nil || i.Value == nil {
		return nil
	}
	b, ok := i.Value.([]byte)
	if !ok {
		return nil
	}
	return b
}
308714
func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool {
	if len(tag) == 0 {
		return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty")
	}
	for i := 0; i < len(emitter.tag_directives); i++ {
		tag_directive := &emitter.tag_directives[i]
		if bytes.HasPrefix(tag, tag_directive.prefix) {
			emitter.tag_data.handle = tag_directive.handle
			emitter.tag_data.suffix = tag[len(tag_directive.prefix):]
		}
		return true
	}
	emitter.tag_data.suffix = tag
	return true
}