parser

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIntegralPrimitive

func IsIntegralPrimitive(k PrimitiveKind) bool

Types

type Enum

type Enum struct {
	Name      string
	Primitive PrimitiveKind
	Values    []EnumValue
}

type EnumValue

type EnumValue struct {
	Name  string
	Value string
}

type Field

type Field struct {
	Name string
	Kind FieldKind

	Primitive PrimitiveKind
	NamedType string
	Quant     *QuantInfo

	TypeName string

	Elem     *Field
	FixedLen int
}

func (*Field) CSharpPrimitiveTypeName

func (f *Field) CSharpPrimitiveTypeName() string

func (*Field) CSharpTypeName

func (f *Field) CSharpTypeName() string

func (*Field) GoPrimitiveTypeName

func (f *Field) GoPrimitiveTypeName() string

func (*Field) GoTypeName

func (f *Field) GoTypeName() string

func (*Field) WireSize

func (f *Field) WireSize() int

type FieldKind

type FieldKind int
const (
	KindPrimitive FieldKind = iota
	KindNested
	KindFixedArray
	KindSlice
)

type Message

type Message struct {
	PackageName string
	Name        string
	Fields      []Field
}

func ParseFile

func ParseFile(path string) ([]Message, error)

func ParseSource

func ParseSource(src string) ([]Message, error)

func (*Message) HasVariableFields

func (m *Message) HasVariableFields() bool

func (*Message) MinWireSize

func (m *Message) MinWireSize() int

type PrimitiveKind

type PrimitiveKind int
const (
	KindFloat32 PrimitiveKind = iota
	KindFloat64
	KindInt8
	KindInt16
	KindInt32
	KindInt64
	KindUint8
	KindUint16
	KindUint32
	KindUint64
	KindBool
	KindString
)

type QuantInfo

type QuantInfo struct {
	Min  float64
	Max  float64
	Bits int // 8 or 16, default 16
}

func (*QuantInfo) MaxUint

func (q *QuantInfo) MaxUint() float64

func (*QuantInfo) WireBytes

func (q *QuantInfo) WireBytes() int

type Schema

type Schema struct {
	PackageName string
	Messages    []Message
	Enums       []Enum
}

func ParseSchemaFile

func ParseSchemaFile(path string) (Schema, error)

func ParseSchemaSource

func ParseSchemaSource(src string) (Schema, error)

Jump to

Keyboard shortcuts

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