// Add associates a Regular expression to a lookupValue that will be used in
// the lookup functions. It will return an error and data will be not saved if
// the regexp does not compile correctly
326845
func (m *RegexpMap) Add(reStr string, lookupValue string) error {
	_, exists := m.rules[reStr]
	if !exists {
		rule, err := regexp.Compile(reStr)
		if err != nil {
			return err
		}
		m.rules[reStr] = rule
	}
	val, exists := m.lookupValues[lookupValue]
	if !exists {
		val = NewRegexpList()
		m.lookupValues[lookupValue] = val
	}
	val.Add(reStr)

	lookupCount, exists := m.rulesRelation[reStr]
	if !exists {
		lookupCount = refCount{}
		m.rulesRelation[reStr] = lookupCount
	}
	lookupCount.Increment(lookupValue)
	return nil
}
86071
func (m *M) AddRegexp(pattern *regexp.Regexp, minifier Minifier) {
	m.mutex.Lock()
	m.pattern = append(m.pattern, patternMinifier{pattern, minifier})
	m.mutex.Unlock()
}
228626
func Add(e Expr, weight float32, words []string) {
	for _, w := range words {
		e.Add(weight, w)
	}
}
322915
func (s *Statement) Add(code ...Code) *Statement {
	*s = append(*s, code...)
	return s
}
212734
func (t *StringTree) Add(o string) (val string, isDupe bool) {
	v, d := t.Tree.Add(o)
	if v != nil {
		return v.(string), d
	}
	return "", d
}
1258373
func (c *IDTokenClaims) Add(key string, value interface{}) {
	if c.Extra == nil {
		c.Extra = make(map[string]interface{})
	}
	c.Extra[key] = value
}
1311387
func (c *Scratch) Add(key string, newAddend interface{}) (string, error) {

	var newVal interface{}
	c.mu.RLock()
	existingAddend, found := c.values[key]
	c.mu.RUnlock()
	if found {
		var err error

		addendV := reflect.TypeOf(existingAddend)

		if addendV.Kind() == reflect.Slice || addendV.Kind() == reflect.Array {
			newVal, err = collections.Append(existingAddend, newAddend)
			if err != nil {
				return "", err
			}
		} else {
			newVal, err = math.DoArithmetic(existingAddend, newAddend, '+')
			if err != nil {
				return "", err
			}
		}
	} else {
		newVal = newAddend
	}
	c.mu.Lock()
	c.values[key] = newVal
	c.mu.Unlock()
	return "", nil // have to return something to make it work with the Go templates
}
1086050
func (s *stringSet) Add(vs ...string) {
	for _, v := range vs {
		s.values[v] = struct{}{}
	}
}
809916
func (t *Tagger) Add(tag ...string) {
	t.tags = append(t.tags, tag...)
}
507220
func (p Params) Add(k, v string) {
	if param, ok := p[k]; ok {
		switch param.(type) {
		case string:
			param = []string{param.(string), v}
		case []string:
			param = append(param.([]string), v)
		}
		p[k] = param
	} else {
		p[k] = v
	}
}
619178
func (c *Client) Add(key, val string, flags, exp uint32) (cas uint64, err error) {
	// Variants: Add [Q]
	return c.setGeneric(opAdd, key, val, 0, flags, exp)
}
951209
func (c Context) Add(z, x, y *Big) *Big {
	if debug {
		x.validate()
		y.validate()
	}
	if z.invalidContext(c) {
		return z
	}

	if x.IsFinite() && y.IsFinite() {
		z.form = c.add(z, x, x.form, y, y.form)
		return c.round(z)
	}

	// NaN + NaN
	// NaN + y
	// x + NaN
	if z.checkNaNs(x, y, addition) {
		return z
	}

	if x.form&inf != 0 {
		if y.form&inf != 0 && x.form^y.form == signbit {
			// +Inf + -Inf
			// -Inf + +Inf
			return z.setNaN(InvalidOperation, qnan, addinfinf)
		}
		// ±Inf + y
		// +Inf + +Inf
		// -Inf + -Inf
		return z.Set(x)
	}
	// x + ±Inf
	return z.Set(y)
}
1199516
func (m *NormMap) add(l int64) bool {
	assert(m.size <= 256) // once we add > 256 values, we nullify the map in addNumericField and don't use this strategy
	if l >= math.MinInt8 && l <= math.MaxInt8 {
		index := int(l + 128)
		if previous := m.singleByteRange[index]; previous < 0 {
			m.singleByteRange[index] = int16(m.size)
			m.size++
			return true
		}
		return false
	}
	if _, ok := m.other[l]; !ok {
		m.other[l] = int16(m.size)
		m.size++
		return true
	}
	return false
}
353941
func (f *Filter) Add(filter, value string) {
	f.v.Add(filter, value)
}
1177716
func (f *Float64) Add(s float64) float64 {
	for {
		old := f.Load()
		new := old + s
		if f.CAS(old, new) {
			return new
		}
	}
}
343495
func Compile(expr string) (*Regexp, error) {
	re, err := syntax.Parse(expr, syntax.Perl)
	if err != nil {
		return nil, err
	}
	sre := re.Simplify()
	prog, err := syntax.Compile(sre)
	if err != nil {
		return nil, err
	}
	if err := toByteProg(prog); err != nil {
		return nil, err
	}
	r := &Regexp{
		Syntax: re,
		expr:   expr,
	}
	if err := r.m.init(prog); err != nil {
		return nil, err
	}
	return r, nil
}
999346
func (reg *Registrant) addValues(u url.Values) error {
	if u == nil {
		return errors.New("nil value passed as url.Values")
	}

	val := reflect.ValueOf(*reg)
	t := val.Type()
	for i := 0; i < val.NumField(); i++ {
		fieldName := t.Field(i).Name
		field := val.Field(i).String()
		if ty := val.Field(i).Kind(); ty != reflect.String {
			return fmt.Errorf(
				"Registrant cannot have types that aren't string; %s is type %s",
				fieldName, ty,
			)
		}
		if field == "" {
			if strings.Contains(fieldName, "ddress2") {
				continue
			}

			return fmt.Errorf("Field %s cannot be empty", fieldName)
		}

		u.Set(fieldName, fmt.Sprintf("%v", field))
	}

	return nil
}