package httpsfv

import (
	
	
)

// ErrUnexpectedEndOfString is returned when the end of string is unexpected.
var ErrUnexpectedEndOfString = errors.New("unexpected end of string")

// ErrUnrecognizedCharacter is returned when an unrecognized character in encountered.
var ErrUnrecognizedCharacter = errors.New("unrecognized character")

// UnmarshalError contains the underlying parsing error and the position at which it occurred.
type UnmarshalError struct {
	off int
	err error
}

func ( *UnmarshalError) () string {
	if .err != nil {
		return fmt.Sprintf("%s: character %d", .err, .off)
	}

	return fmt.Sprintf("unmarshal error: character %d", .off)
}

func ( *UnmarshalError) () error {
	return .err
}

type scanner struct {
	data string
	off  int
}

// scanWhileSp consumes spaces.
func ( *scanner) () {
	for !.eof() {
		if .data[.off] != ' ' {
			return
		}

		.off++
	}
}

// scanWhileOWS consumes optional white space (OWS) characters.
func ( *scanner) () {
	for !.eof() {
		 := .data[.off]
		if  != ' ' &&  != '\t' {
			return
		}

		.off++
	}
}

// eof returns true if the parser consumed all available characters.
func ( *scanner) () bool {
	return .off == len(.data)
}