// whereSubjectClause returns an element hook that updates the subject
// modifiers on the working graph clause.
555032
func whereSubjectClause() ElementHook {
	var (
		f            ElementHook
		lastNopToken *lexer.Token
	)
	f = func(st *Statement, ce ConsumedElement) (ElementHook, error) {
		if ce.IsSymbol() {
			return f, nil
		}
		tkn := ce.Token()
		c := st.WorkingClause()
		switch tkn.Type {
		case lexer.ItemNode:
			if c.S != nil {
				return nil, fmt.Errorf("invalid node in where clause that already has a subject; current %v, got %v", c.S, tkn.Type)
			}
			n, err := ToNode(ce)
			if err != nil {
				return nil, err
			}
			c.S = n
			lastNopToken = nil
			return f, nil
		case lexer.ItemBinding:
			if lastNopToken == nil {
				if c.SBinding != "" {
					return nil, fmt.Errorf("subject binding %q is already set to %q", tkn.Text, c.SBinding)
				}
				c.SBinding = tkn.Text
				lastNopToken = nil
				return f, nil
			}
			if lastNopToken.Type == lexer.ItemAs {
				if c.SAlias != "" {
					return nil, fmt.Errorf("AS alias binding for subject has already being assigned on %v", st)
				}
				c.SAlias = tkn.Text
				lastNopToken = nil
				return f, nil
			}
			if lastNopToken.Type == lexer.ItemType {
				if c.STypeAlias != "" {
					return nil, fmt.Errorf("TYPE alias binding for subject has already being assigned on %v", st)
				}
				c.STypeAlias = tkn.Text
				lastNopToken = nil
				return f, nil
			}
			if c.SIDAlias == "" && lastNopToken.Type == lexer.ItemID {
				if c.SIDAlias != "" {
					return nil, fmt.Errorf("ID alias binding for subject has already being assigned on %v", st)
				}
				c.SIDAlias = tkn.Text
				lastNopToken = nil
				return f, nil
			}
		}
		lastNopToken = tkn
		return f, nil
	}
	return f
}
671309
func ShowClauseHook() ClauseHook {
	var f ClauseHook
	f = func(s *Statement, _ Symbol) (ClauseHook, error) {
		s.sType = Show
		return f, nil
	}
	return f
}
519124
func (pb *pointBuilder) applySubstitutions(mbean string, fieldMap map[string]interface{}) {
	properties := makePropertyMap(mbean)

	for i, subKey := range pb.substitutions[1:] {

		symbol := fmt.Sprintf("$%d", i+1)
		substitution := properties[subKey]

		for fieldName, fieldValue := range fieldMap {
			newFieldName := strings.Replace(fieldName, symbol, substitution, -1)
			if fieldName != newFieldName {
				fieldMap[newFieldName] = fieldValue
				delete(fieldMap, fieldName)
			}
		}
	}
}
587290
func NextWorkingConstructPredicateObjectPair() ClauseHook {
	var f ClauseHook
	f = func(s *Statement, _ Symbol) (ClauseHook, error) {
		s.WorkingConstructClause().AddWorkingPredicateObjectPair()
		return f, nil
	}
	return f
}
1231965
func (s *SimpleEmail) SetSubject(v *SimpleEmailPart) *SimpleEmail {
	s.Subject = v
	return s
}
1300094
func (s *AssumeRoleWithWebIdentityOutput) SetSubjectFromWebIdentityToken(v string) *AssumeRoleWithWebIdentityOutput {
	s.SubjectFromWebIdentityToken = &v
	return s
}
1212308
func (c *ConstructClause) AddWorkingPredicateObjectPair() {
	if c.workingPredicateObjectPair != nil && !c.workingPredicateObjectPair.IsEmpty() {
		c.predicateObjectPairs = append(c.predicateObjectPairs, c.workingPredicateObjectPair)
	}
	c.ResetWorkingPredicateObjectPair()
}
967012
func (p *Pubsub) Subscribe(ev EventBuilder, l Listener) {
	timer := gaugeLatency(PromSubLatency)
	defer timer()

	p.subsMu.Lock()
	count := p.subs[ev.kind].Add(ev, l)
	p.subsMu.Unlock()

	if count == 1 {
		PromSubscriptions.Inc()
		written := make(chan struct{}, 1)
		p.send <- command{
			command: ev.kind.SubCommand(),
			channel: ev.Name(),
			written: written,
		}

		<-written
	}
}
986713
func NextWorkingConstructClause() ClauseHook {
	var f ClauseHook
	f = func(s *Statement, _ Symbol) (ClauseHook, error) {
		s.AddWorkingConstructClause()
		return f, nil
	}
	return f
}
186813
func (p *queryPlan) specifyClauseWithTable(ctx context.Context, cls *semantic.GraphClause, lo *storage.LookupOptions) error {
	rws := p.tbl.Rows()
	p.tbl.Truncate()
	var (
		gErr error
		mu   sync.Mutex
		wg   sync.WaitGroup
	)
	for _, tmpRow := range rws {
		wg.Add(1)
		go func(r table.Row) {
			defer wg.Done()
			var tmpCls = *cls
			// The table manipulations are now thread safe.
			if err := p.addSpecifiedData(ctx, r, &tmpCls, lo); err != nil {
				mu.Lock()
				gErr = err
				mu.Unlock()
			}
		}(tmpRow)
	}
	wg.Wait()
	return gErr
}
941183
func (s *Statement) AddWorkingConstructClause() {
	if s.workingConstructClause != nil && !s.workingConstructClause.IsEmpty() {
		s.constructClauses = append(s.constructClauses, s.workingConstructClause)
	}
	s.ResetWorkingConstructClause()
}
393693
func (s *UserPoolType) SetEmailVerificationSubject(v string) *UserPoolType {
	s.EmailVerificationSubject = &v
	return s
}
996089
func OptSrcSubjectAt(key string) SrcOption {
	return func(s *Source) error {
		s.subjectAt = key
		return nil
	}
}
1255043
func (s *Service) PubSubSubscriberClient(c context.Context, projectID string) (*pubsub.Client, error) {
	ts, err := serverAuth.GetTokenSource(
		c, serverAuth.AsSelf,
		serverAuth.WithScopes(gcps.SubscriberScopes...))
	if err != nil {
		return nil, err
	}
	return pubsub.NewClient(c, projectID,
		option.WithUserAgent(s.getUserAgent()),
		option.WithTokenSource(ts))
}
502826
func (r *Rule) MatchesWhere(parser predicate.Parser) (bool, error) {
	if r.Where == "" {
		return true, nil
	}
	ifn, err := parser.Parse(r.Where)
	if err != nil {
		return false, trace.Wrap(err)
	}
	fn, ok := ifn.(predicate.BoolPredicate)
	if !ok {
		return false, trace.BadParameter("unsupported type: %T", ifn)
	}
	return fn(), nil
}
373410
func (c *ConstructClause) String() string {
	b := bytes.NewBufferString("{ ")

	// Subject section.
	if c.S != nil {
		b.WriteString(c.S.String())
	} else {
		b.WriteString(c.SBinding)
	}

	// Predicate-object pairs section.
	for _, pop := range c.PredicateObjectPairs() {
		b.WriteString(fmt.Sprintf("%v;", pop))
	}
	b.Truncate(b.Len() - 1)
	b.WriteString(" }")
	return b.String()
}
310594
func whereNextWorkingClause() ClauseHook {
	var f ClauseHook
	f = func(s *Statement, _ Symbol) (ClauseHook, error) {
		s.AddWorkingGraphClause()
		return f, nil
	}
	return f
}