parser

package
v0.0.0-...-5af3d5f Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_VARIABLE = iota
	TYPE_ARRAY
	TYPE_LIST
)

Variables

View Source
var ErrInvalidArrayType = errors.New("invalid array type")
View Source
var ErrInvalidListType = errors.New("invalid list type")
View Source
var ErrTypeNotFound = errors.New("type not found")

Functions

func DeepCopy

func DeepCopy(v interface{}, dst interface{}) error

func GetRawTypeInfo

func GetRawTypeInfo(t string) (isRaw bool, isFixed bool, Size int)

func IntSliceLess

func IntSliceLess(a, b []int) bool

func ParseArray

func ParseArray(t string) (Type string, Size int, err error)

func ParseList

func ParseList(t string) (Type string, err error)

func TraceType

func TraceType(f *IDLFile, to *[]*GenerateField, ff IDLField, path []int) error

func TypeOf

func TypeOf(t string) int

Types

type GenTypes

type GenTypes []*GenerateField

func (GenTypes) Len

func (g GenTypes) Len() int

func (GenTypes) Less

func (g GenTypes) Less(i, j int) bool

func (GenTypes) Swap

func (g GenTypes) Swap(i, j int)

type GenerateField

type GenerateField struct {
	Path    string
	Name    string
	Size    int
	Offset  int
	IsFixed bool

	IsArray    bool
	IsList     bool
	ArrayIndex int

	ArrayIndexPath []int

	RawType string

	Index int
}

func (*GenerateField) String

func (f *GenerateField) String() string

type GenerateStruct

type GenerateStruct struct {
	Name  string
	Types []*GenerateField
}

type GernerateInfo

type GernerateInfo struct {
	Structs []*GenerateStruct
	IDL     *IDLFile

	Max MaxLen
}

func ParseGenerateInfo

func ParseGenerateInfo(data []byte) (*GernerateInfo, error)

type IDLField

type IDLField struct {
	FieldType string // array, var, list...
	Key       string
	Type      string
	CodeType  string

	Index int

	IsRawType bool
	IsFixed   bool
	IsArray   bool
	IsList    bool

	ArrayLength int

	ArrayIndex int
}

type IDLFile

type IDLFile struct {
	Version int

	Types []IDLType

	IndexPathMap       map[int]string
	TypeIndexMap       map[string]int
	IsArrayMap         map[int]bool
	IndexArrayIndexMap map[int]int

	Ctr int
}

func ParseJSONData

func ParseJSONData(data []byte) (*IDLFile, error)

func (*IDLFile) GetType

func (f *IDLFile) GetType(t string) *IDLType

type IDLType

type IDLType struct {
	Name string

	Fields []IDLField

	Index int
}

type MaxLen

type MaxLen struct {
	StringMaxLen int `json:"$StringMaxLen"`
	BytesMaxLen  int `json:"$BytesMaxLen"`
	ListMaxItem  int `json:"$ListMaxItem"`
}

Jump to

Keyboard shortcuts

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