// ParseStyleEntry parses a Pygments style entry.
970060
func ParseStyleEntry(entry string) (StyleEntry, error) { // nolint: gocyclo
	out := StyleEntry{}
	parts := strings.Fields(entry)
	for _, part := range parts {
		switch {
		case part == "italic":
			out.Italic = Yes
		case part == "noitalic":
			out.Italic = No
		case part == "bold":
			out.Bold = Yes
		case part == "nobold":
			out.Bold = No
		case part == "underline":
			out.Underline = Yes
		case part == "nounderline":
			out.Underline = No
		case part == "inherit":
			out.NoInherit = false
		case part == "noinherit":
			out.NoInherit = true
		case part == "bg:":
			out.Background = 0
		case strings.HasPrefix(part, "bg:#"):
			out.Background = ParseColour(part[3:])
			if !out.Background.IsSet() {
				return StyleEntry{}, fmt.Errorf("invalid background colour %q", part)
			}
		case strings.HasPrefix(part, "border:#"):
			out.Border = ParseColour(part[7:])
			if !out.Border.IsSet() {
				return StyleEntry{}, fmt.Errorf("invalid border colour %q", part)
			}
		case strings.HasPrefix(part, "#"):
			out.Colour = ParseColour(part)
			if !out.Colour.IsSet() {
				return StyleEntry{}, fmt.Errorf("invalid colour %q", part)
			}
		default:
			return StyleEntry{}, fmt.Errorf("unknown style element %q", part)
		}
	}
	return out, nil
}
383383
func (c *Cell) GetStyle() *Style {
	if c.style == nil {
		c.style = NewStyle()
	}
	return c.style
}
643359
func readStyle(runes []rune, defaultStyle Style) Style {
	style := defaultStyle
	split := strings.Split(string(runes), tokenItemSeparator)
	for _, item := range split {
		pair := strings.Split(item, tokenValueSeparator)
		if len(pair) == 2 {
			switch pair[0] {
			case tokenFg:
				style.Fg = StyleParserColorMap[pair[1]]
			case tokenBg:
				style.Bg = StyleParserColorMap[pair[1]]
			case tokenModifier:
				style.Modifier = modifierMap[pair[1]]
			}
		}
	}
	return style
}
627336
func Entry(logLevel lager.LogLevel, options ...option) logEntry {
	entry := logEntry(lager.LogFormat{
		LogLevel: logLevel,
		Data:     lager.Data{},
	})

	for _, option := range options {
		option(&entry)
	}

	return entry
}
1294057
func WriteCodeEntry(w io.Writer, entry *module.CodeEntry) error {

	if err := leb128.WriteVarUint32(w, uint32(len(entry.Func.Locals))); err != nil {
		return err
	}

	for _, local := range entry.Func.Locals {

		if err := leb128.WriteVarUint32(w, local.Count); err != nil {
			return err
		}

		if err := writeValueType(w, local.Type); err != nil {
			return err
		}
	}

	return writeInstructions(w, entry.Func.Expr.Instrs)
}
897470
func (parser *Parser) ParseStylesheet() (*css.Stylesheet, error) {
	result := css.NewStylesheet()

	// Parse BOM
	if _, err := parser.parseBOM(); err != nil {
		return result, err
	}

	// Parse list of rules
	rules, err := parser.ParseRules()
	if err != nil {
		return result, err
	}

	result.Rules = rules

	return result, nil
}
64797
func cStyle(bytes []byte, msbf bool) string {
	output := "{"
	if !msbf {
		bytes = reverse(bytes)
	}
	for i, b := range bytes {
		if i != 0 {
			output += ", "
		}
		output += fmt.Sprintf("0x%02X", b)
	}
	output += "}"
	return output
}
887225
func (i *Interpreter) AddDictionaryEntry(e DictionaryEntry) {
	i.dictionary[dictionaryKey{e.EnterpriseID, e.FieldID}] = e
}
1090536
func NewStyleDeclaration(styleRule *StyleRule, declaration *css.Declaration) *StyleDeclaration {
	return &StyleDeclaration{
		StyleRule:   styleRule,
		Declaration: declaration,
	}
}
1125562
func Parse(in string) (*Entry, error) {
	fields := strings.Split(in, "\t")
	e := Entry{}

	if len(fields) < 3 {
		return nil, fmt.Errorf("too few fields: %q", in)
	}

	e.Sym = fields[0]
	e.Path = fields[1]

	lstr := fields[2]
	if len(lstr) < 2 {
		return nil, fmt.Errorf("got %q for linenum field", lstr)
	}

	l, err := strconv.ParseInt(lstr[:len(lstr)-2], 10, 64)
	if err != nil {
		return nil, err
	}
	e.Line = int(l)
	e.Kind = fields[3]

field:
	for _, f := range fields[3:] {
		if string(f) == "file:" {
			e.FileLimited = true
		}
		for _, p := range []string{"class", "enum"} {
			if strings.HasPrefix(f, p+":") {
				e.Parent = strings.TrimPrefix(f, p+":")
				e.ParentType = p
				continue field
			}
		}
	}
	return &e, nil
}
908459
func (cs *StreamManager) LockProtectedEntry(e *Entry) {
	for i := range e.Values {
		if bool(e.Values[i].Value.Protected) {
			e.Values[i].Value.Content = cs.Pack([]byte(e.Values[i].Value.Content))
		}
	}
	for i := range e.Histories {
		cs.LockProtectedEntries(e.Histories[i].Entries)
	}
}
420837
func (p *MemoryPool) addEntry(entryID string, entry *token.PlainOutput) {
	p.entries[entryID] = cloneOutput(entry)
}
1203925
func keywordEntries(keywords []Keyword) []Entry {
	// Convert all of the keywords to zero-value keyvals.
	return []Entry{
		{
			Type: CommentType,
			Raw:  fmt.Sprintf("#%16s%s", "keywords: ", strings.Join(FromKeywords(keywords), ",")),
		},
	}
}
518199
func (b *GCSBuilder) AddEntry(data []byte) *GCSBuilder {
	// Do nothing if the builder's already errored out.
	if b.err != nil {
		return b
	}

	b.data[string(data)] = struct{}{}
	return b
}
714935
func (r *Room) Entry(ctx context.Context) (*protos.Response, error) {
	fakeUID := uuid.New().String() // just use s.ID as uid !!!
	s := pitaya.GetSessionFromCtx(ctx)
	err := s.Bind(ctx, fakeUID) // binding session uid
	if err != nil {
		return nil, pitaya.Error(err, "ENT-000")
	}
	return reply(200, "ok"), nil
}
1226413
func (element *Element) addStyleRule(styleRule *StyleRule) {
	element.styleRules = append(element.styleRules, styleRule)
}
290033
func (de *decoder) mapEntry(slval reflect.Value, vb []byte) error {
	mKey := reflect.New(slval.Type().Key())
	mVal := reflect.New(slval.Type().Elem())
	k := mKey.Elem()
	v := mVal.Elem()
	key, n := binary.Uvarint(vb)
	if n <= 0 {
		return errors.New("bad protobuf field key")
	}
	buf := vb[n:]
	wiretype := int(key & 7)

	var err error
	buf, err = de.value(wiretype, buf, k)
	if err != nil {
		return err
	}
	for len(buf) > 0 { // for repeated values (slices etc)
		key, n = binary.Uvarint(buf)
		if n <= 0 {
			return errors.New("bad protobuf field key")
		}
		buf = buf[n:]
		wiretype = int(key & 7)
		buf, err = de.value(wiretype, buf, v)
		if err != nil {
			return err
		}
	}

	if !k.IsValid() || !v.IsValid() {
		// We did not decode the key or the value in the map entry.
		// Either way, it's an invalid map entry.
		return errors.New("proto: bad map data: missing key/val")
	}
	slval.SetMapIndex(k, v)

	return nil
}