package jsontext

import (
	

	
)

func init() {
	jsonsyntax.LegacyError = legacySyntaxError
}

// legacySyntaxError is the syntax error err as encoding/json reports it, which formats JSON by this package as
// encoding/json of Go 1.27 does by encoding/json/jsontext: the message in its words, and the offset after the
// invalid text, or after the first byte of a token which doesn't fit the grammar where it is.
func legacySyntaxError( error) (string, int64, bool) {
	,  := .(*SyntacticError)
	if ! {
		return "", 0, false
	}
	switch e := .Err.(type) {
	case *textError:
		return .message(true), .ByteOffset + int64(len(.what)), true
	}
	switch .Err {
	case io.ErrUnexpectedEOF:
		return "unexpected end of JSON input", .ByteOffset, true
	case errMissingValue:
		return "missing value after object key", .ByteOffset + 1, true
	}
	return .Err.Error(), .ByteOffset + 1, true
}