encoder

package
v0.0.0-...-d028be2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BytecodeSignature uint32 = 0x75474F
	BytecodeVersion   uint16 = 1
)

Bytecode signature and version are written to the header of encoded Bytecode. Bytecode is encoded with current BytecodeVersion and its format.

Variables

This section is empty.

Functions

func DecodeBytecodeFrom

func DecodeBytecodeFrom(r io.Reader, modules *gad.ModuleMap) (*gad.Bytecode, error)

DecodeBytecodeFrom decodes *gad.Bytecode from given r io.Reader.

func DecodeObject

func DecodeObject(r io.Reader) (gad.Object, error)

DecodeObject decodes and returns Object from a io.Reader which is encoded with MarshalBinary.

func EncodeBytecodeTo

func EncodeBytecodeTo(bc *gad.Bytecode, w io.Writer) error

EncodeBytecodeTo encodes given bc to w io.Writer.

Types

type Array

type Array gad.Array

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Array) MarshalBinary

func (o Array) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Array) UnmarshalBinary

func (o *Array) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Bool

type Bool gad.Bool

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Bool) MarshalBinary

func (o Bool) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Bool) UnmarshalBinary

func (o *Bool) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type BuiltinFunction

type BuiltinFunction gad.BuiltinFunction

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (*BuiltinFunction) MarshalBinary

func (o *BuiltinFunction) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*BuiltinFunction) UnmarshalBinary

func (o *BuiltinFunction) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type BuiltinObjType

type BuiltinObjType gad.BuiltinObjType

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (*BuiltinObjType) MarshalBinary

func (o *BuiltinObjType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*BuiltinObjType) UnmarshalBinary

func (o *BuiltinObjType) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Bytecode

type Bytecode gad.Bytecode

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (*Bytecode) Decode

func (bc *Bytecode) Decode(r io.Reader, modules *gad.ModuleMap) error

Decode decodes Bytecode data from the reader.

func (*Bytecode) Encode

func (bc *Bytecode) Encode(w io.Writer) error

Encode writes encoded data of Bytecode to writer.

func (*Bytecode) MarshalBinary

func (bc *Bytecode) MarshalBinary() (data []byte, err error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Bytecode) UnmarshalBinary

func (bc *Bytecode) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler Do not use this method if builtin modules are used, instead use Decode method.

type Bytes

type Bytes gad.Bytes

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Bytes) MarshalBinary

func (o Bytes) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Bytes) UnmarshalBinary

func (o *Bytes) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Char

type Char gad.Char

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Char) MarshalBinary

func (o Char) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Char) UnmarshalBinary

func (o *Char) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type CompiledFunction

type CompiledFunction gad.CompiledFunction

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (*CompiledFunction) MarshalBinary

func (o *CompiledFunction) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*CompiledFunction) UnmarshalBinary

func (o *CompiledFunction) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Decimal

type Decimal gad.Decimal

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Decimal) MarshalBinary

func (o Decimal) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Decimal) UnmarshalBinary

func (o *Decimal) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Flag

type Flag gad.Flag

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Flag) MarshalBinary

func (o Flag) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Flag) UnmarshalBinary

func (o *Flag) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Float

type Float gad.Float

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Float) MarshalBinary

func (o Float) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Float) UnmarshalBinary

func (o *Float) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Function

type Function gad.Function

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (*Function) MarshalBinary

func (o *Function) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Function) UnmarshalBinary

func (o *Function) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Int

type Int gad.Int

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Int) MarshalBinary

func (o Int) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Int) UnmarshalBinary

func (o *Int) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Map

type Map gad.Dict

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Map) MarshalBinary

func (o Map) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Map) UnmarshalBinary

func (o *Map) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type NilType

type NilType gad.NilType

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (*NilType) MarshalBinary

func (o *NilType) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*NilType) UnmarshalBinary

func (o *NilType) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type SourceFile

type SourceFile parser.SourceFile

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (*SourceFile) MarshalBinary

func (sf *SourceFile) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*SourceFile) UnmarshalBinary

func (sf *SourceFile) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type SourceFileSet

type SourceFileSet parser.SourceFileSet

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (*SourceFileSet) MarshalBinary

func (sfs *SourceFileSet) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*SourceFileSet) UnmarshalBinary

func (sfs *SourceFileSet) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type String

type String gad.Str

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (String) MarshalBinary

func (o String) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*String) UnmarshalBinary

func (o *String) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Symbol

type Symbol gad.SymbolInfo

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Symbol) MarshalBinary

func (s Symbol) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Symbol) UnmarshalBinary

func (s *Symbol) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary implements encoding.BinaryUnmarshaler

type SyncMap

type SyncMap gad.SyncDict

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (*SyncMap) MarshalBinary

func (o *SyncMap) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*SyncMap) UnmarshalBinary

func (o *SyncMap) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

type Uint

type Uint gad.Uint

Types implementing encoding.BinaryMarshaler encoding.BinaryUnmarshaler.

func (Uint) MarshalBinary

func (o Uint) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (*Uint) UnmarshalBinary

func (o *Uint) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL