// AcceptCharset returns the most preferred charset from the HTTP Accept-Charset header.
// If nothing accepted, then empty string is returned.
359981
func (ctx *Context) AcceptCharset(preferred ...string) string {
	return negotiator.New(ctx.Req.Header).Charset(preferred...)
}
179167
func (l *ReaderLexer) AcceptRunExcept(valid string) bool {
	guard := Mark("AcceptRunExcept")
	defer guard()
	return AcceptRunExcept(l, valid)
}
530297
func GetCharsetOption(defaultValue string, options map[string]interface{}) string {
	charsetOpt := options["charset"]
	if s, isString := charsetOpt.(string); isString {
		return s
	}
	return defaultValue
}
721435
func (l *lexer) acceptBareString() {
	l.acceptFunc(
		func(r rune) bool {
			return !any(r, bareStringDisallowed) && r != eof
		},
	)
}
644628
func (this *Request) AcceptedCharsets() []string {
	if this.acceptedCharsets == nil {
		a := this.Header.Get("Accept-Charset")
		this.acceptedCharsets = this.processAccepted(a)
	}
	return this.acceptedCharsets
}
1050018
func (s *SimpleEmailPart) SetCharset(v string) *SimpleEmailPart {
	s.Charset = &v
	return s
}
432274
func (this *Request) Accepts(t string) bool {
	for _, v := range this.Accepted() {
		if strings.ToLower(t) == v {
			return true
		}
	}
	return false
}
1103896
func (l *StringLexer) PeekString(word string) bool {
	return AcceptString(l, word, true)
}
764360
func (s *server) Accept() (Session, error) {
	var sess Session
	select {
	case sess = <-s.sessionQueue:
		return sess, nil
	case <-s.errorChan:
		return nil, s.serverError
	}
}
303546
func (c *SearchCriteria) ParseWithCharset(fields []interface{}, charsetReader func(io.Reader) io.Reader) error {
	for len(fields) > 0 {
		var err error
		if fields, err = c.parseField(fields, charsetReader); err != nil {
			return err
		}
	}
	return nil
}
699960
func (sv *StringVisitor) AcceptAnd(v And) {
	sv.result = fmt.Sprintf("%s(and ", sv.result)
	v.Left.Accept(sv)
	sv.result += " "
	v.Right.Accept(sv)
	sv.result += ")"
}
1073690
func (t *precompilationTypeChecker) AcceptArgument(v tree.Argument) {
	if v.Type == tree.Full {
		t.result = fmt.Errorf("no full arguments allowed - this is probably a programmer error: %s", tree.ExpressionString(v))
	}
}
1301471
func (accept AcceptSlice) Accepts(ctype string) bool {
	t, err := accept.Negotiate(ctype)
	if t == "" || err != nil {
		return false
	}
	return true
}
557207
func (l *Levenshtein) Accept(s int, b byte) int {
	if s < len(l.dfa.states) {
		return l.dfa.states[s].next[b]
	}
	return 0
}
536274
func (sv *StringVisitor) AcceptBooleanLiteral(v BooleanLiteral) {
	if v.Value {
		sv.result += "true"
	} else {
		sv.result += "false"
	}
}
574910
func charsetFromHTMLString(htmlString string) (string, error) {
	if charsetRegexp == nil {
		var err error
		charsetRegexp, err = regexp.Compile(`(?i)<meta.*charset="?\s*(?P<charset>[a-zA-Z0-9_.:-]+)\s*"`)
		if err != nil {
			charsetRegexp = nil
			return "", err
		}
	}

	charsetMatches := charsetRegexp.FindAllStringSubmatch(htmlString, -1)

	if len(charsetMatches) > 0 {
		n1 := charsetRegexp.SubexpNames()
		r2 := charsetMatches[0]

		md := map[string]string{}
		for i, n := range r2 {
			md[n1[i]] = n
		}

		return md["charset"], nil
	}

	return "", errParsingCharset
}
1305716
func (l *lexer) acceptLine(permitEscaping bool) {
	escaped := false
	for {
		if !permitEscaping {
			escaped = false
		}
		nxt := l.peek()
		switch nxt {
		case '\n':
			l.next()
			if !escaped {
				return
			}
		case eof:
			return
		case '\\':
			escaped = true
			l.next()
			continue
		default:
			l.next()
		}
		escaped = false
	}
}