// Code generated by modernc.org/undup from the per-target vec_*.go files; DO NOT EDIT.

//go:build (darwin && amd64) || (darwin && arm64) || (freebsd && 386) || (freebsd && amd64) || (linux && 386) || (linux && amd64) || (linux && loong64) || (netbsd && amd64) || (openbsd && amd64) || (windows && (amd64 || arm64)) || (windows && 386)

package vec

import (
	"unsafe"

	"modernc.org/libc"
)

func Xis_alpha(tls *libc.TLS, x int8) (r int32) {
	return libc.BoolInt32(int32(x) >= int32('a') && int32(x) <= int32('z') || int32(x) >= int32('A') && int32(x) <= int32('Z'))
}

func Xis_digit(tls *libc.TLS, x int8) (r int32) {
	return libc.BoolInt32(int32(x) >= int32('0') && int32(x) <= int32('9'))
}

func Xis_whitespace(tls *libc.TLS, x int8) (r int32) {
	return libc.BoolInt32(int32(x) == int32(' ') || int32(x) == int32('\t') || int32(x) == int32('\n') || int32(x) == int32('\r'))
}

func Xvec0_token_next(tls *libc.TLS, start uintptr, end uintptr, out uintptr) (r int32) {
	var curr int8
	var ptr, start1, start2 uintptr
	_, _, _, _ = curr, ptr, start1, start2
	ptr = start
	for ptr < end {
		curr = **(**int8)(__ccgo_up(ptr))
		if Xis_whitespace(tls, curr) != 0 {
			ptr = ptr + 1
			continue
		} else {
			if int32(curr) == int32('+') {
				ptr = ptr + 1
				(*TVec0Token)(unsafe.Pointer(out)).Fstart = ptr
				(*TVec0Token)(unsafe.Pointer(out)).Fend = ptr
				(*TVec0Token)(unsafe.Pointer(out)).Ftoken_type = int32(_TOKEN_TYPE_PLUS)
				return int32(m_VEC0_TOKEN_RESULT_SOME)
			} else {
				if int32(curr) == int32('[') {
					ptr = ptr + 1
					(*TVec0Token)(unsafe.Pointer(out)).Fstart = ptr
					(*TVec0Token)(unsafe.Pointer(out)).Fend = ptr
					(*TVec0Token)(unsafe.Pointer(out)).Ftoken_type = int32(_TOKEN_TYPE_LBRACKET)
					return int32(m_VEC0_TOKEN_RESULT_SOME)
				} else {
					if int32(curr) == int32(']') {
						ptr = ptr + 1
						(*TVec0Token)(unsafe.Pointer(out)).Fstart = ptr
						(*TVec0Token)(unsafe.Pointer(out)).Fend = ptr
						(*TVec0Token)(unsafe.Pointer(out)).Ftoken_type = int32(_TOKEN_TYPE_RBRACKET)
						return int32(m_VEC0_TOKEN_RESULT_SOME)
					} else {
						if int32(curr) == int32('=') {
							ptr = ptr + 1
							(*TVec0Token)(unsafe.Pointer(out)).Fstart = ptr
							(*TVec0Token)(unsafe.Pointer(out)).Fend = ptr
							(*TVec0Token)(unsafe.Pointer(out)).Ftoken_type = int32(_TOKEN_TYPE_EQ)
							return int32(m_VEC0_TOKEN_RESULT_SOME)
						} else {
							if int32(curr) == int32('(') {
								ptr = ptr + 1
								(*TVec0Token)(unsafe.Pointer(out)).Fstart = ptr
								(*TVec0Token)(unsafe.Pointer(out)).Fend = ptr
								(*TVec0Token)(unsafe.Pointer(out)).Ftoken_type = int32(_TOKEN_TYPE_LPAREN)
								return int32(m_VEC0_TOKEN_RESULT_SOME)
							} else {
								if int32(curr) == int32(')') {
									ptr = ptr + 1
									(*TVec0Token)(unsafe.Pointer(out)).Fstart = ptr
									(*TVec0Token)(unsafe.Pointer(out)).Fend = ptr
									(*TVec0Token)(unsafe.Pointer(out)).Ftoken_type = int32(_TOKEN_TYPE_RPAREN)
									return int32(m_VEC0_TOKEN_RESULT_SOME)
								} else {
									if int32(curr) == int32(',') {
										ptr = ptr + 1
										(*TVec0Token)(unsafe.Pointer(out)).Fstart = ptr
										(*TVec0Token)(unsafe.Pointer(out)).Fend = ptr
										(*TVec0Token)(unsafe.Pointer(out)).Ftoken_type = int32(_TOKEN_TYPE_COMMA)
										return int32(m_VEC0_TOKEN_RESULT_SOME)
									} else {
										if Xis_alpha(tls, curr) != 0 {
											start1 = ptr
											for ptr < end && (Xis_alpha(tls, **(**int8)(__ccgo_up(ptr))) != 0 || Xis_digit(tls, **(**int8)(__ccgo_up(ptr))) != 0 || int32(**(**int8)(__ccgo_up(ptr))) == int32('_')) {
												ptr = ptr + 1
											}
											(*TVec0Token)(unsafe.Pointer(out)).Fstart = start1
											(*TVec0Token)(unsafe.Pointer(out)).Fend = ptr
											(*TVec0Token)(unsafe.Pointer(out)).Ftoken_type = int32(_TOKEN_TYPE_IDENTIFIER)
											return int32(m_VEC0_TOKEN_RESULT_SOME)
										} else {
											if Xis_digit(tls, curr) != 0 {
												start2 = ptr
												for ptr < end && Xis_digit(tls, **(**int8)(__ccgo_up(ptr))) != 0 {
													ptr = ptr + 1
												}
												(*TVec0Token)(unsafe.Pointer(out)).Fstart = start2
												(*TVec0Token)(unsafe.Pointer(out)).Fend = ptr
												(*TVec0Token)(unsafe.Pointer(out)).Ftoken_type = int32(_TOKEN_TYPE_DIGIT)
												return int32(m_VEC0_TOKEN_RESULT_SOME)
											} else {
												return int32(m_VEC0_TOKEN_RESULT_ERROR)
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	return int32(m_VEC0_TOKEN_RESULT_EOF)
}

// C documentation
//
//	// from SQLite source:
//	// https://github.com/sqlite/sqlite/blob/a509a90958ddb234d1785ed7801880ccb18b497e/src/json.c#L153
var _vecJsonIsSpaceX = [256]int8{
	9:  int8(1),
	10: int8(1),
	13: int8(1),
	32: int8(1),
}
