package decoder

import (
	
	
	

	
	
)

type funcDecoder struct {
	typ        *runtime.Type
	structName string
	fieldName  string
}

func newFuncDecoder( *runtime.Type, ,  string) *funcDecoder {
	 := &funcDecoder{, , }
	return 
}

func ( *funcDecoder) ( *Stream,  int64,  unsafe.Pointer) error {
	.skipWhiteSpace()
	 := .cursor
	if  := .skipValue();  != nil {
		return 
	}
	 := .buf[:.cursor]
	if len() > 0 {
		switch [0] {
		case '"':
			return &errors.UnmarshalTypeError{
				Value:  "string",
				Type:   runtime.RType2Type(.typ),
				Offset: .totalOffset(),
			}
		case '[':
			return &errors.UnmarshalTypeError{
				Value:  "array",
				Type:   runtime.RType2Type(.typ),
				Offset: .totalOffset(),
			}
		case '{':
			return &errors.UnmarshalTypeError{
				Value:  "object",
				Type:   runtime.RType2Type(.typ),
				Offset: .totalOffset(),
			}
		case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
			return &errors.UnmarshalTypeError{
				Value:  "number",
				Type:   runtime.RType2Type(.typ),
				Offset: .totalOffset(),
			}
		case 'n':
			if  := nullBytes();  != nil {
				return 
			}
			*(*unsafe.Pointer)() = nil
			return nil
		case 't':
			if  := trueBytes();  == nil {
				return &errors.UnmarshalTypeError{
					Value:  "boolean",
					Type:   runtime.RType2Type(.typ),
					Offset: .totalOffset(),
				}
			}
		case 'f':
			if  := falseBytes();  == nil {
				return &errors.UnmarshalTypeError{
					Value:  "boolean",
					Type:   runtime.RType2Type(.typ),
					Offset: .totalOffset(),
				}
			}
		}
	}
	return errors.ErrInvalidBeginningOfValue(.buf[.cursor], .totalOffset())
}

func ( *funcDecoder) ( *RuntimeContext, ,  int64,  unsafe.Pointer) (int64, error) {
	 := .Buf
	 = skipWhiteSpace(, )
	 := 
	,  := skipValue(, , )
	if  != nil {
		return 0, 
	}
	 := [:]
	if len() > 0 {
		switch [0] {
		case '"':
			return 0, &errors.UnmarshalTypeError{
				Value:  "string",
				Type:   runtime.RType2Type(.typ),
				Offset: ,
			}
		case '[':
			return 0, &errors.UnmarshalTypeError{
				Value:  "array",
				Type:   runtime.RType2Type(.typ),
				Offset: ,
			}
		case '{':
			return 0, &errors.UnmarshalTypeError{
				Value:  "object",
				Type:   runtime.RType2Type(.typ),
				Offset: ,
			}
		case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
			return 0, &errors.UnmarshalTypeError{
				Value:  "number",
				Type:   runtime.RType2Type(.typ),
				Offset: ,
			}
		case 'n':
			if bytes.Equal(, nullbytes) {
				*(*unsafe.Pointer)() = nil
				return , nil
			}
		case 't':
			if  := validateTrue(, );  == nil {
				return 0, &errors.UnmarshalTypeError{
					Value:  "boolean",
					Type:   runtime.RType2Type(.typ),
					Offset: ,
				}
			}
		case 'f':
			if  := validateFalse(, );  == nil {
				return 0, &errors.UnmarshalTypeError{
					Value:  "boolean",
					Type:   runtime.RType2Type(.typ),
					Offset: ,
				}
			}
		}
	}
	return , errors.ErrInvalidBeginningOfValue([], )
}

func ( *funcDecoder) ( *RuntimeContext, ,  int64) ([][]byte, int64, error) {
	return nil, 0, fmt.Errorf("json: func decoder does not support decode path")
}