package jx

import 

// limit maximum depth of nesting, as allowed by https://tools.ietf.org/html/rfc7159#section-9
const maxDepth = 10000

var errMaxDepth = errors.New("depth: maximum")

func ( *Decoder) () error {
	.depth++
	if .depth > maxDepth {
		return errMaxDepth
	}
	return nil
}

var errNegativeDepth = errors.New("depth: negative")

func ( *Decoder) () error {
	.depth--
	if .depth < 0 {
		return errNegativeDepth
	}
	return nil
}