package gojay

// DecodeBool reads the next JSON-encoded value from the decoder's input (io.Reader)
// and stores it in the boolean pointed to by v.
//
// See the documentation for Unmarshal for details about the conversion of JSON into a Go value.
func ( *Decoder) ( *bool) error {
	if .isPooled == 1 {
		panic(InvalidUsagePooledDecoderError("Invalid usage of pooled decoder"))
	}
	return .decodeBool()
}
func ( *Decoder) ( *bool) error {
	for ; .cursor < .length || .read(); .cursor++ {
		switch .data[.cursor] {
		case ' ', '\n', '\t', '\r', ',':
			continue
		case 't':
			.cursor++
			 := .assertTrue()
			if  != nil {
				return 
			}
			* = true
			return nil
		case 'f':
			.cursor++
			 := .assertFalse()
			if  != nil {
				return 
			}
			* = false
			return nil
		case 'n':
			.cursor++
			 := .assertNull()
			if  != nil {
				return 
			}
			* = false
			return nil
		default:
			.err = .makeInvalidUnmarshalErr()
			 := .skipData()
			if  != nil {
				return 
			}
			return nil
		}
	}
	return nil
}
func ( *Decoder) ( **bool) error {
	for ; .cursor < .length || .read(); .cursor++ {
		switch .data[.cursor] {
		case ' ', '\n', '\t', '\r', ',':
			continue
		case 't':
			.cursor++
			 := .assertTrue()
			if  != nil {
				return 
			}
			if * == nil {
				* = new(bool)
			}
			** = true
			return nil
		case 'f':
			.cursor++
			 := .assertFalse()
			if  != nil {
				return 
			}
			if * == nil {
				* = new(bool)
			}
			** = false
			return nil
		case 'n':
			.cursor++
			 := .assertNull()
			if  != nil {
				return 
			}
			return nil
		default:
			.err = .makeInvalidUnmarshalErr()
			 := .skipData()
			if  != nil {
				return 
			}
			return nil
		}
	}
	return nil
}

func ( *Decoder) () error {
	 := 0
	for ; .cursor < .length || .read(); .cursor++ {
		switch  {
		case 0:
			if .data[.cursor] != 'r' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 1:
			if .data[.cursor] != 'u' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 2:
			if .data[.cursor] != 'e' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 3:
			switch .data[.cursor] {
			case ' ', '\b', '\t', '\n', ',', ']', '}':
				// dec.cursor--
				return nil
			default:
				return .raiseInvalidJSONErr(.cursor)
			}
		}
		++
	}
	if  == 3 {
		return nil
	}
	return .raiseInvalidJSONErr(.cursor)
}

func ( *Decoder) () error {
	 := 0
	for ; .cursor < .length || .read(); .cursor++ {
		switch  {
		case 0:
			if .data[.cursor] != 'u' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 1:
			if .data[.cursor] != 'l' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 2:
			if .data[.cursor] != 'l' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 3:
			switch .data[.cursor] {
			case ' ', '\t', '\n', ',', ']', '}':
				// dec.cursor--
				return nil
			default:
				return .raiseInvalidJSONErr(.cursor)
			}
		}
		++
	}
	if  == 3 {
		return nil
	}
	return .raiseInvalidJSONErr(.cursor)
}

func ( *Decoder) () error {
	 := 0
	for ; .cursor < .length || .read(); .cursor++ {
		switch  {
		case 0:
			if .data[.cursor] != 'a' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 1:
			if .data[.cursor] != 'l' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 2:
			if .data[.cursor] != 's' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 3:
			if .data[.cursor] != 'e' {
				return .raiseInvalidJSONErr(.cursor)
			}
		case 4:
			switch .data[.cursor] {
			case ' ', '\t', '\n', ',', ']', '}':
				// dec.cursor--
				return nil
			default:
				return .raiseInvalidJSONErr(.cursor)
			}
		}
		++
	}
	if  == 4 {
		return nil
	}
	return .raiseInvalidJSONErr(.cursor)
}

// Add Values functions

// AddBool decodes the JSON value within an object or an array to a *bool.
// If next key is neither null nor a JSON boolean, an InvalidUnmarshalError will be returned.
// If next key is null, bool will be false.
func ( *Decoder) ( *bool) error {
	return .Bool()
}

// AddBoolNull decodes the JSON value within an object or an array to a *bool.
// If next key is neither null nor a JSON boolean, an InvalidUnmarshalError will be returned.
// If next key is null, bool will be false.
// If a `null` is encountered, gojay does not change the value of the pointer.
func ( *Decoder) ( **bool) error {
	return .BoolNull()
}

// Bool decodes the JSON value within an object or an array to a *bool.
// If next key is neither null nor a JSON boolean, an InvalidUnmarshalError will be returned.
// If next key is null, bool will be false.
func ( *Decoder) ( *bool) error {
	 := .decodeBool()
	if  != nil {
		return 
	}
	.called |= 1
	return nil
}

// BoolNull decodes the JSON value within an object or an array to a *bool.
// If next key is neither null nor a JSON boolean, an InvalidUnmarshalError will be returned.
// If next key is null, bool will be false.
func ( *Decoder) ( **bool) error {
	 := .decodeBoolNull()
	if  != nil {
		return 
	}
	.called |= 1
	return nil
}