Documentation ¶
Index ¶
- Constants
- func EncodeUint(buf *ByteBuffer, digit uint64)
- func EncodeUintWithWidth(buf *ByteBuffer, digit uint64, width int)
- func Errorf(src []byte, pos Pos, format string, args ...interface{}) error
- func NewError(src []byte, pos Pos, message string) error
- type ByteBuffer
- type Context
- type Error
- type Pos
- func ParseInCharset(src []byte, pos Pos, charset *[256]uint32, mask uint32) (newPos Pos)
- func ParseInCharsetAndAlloc(allocator *mem.ArenaAllocator, src []byte, pos Pos, charset *[256]uint32, ...) (addr mem.MemPtr, newPos Pos)
- func ParseInCharsetPercentEscapable(allocator *mem.ArenaAllocator, src []byte, pos Pos, charset *[256]uint32, ...) (addr mem.MemPtr, newPos Pos, err error)
- func ParseUint16(src []byte, pos Pos) (digit uint16, newPos Pos, ok bool)
- func ParseUint32(src []byte, pos Pos) (digit uint32, newPos Pos, ok bool)
- func ParseUint64(src []byte, pos Pos) (digit uint64, newPos Pos, ok bool)
- func ParseUint8(src []byte, pos Pos) (digit uint8, newPos Pos, ok bool)
Constants ¶
View Source
const (
ABNF_ERROR_MAX_SRC_OUTPUT_LEN = 40
)
Variables ¶
This section is empty.
Functions ¶
func EncodeUint ¶
func EncodeUint(buf *ByteBuffer, digit uint64)
EncodeUint encode uint64 to byte buffer
EncodeUint is faster than strconv.FormatUint
func EncodeUintWithWidth ¶
func EncodeUintWithWidth(buf *ByteBuffer, digit uint64, width int)
EncodeUintWithWidth encode uint64 to byte buffer with width,
if length of digit is less than width, spaces are filled before digit. if length of digit is larger than width, no space is before digit. EncodeUintWithWidth is faster than fmt.Sprintf
Types ¶
type ByteBuffer ¶
type ByteBuffer = buffer.ByteBuffer
func NewByteBuffer ¶
func NewByteBuffer(buf []byte) *ByteBuffer
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(allocator *mem.ArenaAllocator, src []byte) *Context
func (*Context) SetAllocator ¶
func (this *Context) SetAllocator(allocator *mem.ArenaAllocator)
func (*Context) SetParsePos ¶
func (*Context) SetParseSrc ¶
type Pos ¶
type Pos = uint
func ParseInCharset ¶
parse input when char is in charset
func ParseInCharsetAndAlloc ¶
func ParseInCharsetAndAlloc(allocator *mem.ArenaAllocator, src []byte, pos Pos, charset *[256]uint32, mask uint32) (addr mem.MemPtr, newPos Pos)
parse input when char is in charset and not empty, and allocte memory for output
func ParseInCharsetPercentEscapable ¶
func ParseInCharsetPercentEscapable(allocator *mem.ArenaAllocator, src []byte, pos Pos, charset *[256]uint32, mask uint32) (addr mem.MemPtr, newPos Pos, err error)
parse input when char is in charset and char may be percent escaped, such as "%61"
using goto for performance
func ParseUint16 ¶
ParseUInt16 parse digit in src which can contain non-digit char,
and convert to int64, return false if overflow ParseUInt16 is faster than strconv.ParseUint and strconv.Atoi
func ParseUint32 ¶
ParseUInt32 parse digit in src which can contain non-digit char,
and convert to int64, return false if overflow ParseUInt32 is faster than strconv.ParseUint and strconv.Atoi
func ParseUint64 ¶
ParseUInt64 parse digit in src which can contain non-digit char,
and convert to int64, return false if overflow ParseUInt64 is faster than strconv.ParseUint and strconv.Atoi
Click to show internal directories.
Click to hide internal directories.