// ChanType = ( "chan" [ "<-" ] | "<-" "chan" ) Type .
977191
func (p *gc_parser) parse_chan_type() ast.Expr {
	dir := ast.SEND | ast.RECV
	if p.tok == scanner.Ident {
		p.expect_keyword("chan")
		if p.tok == '<' {
			p.expect_special("<-")
			dir = ast.SEND
		}
	} else {
		p.expect_special("<-")
		p.expect_keyword("chan")
		dir = ast.RECV
	}

	elt := p.parse_type()
	return &ast.ChanType{Dir: dir, Value: elt}
}
107855
func AscIfType(p1Ptr, p2Ptr *IfAddr) int {
	return AscType(&p1Ptr.SockAddr, &p2Ptr.SockAddr)
}
1004615
func (s *ScanService) Type(typ string) *ScanService {
	if s.types == nil {
		s.types = make([]string, 0)
	}
	s.types = append(s.types, typ)
	return s
}
745548
func IsLeafType(ttype Type) bool {
	switch GetNamed(ttype).(type) {
	case *Scalar, *Enum:
		return true
	default:
		return false
	}
}
385118
func (L *State) CheckType(narg int, t LuaValType) {
	C.luaL_checktype(L.s, C.int(narg), C.int(t))
}
478621
func (s *ExistsService) Type(typ string) *ExistsService {
	s.typ = typ
	return s
}
795562
func (p *page) Type() string {
	if (p.flags & branchPageFlag) != 0 {
		return "branch"
	} else if (p.flags & leafPageFlag) != 0 {
		return "leaf"
	} else if (p.flags & metaPageFlag) != 0 {
		return "meta"
	} else if (p.flags & freelistPageFlag) != 0 {
		return "freelist"
	}
	return fmt.Sprintf("unknown<%02x>", p.flags)
}
1131550
func (r *Response) Type(kind string) *Response {
	mime := BodyTypeAliases[kind]
	if mime != "" {
		kind = mime
	}
	r.Header.Set("Content-Type", kind)
	return r
}
69426
func (t *Type) typeName() string {
	if strings.HasSuffix(t.Type, "[]") {
		return strings.TrimSuffix(t.Type, "[]")
	}
	return t.Type
}
774082
func (item *MultiGetItem) Type(typ string) *MultiGetItem {
	item.typ = typ
	return item
}
266158
func (s *PutMappingService) Type(typ string) *PutMappingService {
	s.typ = typ
	return s
}
572027
func (n rootNode) Type() Type {

	switch {
	case n.err != nil:
		// for error, return TypeError
		return TypeError
	case n.buf == nil || len(n.buf) == 0:
		// for nil raw, return TypeUndefined
		return TypeUndefined
	case n.buf[0] == '"':
		// simply examine the first character
		// to determine the value type
		return TypeString
	case n.buf[0] == '{':
		// simply examine the first character
		// to determine the value type
		return TypeObject
	case n.buf[0] == '[':
		// simply examine the first character
		// to determine the value type
		return TypeArray
	case string(n.buf) == "true":
		fallthrough
	case string(n.buf) == "false":
		return TypeBool
	case string(n.buf) == "null":
		return TypeNull
	case isNumJSON(n.buf):
		return TypeNumber
	}

	// return TypeUnknown for all other cases
	return TypeError
}
497270
func (fixedHeader FixedHeader) ptype() (byte, error) {
	// Check the length of the fixed header.
	if len(fixedHeader) < 1 {
		return 0x00, ErrInvalidFixedHeaderLen
	}

	// Extract the MQTT Control Packet type from
	// the fixed header and return it.
	return fixedHeader[0] >> 4, nil
}
1327420
func (d *RecordDecoder) Type(rec []byte) RecordType {
	if len(rec) < 1 {
		return RecordInvalid
	}
	switch t := RecordType(rec[0]); t {
	case RecordSeries, RecordSamples, RecordTombstones:
		return t
	}
	return RecordInvalid
}
736110
func (s *CountService) Type(typ ...string) *CountService {
	if s.typ == nil {
		s.typ = make([]string, 0)
	}
	s.typ = append(s.typ, typ...)
	return s
}
1074781
func (q *SearchSortField) Type(value string) *SearchSortField {
	q.options["type"] = value
	return q
}
67979
func (e *Env) Type(k string) (reflect.Type, error) {
	e.RLock()
	defer e.RUnlock()

	if v, ok := e.typ[k]; ok {
		return v, nil
	}
	if e.external != nil {
		v, err := e.external.Type(k)
		if err == nil {
			return v, nil
		}
	}
	if e.parent == nil {
		if v, ok := basicTypes[k]; ok {
			return v, nil
		}
		return nilType, fmt.Errorf("undefined type '%s'", k)
	}
	return e.parent.Type(k)
}