// parseBottom parse the line under the abstract
193637
func parseBottom(s *goquery.Selection) (clusterId, numCite, numVer, infoId string) {
	divFooter := s.Find(article_bottom_selector)
	parseFooter := func(i int, s *goquery.Selection) {

		href, _ := s.Attr("href")
		text := s.Text()

		if strings.HasPrefix(href, "/scholar?cites") {
			clusterId = parseClusterIdText(href)
			numCite = parseNumCiteText(text)
		}
		if strings.HasPrefix(href, "/scholar?cluster") {
			numVer = parseNumVerText(text)
		}
		if strings.HasPrefix(href, "/scholar?q=related") {
			infoId = parseInfoIdText(href)
		}

	}
	divFooter.Find("a").Each(parseFooter)

	return clusterId, numCite, numVer, infoId
}
367755
func ParseInto(s string, dest map[string]interface{}) error {
	scanner := bytes.NewBufferString(s)
	t := newParser(scanner, dest, false)
	return t.parse()
}
193246
func (t *tree) parseMapLiteral(first item, expr ast.Node) ast.Node {
	firstKey, ok := expr.(*ast.StringNode)
	if !ok {
		t.errorf("expected a string as map key, got: %T", expr)
	}

	var items = make(map[string]ast.Node)
	var key = firstKey.Value
	for {
		items[key] = t.parseExpr(0)
		next := t.next()
		if next.typ == itemRightBracket {
			return &ast.MapLiteralNode{first.pos, items}
		}
		if next.typ != itemComma {
			t.unexpected(next, "map literal")
		}
		tok := t.expect(itemString, "map literal")
		var err error
		key, err = unquoteString(tok.val)
		if err != nil {
			t.error(err)
		}
		t.expect(itemColon, "map literal")
	}
}
674570
func ParseBool(b string) *bool {
	var truth bool
	switch b {
	case "enabled":
		truth = true
	case "disabled":
		truth = false
	default:
		return nil
	}
	return &truth
}
1067410
func ParseBewit(bewit string) (*Auth, error) {
	if len(bewit)%4 != 0 {
		bewit += strings.Repeat("=", 4-len(bewit)%4)
	}
	decoded, err := base64.URLEncoding.DecodeString(bewit)
	if err != nil {
		return nil, AuthFormatError{"bewit", "malformed base64 encoding"}
	}
	components := bytes.SplitN(decoded, []byte(`\`), 4)
	if len(components) != 4 {
		return nil, AuthFormatError{"bewit", "missing components"}
	}

	auth := &Auth{
		Credentials:     Credentials{ID: string(components[0])},
		Ext:             string(components[3]),
		Method:          "GET",
		ActualTimestamp: Now(),
		IsBewit:         true,
	}

	ts, err := strconv.ParseInt(string(components[1]), 10, 64)
	if err != nil {
		return nil, AuthFormatError{"ts", "not an integer"}
	}
	auth.Timestamp = time.Unix(ts, 0)

	auth.MAC = make([]byte, base64.StdEncoding.DecodedLen(len(components[2])))
	n, err := base64.StdEncoding.Decode(auth.MAC, components[2])
	if err != nil {
		return nil, AuthFormatError{"mac", "malformed base64 encoding"}
	}
	auth.MAC = auth.MAC[:n]

	return auth, nil
}
1139064
func (p *parser) BOM() error {
	mask, err := p.buf.Peek(2)
	if err != nil && err != io.EOF {
		return err
	} else if len(mask) < 2 {
		return nil
	}

	switch {
	case mask[0] == 254 && mask[1] == 255:
		fallthrough
	case mask[0] == 255 && mask[1] == 254:
		p.buf.Read(mask)
	case mask[0] == 239 && mask[1] == 187:
		mask, err := p.buf.Peek(3)
		if err != nil && err != io.EOF {
			return err
		} else if len(mask) < 3 {
			return nil
		}
		if mask[2] == 191 {
			p.buf.Read(mask)
		}
	}
	return nil
}
557795
func parseAct(desc string) (string, actFunc) {
	for k, v := range actMap {
		if strings.HasPrefix(desc, k) {
			return k, v
		}
	}
	return "", nil
}
272347
func (builder *FetchValueCommandBuilder) WithBasicQuorum(basicQuorum bool) *FetchValueCommandBuilder {
	builder.protobuf.BasicQuorum = &basicQuorum
	return builder
}
1092573
func parseGMT(value string) int {
	value = value[3:]
	if len(value) == 0 {
		return 3
	}

	return 3 + parseSignedOffset(value)
}
1329885
func (builder *FetchMapCommandBuilder) WithBasicQuorum(basicQuorum bool) *FetchMapCommandBuilder {
	builder.protobuf.BasicQuorum = &basicQuorum
	return builder
}
254729
func parseAction(name, text string) (*Parser, error) {
	p, err := Parse(name, fmt.Sprintf("%s%s%s", leftDelim, text, rightDelim))
	// when error happens, p will be nil, so we need to return here
	if err != nil {
		return p, err
	}
	p.Root = p.Root.Nodes[0].(*ListNode)
	return p, nil
}
192931
func (c *Client) DecodeBottleTiny(resp *http.Response) (*BottleTiny, error) {
	var decoded BottleTiny
	err := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get("Content-Type"))
	return &decoded, err
}
113790
func ParseZoom(zoom string) ZoomLevel {
	switch ZoomLevel(zoom) {
	case BlockZoom:
		return BlockZoom
	case WindowZoom:
		return WindowZoom
	}
	return DefaultZoomLevel
}
552820
func ParseASTBytes(b []byte) ([]AST, error) {
	lexer := iniLexer{}
	tokens, err := lexer.tokenize(b)
	if err != nil {
		return []AST{}, err
	}

	return parse(tokens)
}
717252
func ParseBoolFlag(s string) (bf BoolFlag, err error) {
	switch s {
	case "on":
		bf = true
	case "off":
		bf = false
	default:
		err = fmt.Errorf("invalid value ‘%s’ for BoolFlag", s)
	}

	return bf, err
}
832768
func (parser *StandardResultParser) ParseSpellCheck(response *SolrResponse, sr *SolrResult) {
	if spellCheck, ok := response.Response["spellcheck"].(map[string]interface{}); ok {
		sr.SpellCheck = spellCheck
	}
}
32989
func parseLine(r *regexp.Regexp, line string) (int, error) {
	matches := r.FindStringSubmatch(line)
	switch len(matches) {
	case 0:
		return -1, nil
	case 2:
		return strconv.Atoi(matches[1])
	default:
		return 0, ErrBadSgdiskOutput
	}
}