Documentation ¶
Index ¶
- Variables
- type ArithOverflowWarning
- type ArithSignToUnsignWarning
- type ArithTruncationWarning
- type Array
- type BasePosition
- type BasicType
- type BinopExpr
- type BoolLiteral
- type Bytes
- type CastExpr
- type CompilationUnit
- func (c *CompilationUnit) AddGlobalName(name string, pos Position) error
- func (c *CompilationUnit) AddGlobalType(ty CustomType) error
- func (c *CompilationUnit) AddImport(other *CompilationUnit) error
- func (c *CompilationUnit) AddLocalName(name string, pos Position) error
- func (c *CompilationUnit) AddLocalType(ty CustomType) error
- func (c CompilationUnit) String() string
- type CompileError
- type CompileWarning
- type ConstantExpr
- type ConstantField
- func (f ConstantField) Copy() Field
- func (f ConstantField) DumpString() string
- func (f ConstantField) GetFieldBelongs() *Struct
- func (f ConstantField) GetFieldBitSize() int64
- func (f ConstantField) GetFieldKind() FieldKindID
- func (f ConstantField) GetFieldUniqueName() string
- func (f *ConstantField) SetFieldBelongs(s *Struct)
- func (f ConstantField) String() string
- type CustomType
- type DefinitionDuplicateError
- type DefinitionNotFoundError
- type DefinitionTypeConflictError
- type EmbeddedField
- func (f EmbeddedField) Copy() Field
- func (f EmbeddedField) DumpString() string
- func (f EmbeddedField) GetFieldBelongs() *Struct
- func (f EmbeddedField) GetFieldBitSize() int64
- func (f EmbeddedField) GetFieldKind() FieldKindID
- func (f EmbeddedField) GetFieldUniqueName() string
- func (f *EmbeddedField) SetFieldBelongs(s *Struct)
- func (f EmbeddedField) String() string
- type EmbeddedFieldError
- type Enum
- func (e *Enum) GetBelongs() *CompilationUnit
- func (e *Enum) GetTypeBitSize() int64
- func (e *Enum) GetTypeDynamic() bool
- func (e *Enum) GetTypeID() TypeID
- func (e *Enum) GetTypeName() string
- func (e *Enum) SetBelongs(c *CompilationUnit)
- func (e Enum) ShortString() string
- func (e Enum) String() string
- type EnumConstValueTypeError
- type EnumValue
- type Expr
- type ExprKindID
- type ExprOp
- func (e ExprOp) IsAdd() bool
- func (e ExprOp) IsAnd() bool
- func (e ExprOp) IsAssign() bool
- func (e ExprOp) IsBand() bool
- func (e ExprOp) IsBnot() bool
- func (e ExprOp) IsBor() bool
- func (e ExprOp) IsBxor() bool
- func (e ExprOp) IsDiv() bool
- func (e ExprOp) IsEq() bool
- func (e ExprOp) IsGe() bool
- func (e ExprOp) IsGt() bool
- func (e ExprOp) IsLe() bool
- func (e ExprOp) IsLt() bool
- func (e ExprOp) IsMod() bool
- func (e ExprOp) IsMul() bool
- func (e ExprOp) IsNe() bool
- func (e ExprOp) IsNot() bool
- func (e ExprOp) IsOr() bool
- func (e ExprOp) IsPow() bool
- func (e ExprOp) IsShl() bool
- func (e ExprOp) IsShr() bool
- func (e ExprOp) IsSub() bool
- func (e ExprOp) String() string
- type Field
- type FieldConstValueTypeError
- type FieldKindID
- type FieldNotAlignedError
- type FileIdentifer
- type FileNotFoundError
- type FileReadError
- type FileWriteError
- type FloatLiteral
- type GeneralError
- type GeneralWarning
- type GenerateError
- type GenerateWarning
- type GetMethod
- type ImportCycleError
- type ImportSelfError
- type ImportingError
- type ImportingWarning
- type IntLiteral
- type InvalidConstIdentifierError
- type InvalidEmbeddedFieldError
- type InvalidEnumDefError
- type InvalidExprError
- type InvalidFieldError
- type InvalidLiteralError
- type InvalidSizeError
- type InvalidStructDefError
- type JoinTopLevelErrors
- type JoinTopLevelWarnings
- type Literal
- type LiteralKindID
- type Method
- type MethodKindID
- type MethodTypeError
- type MultipleInputFileError
- type NameStyleError
- type NameStyleNotStandardWarning
- type NameStyleWarning
- type NoInputFileError
- type NormalField
- func (f NormalField) Copy() Field
- func (f NormalField) DumpString() string
- func (f NormalField) GetFieldBelongs() *Struct
- func (f NormalField) GetFieldBitSize() int64
- func (f NormalField) GetFieldKind() FieldKindID
- func (f NormalField) GetFieldUniqueName() string
- func (f *NormalField) SetFieldBelongs(s *Struct)
- func (f NormalField) String() string
- type Option
- type OptionDuplicateError
- type OptionNotAvailableWarning
- type OptionNotSetWarning
- type OptionTypeError
- type OptionUnknownWarning
- type OptionValueError
- type Package
- func (p Package) Difference(other *Package) (diff []string)
- func (p Package) PackageEquals(other *Package) bool
- func (p Package) String() string
- func (p Package) ToFilePath(ext string) string
- func (p Package) ToPath(sep, ext string) string
- func (p Package) ToRelativePath(other *Package, ext string) string
- func (p Package) ToRelativePathStrict(other *Package, ext string) string
- type PackageDefinitionDuplicateError
- type PackageDuplicateError
- type PackageNameNotSetError
- type PackageNameNotSetWarning
- type Position
- type RawExpr
- type SetMethod
- type String
- type StringLiteral
- type Struct
- func (s Struct) DumpString() string
- func (s *Struct) ForEachField(f func(field Field, index int, fixedStart int64, isDynamicStart bool) error) error
- func (s *Struct) ForEachFieldWithPos(...) error
- func (s Struct) GetBelongs() *CompilationUnit
- func (s Struct) GetTypeBitSize() int64
- func (s Struct) GetTypeDynamic() bool
- func (s Struct) GetTypeID() TypeID
- func (s Struct) GetTypeName() string
- func (s *Struct) SetBelongs(c *CompilationUnit)
- func (s Struct) String() string
- func (s *Struct) SumFieldBitSize() (fixedSize int64, hasDynamic bool)
- type SyntaxError
- type TargetNotSpecifiedError
- type TargetNotSupportedError
- type TenaryExpr
- type TopLevelError
- type TopLevelWarning
- type Type
- type TypeBinopError
- type TypeID
- func (t TypeID) IsArray() bool
- func (t TypeID) IsBasic() bool
- func (t TypeID) IsBool() bool
- func (t TypeID) IsBytes() bool
- func (t TypeID) IsEnum() bool
- func (t TypeID) IsFloat() bool
- func (t TypeID) IsInt() bool
- func (t TypeID) IsIntOrUint() bool
- func (t TypeID) IsNumber() bool
- func (t TypeID) IsString() bool
- func (t TypeID) IsStruct() bool
- func (t TypeID) IsUint() bool
- func (t TypeID) String() string
- type TypeNotMatchError
- type TypeUnopError
- type UnopExpr
- type ValueExpr
- type VoidField
- func (f VoidField) Copy() Field
- func (f VoidField) DumpString() string
- func (f VoidField) GetFieldBelongs() *Struct
- func (f VoidField) GetFieldBitSize() int64
- func (f VoidField) GetFieldKind() FieldKindID
- func (f VoidField) GetFieldUniqueName() string
- func (f *VoidField) SetFieldBelongs(s *Struct)
- func (f VoidField) String() string
Constants ¶
This section is empty.
Variables ¶
var ( Bool = BasicType{TypeTypeID: TypeID_Bool, TypeName: "bool", TypeBitSize: 8} Uint8 = BasicType{TypeTypeID: TypeID_Uint8, TypeName: "uint8", TypeBitSize: 8} Uint16 = BasicType{TypeTypeID: TypeID_Uint16, TypeName: "uint16", TypeBitSize: 16} Uint32 = BasicType{TypeTypeID: TypeID_Uint32, TypeName: "uint32", TypeBitSize: 32} Uint64 = BasicType{TypeTypeID: TypeID_Uint64, TypeName: "uint64", TypeBitSize: 64} Int8 = BasicType{TypeTypeID: TypeID_Int8, TypeName: "int8", TypeBitSize: 8} Int16 = BasicType{TypeTypeID: TypeID_Int16, TypeName: "int16", TypeBitSize: 16} Int32 = BasicType{TypeTypeID: TypeID_Int32, TypeName: "int32", TypeBitSize: 32} Int64 = BasicType{TypeTypeID: TypeID_Int64, TypeName: "int64", TypeBitSize: 64} Float32 = BasicType{TypeTypeID: TypeID_Float32, TypeName: "float32", TypeBitSize: 32} Float64 = BasicType{TypeTypeID: TypeID_Float64, TypeName: "float64", TypeBitSize: 64} )
var EmptyPackage = &Package{}
var FieldKindIDStringsMap = map[FieldKindID]string{ FieldKindID_Normal: "NormalField", FieldKindID_Void: "VoidField", FieldKindID_Embedded: "EmbeddedField", FieldKindID_Constant: "ConstantField", }
Functions ¶
This section is empty.
Types ¶
type ArithOverflowWarning ¶
func (ArithOverflowWarning) Error ¶
func (w ArithOverflowWarning) Error() string
func (ArithOverflowWarning) String ¶
func (w ArithOverflowWarning) String() string
type ArithSignToUnsignWarning ¶
func (ArithSignToUnsignWarning) Error ¶
func (w ArithSignToUnsignWarning) Error() string
func (ArithSignToUnsignWarning) String ¶
func (w ArithSignToUnsignWarning) String() string
type ArithTruncationWarning ¶
func (ArithTruncationWarning) Error ¶
func (w ArithTruncationWarning) Error() string
func (ArithTruncationWarning) String ¶
func (w ArithTruncationWarning) String() string
type Array ¶
func (Array) GetTypeBitSize ¶
func (Array) GetTypeDynamic ¶ added in v1.0.0
func (Array) GetTypeName ¶
type BasePosition ¶
func (BasePosition) GetColumn ¶
func (p BasePosition) GetColumn() int
func (BasePosition) GetFile ¶
func (p BasePosition) GetFile() string
func (BasePosition) GetLine ¶
func (p BasePosition) GetLine() int
func (BasePosition) GetPositionString ¶
func (p BasePosition) GetPositionString() string
func (BasePosition) PositionEquals ¶ added in v0.4.0
func (p BasePosition) PositionEquals(pos Position) bool
func (BasePosition) String ¶
func (p BasePosition) String() string
type BasicType ¶
func GetBasicType ¶ added in v0.4.0
func (BasicType) GetTypeBitSize ¶
func (BasicType) GetTypeDynamic ¶ added in v1.0.0
func (BasicType) GetTypeName ¶
type BinopExpr ¶
type BinopExpr struct { BasePosition ExprType *BasicType Op ExprOp Expr1 Expr Expr2 Expr }
func (BinopExpr) GetExprKind ¶
func (b BinopExpr) GetExprKind() ExprKindID
func (BinopExpr) GetExprType ¶
type BoolLiteral ¶
type BoolLiteral struct { BasePosition BoolValue bool }
func (BoolLiteral) GetLiteralKind ¶
func (l BoolLiteral) GetLiteralKind() LiteralKindID
func (BoolLiteral) GetLiteralValue ¶
func (l BoolLiteral) GetLiteralValue() interface{}
func (BoolLiteral) GetLiteralValueIn ¶
func (l BoolLiteral) GetLiteralValueIn(ty TypeID) interface{}
func (BoolLiteral) GetMinimalTypeID ¶ added in v0.4.0
func (l BoolLiteral) GetMinimalTypeID() TypeID
func (BoolLiteral) String ¶
func (l BoolLiteral) String() string
type Bytes ¶
type Bytes struct{}
func (Bytes) GetTypeBitSize ¶
func (Bytes) GetTypeDynamic ¶ added in v1.0.0
func (Bytes) GetTypeName ¶
type CastExpr ¶
type CastExpr struct { BasePosition ToType *BasicType Expr1 Expr }
func (CastExpr) GetExprKind ¶
func (c CastExpr) GetExprKind() ExprKindID
func (CastExpr) GetExprType ¶
type CompilationUnit ¶
type CompilationUnit struct { UnitName *FileIdentifer Package *Package Options *util.OrderedMap[string, *Option] GlobalImports *util.OrderedMap[string, *CompilationUnit] // GlobalImports contains all the imports, including indirect imports LocalImports *util.OrderedMap[string, *CompilationUnit] // LocalImports contains direct imports of this unit // GlobalTypes and GlobalNames include imported types, representing all the defs visible to this unit GlobalTypes *util.OrderedMap[string, CustomType] // GlobalTypes contains all the top-level typedefs (inner typedefs excluded) GlobalNames *util.OrderedMap[string, Position] // GlobalNames contains all the names (inner typedefs' name included) // LocalTypes and LocalNames are only contained types and names defined in this unit LocalTypes *util.OrderedMap[string, CustomType] // LocalTypes contains all the top-level typedefs (inner typedefs excluded) LocalNames *util.OrderedMap[string, Position] // LocalNames contains all the local names (inner typedefs' name included) }
func NewCompilationUnit ¶
func NewCompilationUnit(name *FileIdentifer) *CompilationUnit
func (*CompilationUnit) AddGlobalName ¶ added in v0.3.0
func (c *CompilationUnit) AddGlobalName(name string, pos Position) error
AddGlobalName adds a name to this unit
returns DefinitionDuplicateError if the name is already defined in global scope
returns nil if found the name of same position
func (*CompilationUnit) AddGlobalType ¶ added in v0.3.0
func (c *CompilationUnit) AddGlobalType(ty CustomType) error
AddGlobalType adds a typedef to this unit
returns DefinitionDuplicateError if the type name is already defined in global scope
returns nil if found the definition of same position
There's no need to call AddGlobalName again for the same type
func (*CompilationUnit) AddImport ¶
func (c *CompilationUnit) AddImport(other *CompilationUnit) error
AddImport adds a compilation unit to this unit
func (*CompilationUnit) AddLocalName ¶ added in v0.3.0
func (c *CompilationUnit) AddLocalName(name string, pos Position) error
AddLocalName adds a name to this unit (for embedded structs or enum values)
returns DefinitionDuplicateError if the name is already defined in global scope
func (*CompilationUnit) AddLocalType ¶ added in v0.3.0
func (c *CompilationUnit) AddLocalType(ty CustomType) error
AddLocalType adds a typedef to this unit
returns DefinitionDuplicateError if the type name is already defined in global scope
There's no need to call AddLocalName again for the same type
func (CompilationUnit) String ¶
func (c CompilationUnit) String() string
type CompileError ¶
type CompileError struct { TopLevelError Position Err error }
func (CompileError) Error ¶
func (e CompileError) Error() string
func (CompileError) String ¶
func (e CompileError) String() string
type CompileWarning ¶
type CompileWarning struct { TopLevelWarning Position Warning error }
func (CompileWarning) Error ¶
func (w CompileWarning) Error() string
func (CompileWarning) String ¶
func (w CompileWarning) String() string
type ConstantExpr ¶
type ConstantExpr struct { BasePosition ConstantType *BasicType ConstantValue Literal }
func (ConstantExpr) GetExprKind ¶
func (c ConstantExpr) GetExprKind() ExprKindID
func (ConstantExpr) GetExprType ¶
func (c ConstantExpr) GetExprType() *BasicType
func (ConstantExpr) String ¶
func (c ConstantExpr) String() string
type ConstantField ¶
type ConstantField struct { BasePosition FieldName string // may be empty FieldType *BasicType FieldBitSize int64 FieldConstant Literal FieldOptions *util.OrderedMap[string, *Option] FieldBelongs *Struct }
func (ConstantField) Copy ¶
func (f ConstantField) Copy() Field
func (ConstantField) DumpString ¶ added in v0.4.0
func (f ConstantField) DumpString() string
func (ConstantField) GetFieldBelongs ¶
func (f ConstantField) GetFieldBelongs() *Struct
func (ConstantField) GetFieldBitSize ¶
func (f ConstantField) GetFieldBitSize() int64
func (ConstantField) GetFieldKind ¶
func (f ConstantField) GetFieldKind() FieldKindID
func (ConstantField) GetFieldUniqueName ¶
func (f ConstantField) GetFieldUniqueName() string
func (*ConstantField) SetFieldBelongs ¶
func (f *ConstantField) SetFieldBelongs(s *Struct)
func (ConstantField) String ¶
func (f ConstantField) String() string
type CustomType ¶
type CustomType interface { Position Type GetBelongs() *CompilationUnit SetBelongs(*CompilationUnit) }
type DefinitionDuplicateError ¶
type DefinitionDuplicateError struct { DefName string // type, field or method name PrevDef Position }
func (DefinitionDuplicateError) Error ¶
func (e DefinitionDuplicateError) Error() string
func (DefinitionDuplicateError) String ¶
func (e DefinitionDuplicateError) String() string
type DefinitionNotFoundError ¶
type DefinitionNotFoundError struct {
DefName string // type, field or method name
}
func (DefinitionNotFoundError) Error ¶
func (e DefinitionNotFoundError) Error() string
func (DefinitionNotFoundError) String ¶
func (e DefinitionNotFoundError) String() string
type DefinitionTypeConflictError ¶
func (DefinitionTypeConflictError) Error ¶
func (e DefinitionTypeConflictError) Error() string
func (DefinitionTypeConflictError) String ¶
func (e DefinitionTypeConflictError) String() string
type EmbeddedField ¶
type EmbeddedField struct { BasePosition FieldType *Struct FieldBitSize int64 FieldOptions *util.OrderedMap[string, *Option] FieldBelongs *Struct }
func (EmbeddedField) Copy ¶
func (f EmbeddedField) Copy() Field
func (EmbeddedField) DumpString ¶ added in v0.4.0
func (f EmbeddedField) DumpString() string
func (EmbeddedField) GetFieldBelongs ¶
func (f EmbeddedField) GetFieldBelongs() *Struct
func (EmbeddedField) GetFieldBitSize ¶
func (f EmbeddedField) GetFieldBitSize() int64
func (EmbeddedField) GetFieldKind ¶
func (f EmbeddedField) GetFieldKind() FieldKindID
func (EmbeddedField) GetFieldUniqueName ¶
func (f EmbeddedField) GetFieldUniqueName() string
func (*EmbeddedField) SetFieldBelongs ¶
func (f *EmbeddedField) SetFieldBelongs(s *Struct)
func (EmbeddedField) String ¶
func (f EmbeddedField) String() string
type EmbeddedFieldError ¶
func (EmbeddedFieldError) Error ¶
func (e EmbeddedFieldError) Error() string
func (EmbeddedFieldError) String ¶
func (e EmbeddedFieldError) String() string
type Enum ¶
type Enum struct { BasePosition EnumName string EnumBitSize int64 EnumValues *util.OrderedMap[string, *EnumValue] EnumBelongs *CompilationUnit }
func (*Enum) GetBelongs ¶ added in v0.6.0
func (e *Enum) GetBelongs() *CompilationUnit
func (*Enum) GetTypeBitSize ¶
func (*Enum) GetTypeDynamic ¶ added in v1.0.0
func (*Enum) GetTypeName ¶
func (*Enum) SetBelongs ¶ added in v0.6.0
func (e *Enum) SetBelongs(c *CompilationUnit)
func (Enum) ShortString ¶
type EnumConstValueTypeError ¶
func (EnumConstValueTypeError) Error ¶
func (e EnumConstValueTypeError) Error() string
func (EnumConstValueTypeError) String ¶
func (e EnumConstValueTypeError) String() string
type EnumValue ¶
type EnumValue struct { BasePosition EnumValueName string EnumValue int64 EnumValueBelongs *Enum }
type Expr ¶
type Expr interface { Position GetExprKind() ExprKindID GetExprType() *BasicType }
type ExprKindID ¶
type ExprKindID int
const ( ExprKindID_UnopExpr ExprKindID = iota ExprKindID_BinopExpr ExprKindID_CastExpr ExprKindID_TenaryExpr ExprKindID_ConstantExpr ExprKindID_ValueExpr ExprKindID_RawExpr )
func (ExprKindID) IsBinopExpr ¶ added in v0.4.0
func (e ExprKindID) IsBinopExpr() bool
func (ExprKindID) IsCastExpr ¶ added in v0.4.0
func (e ExprKindID) IsCastExpr() bool
func (ExprKindID) IsConstantExpr ¶ added in v0.4.0
func (e ExprKindID) IsConstantExpr() bool
func (ExprKindID) IsRawExpr ¶ added in v0.4.0
func (e ExprKindID) IsRawExpr() bool
func (ExprKindID) IsTenaryExpr ¶ added in v0.4.0
func (e ExprKindID) IsTenaryExpr() bool
func (ExprKindID) IsUnopExpr ¶ added in v0.4.0
func (e ExprKindID) IsUnopExpr() bool
func (ExprKindID) IsValueExpr ¶ added in v0.4.0
func (e ExprKindID) IsValueExpr() bool
type ExprOp ¶
type ExprOp int
const ( ExprOp_ADD ExprOp = iota // + ExprOp_SUB // - ExprOp_MUL // * ExprOp_DIV // / ExprOp_MOD // % ExprOp_POW // ** ExprOp_SHL // << ExprOp_SHR // >> ExprOp_LT // < ExprOp_LE // <= ExprOp_GT // > ExprOp_GE // >= ExprOp_EQ // == ExprOp_NE // != ExprOp_BAND // & ExprOp_BXOR // ^ ExprOp_BOR // | ExprOp_AND // && ExprOp_OR // || ExprOp_NOT // ! ExprOp_BNOT // ~ ExprOp_ASSIGN // = )
type Field ¶
type Field interface { Position GetFieldKind() FieldKindID GetFieldUniqueName() string // FieldBitSize only indicates the size defined in the field, // which may be different from the actual field type size. // For example, a field of type "int32" may have a FieldBitSize // of 16, although its type size is 32. // Or a embedded field may have GetFieldBitSize return 0. But // stored actual size in FieldBitSize. // Or a variable length field may have GetFieldBitSize return -1. GetFieldBitSize() int64 GetFieldBelongs() *Struct SetFieldBelongs(*Struct) Copy() Field }
type FieldConstValueTypeError ¶
func (FieldConstValueTypeError) Error ¶
func (e FieldConstValueTypeError) Error() string
func (FieldConstValueTypeError) String ¶
func (e FieldConstValueTypeError) String() string
type FieldKindID ¶
type FieldKindID int
const ( FieldKindID_Normal FieldKindID = iota FieldKindID_Void FieldKindID_Embedded FieldKindID_Constant )
func (FieldKindID) IsConstant ¶ added in v0.4.0
func (f FieldKindID) IsConstant() bool
func (FieldKindID) IsEmbedded ¶ added in v0.4.0
func (f FieldKindID) IsEmbedded() bool
func (FieldKindID) IsNormal ¶ added in v0.4.0
func (f FieldKindID) IsNormal() bool
func (FieldKindID) IsVoid ¶ added in v0.4.0
func (f FieldKindID) IsVoid() bool
func (FieldKindID) String ¶ added in v0.4.0
func (f FieldKindID) String() string
type FieldNotAlignedError ¶ added in v0.4.0
func (FieldNotAlignedError) Error ¶ added in v0.4.0
func (e FieldNotAlignedError) Error() string
func (FieldNotAlignedError) String ¶ added in v0.4.0
func (e FieldNotAlignedError) String() string
type FileIdentifer ¶
type FileIdentifer struct { Name string // file name written in import statement, can be relative or absolute Path string // absolute path }
func (FileIdentifer) String ¶
func (f FileIdentifer) String() string
type FileNotFoundError ¶
type FileNotFoundError struct { File *FileIdentifer Err error }
func (FileNotFoundError) Error ¶
func (e FileNotFoundError) Error() string
func (FileNotFoundError) String ¶
func (e FileNotFoundError) String() string
type FileReadError ¶
type FileReadError struct { File *FileIdentifer Err error }
func (FileReadError) Error ¶
func (e FileReadError) Error() string
func (FileReadError) String ¶
func (e FileReadError) String() string
type FileWriteError ¶
type FileWriteError struct { File *FileIdentifer Err error }
func (FileWriteError) Error ¶
func (e FileWriteError) Error() string
func (FileWriteError) String ¶
func (e FileWriteError) String() string
type FloatLiteral ¶
type FloatLiteral struct { BasePosition FloatValue float64 }
func (FloatLiteral) GetLiteralKind ¶
func (l FloatLiteral) GetLiteralKind() LiteralKindID
func (FloatLiteral) GetLiteralValue ¶
func (l FloatLiteral) GetLiteralValue() interface{}
func (FloatLiteral) GetLiteralValueIn ¶
func (l FloatLiteral) GetLiteralValueIn(ty TypeID) interface{}
func (FloatLiteral) GetMinimalTypeID ¶ added in v0.4.0
func (l FloatLiteral) GetMinimalTypeID() TypeID
func (FloatLiteral) String ¶
func (l FloatLiteral) String() string
type GeneralError ¶
type GeneralError struct { TopLevelError Position Err error }
func (GeneralError) Error ¶
func (e GeneralError) Error() string
func (GeneralError) String ¶
func (e GeneralError) String() string
type GeneralWarning ¶
type GeneralWarning struct { TopLevelWarning Position Warning error }
func (GeneralWarning) Error ¶
func (w GeneralWarning) Error() string
func (GeneralWarning) String ¶
func (w GeneralWarning) String() string
type GenerateError ¶ added in v0.4.0
type GenerateError struct { TopLevelError Err error }
func (GenerateError) Error ¶ added in v0.4.0
func (e GenerateError) Error() string
func (GenerateError) String ¶ added in v0.4.0
func (e GenerateError) String() string
type GenerateWarning ¶ added in v0.4.0
type GenerateWarning struct { TopLevelWarning Warning error }
func (GenerateWarning) Error ¶ added in v0.4.0
func (w GenerateWarning) Error() string
func (GenerateWarning) String ¶ added in v0.4.0
func (w GenerateWarning) String() string
type GetMethod ¶ added in v0.4.0
type GetMethod struct { BasePosition MethodName string MethodRetType Type MethodExpr Expr MethodBelongs *NormalField }
func (GetMethod) GetMethodBelongs ¶ added in v0.4.0
func (m GetMethod) GetMethodBelongs() *NormalField
func (GetMethod) GetMethodKind ¶ added in v0.4.0
func (m GetMethod) GetMethodKind() MethodKindID
func (GetMethod) GetMethodName ¶ added in v0.4.0
func (*GetMethod) SetMethodBelongs ¶ added in v0.4.0
func (m *GetMethod) SetMethodBelongs(belongs *NormalField)
type ImportCycleError ¶
type ImportCycleError struct {
File *FileIdentifer
}
func (ImportCycleError) Error ¶
func (e ImportCycleError) Error() string
func (ImportCycleError) String ¶
func (e ImportCycleError) String() string
type ImportSelfError ¶
type ImportSelfError struct{}
func (ImportSelfError) Error ¶
func (e ImportSelfError) Error() string
func (ImportSelfError) String ¶
func (e ImportSelfError) String() string
type ImportingError ¶
type ImportingError struct { File *FileIdentifer Err error }
func (ImportingError) Error ¶
func (e ImportingError) Error() string
func (ImportingError) String ¶
func (e ImportingError) String() string
type ImportingWarning ¶
type ImportingWarning struct { File *FileIdentifer Warning error }
func (ImportingWarning) Error ¶
func (w ImportingWarning) Error() string
func (ImportingWarning) String ¶
func (w ImportingWarning) String() string
type IntLiteral ¶
type IntLiteral struct { BasePosition IntValue int64 }
func (IntLiteral) GetLiteralKind ¶
func (l IntLiteral) GetLiteralKind() LiteralKindID
func (IntLiteral) GetLiteralValue ¶
func (l IntLiteral) GetLiteralValue() interface{}
func (IntLiteral) GetLiteralValueIn ¶
func (l IntLiteral) GetLiteralValueIn(ty TypeID) interface{}
func (IntLiteral) GetMinimalTypeID ¶ added in v0.4.0
func (l IntLiteral) GetMinimalTypeID() TypeID
func (IntLiteral) String ¶
func (l IntLiteral) String() string
type InvalidConstIdentifierError ¶ added in v1.0.0
func (InvalidConstIdentifierError) Error ¶ added in v1.0.0
func (e InvalidConstIdentifierError) Error() string
func (InvalidConstIdentifierError) String ¶ added in v1.0.0
func (e InvalidConstIdentifierError) String() string
type InvalidEmbeddedFieldError ¶
type InvalidEmbeddedFieldError struct{}
func (InvalidEmbeddedFieldError) Error ¶
func (e InvalidEmbeddedFieldError) Error() string
func (InvalidEmbeddedFieldError) String ¶
func (e InvalidEmbeddedFieldError) String() string
type InvalidEnumDefError ¶
func (InvalidEnumDefError) Error ¶
func (e InvalidEnumDefError) Error() string
func (InvalidEnumDefError) String ¶
func (e InvalidEnumDefError) String() string
type InvalidExprError ¶ added in v1.2.0
func (InvalidExprError) Error ¶ added in v1.2.0
func (e InvalidExprError) Error() string
func (InvalidExprError) String ¶ added in v1.2.0
func (e InvalidExprError) String() string
type InvalidFieldError ¶
func (InvalidFieldError) Error ¶
func (e InvalidFieldError) Error() string
func (InvalidFieldError) String ¶
func (e InvalidFieldError) String() string
type InvalidLiteralError ¶
func (InvalidLiteralError) Error ¶
func (e InvalidLiteralError) Error() string
func (InvalidLiteralError) String ¶
func (e InvalidLiteralError) String() string
type InvalidSizeError ¶
func (InvalidSizeError) Error ¶
func (e InvalidSizeError) Error() string
func (InvalidSizeError) String ¶
func (e InvalidSizeError) String() string
type InvalidStructDefError ¶
func (InvalidStructDefError) Error ¶
func (e InvalidStructDefError) Error() string
func (InvalidStructDefError) String ¶
func (e InvalidStructDefError) String() string
type JoinTopLevelErrors ¶
type JoinTopLevelErrors struct { TopLevelError Errs []TopLevelError }
func (JoinTopLevelErrors) Error ¶
func (e JoinTopLevelErrors) Error() string
func (JoinTopLevelErrors) String ¶
func (e JoinTopLevelErrors) String() string
type JoinTopLevelWarnings ¶
type JoinTopLevelWarnings struct { TopLevelWarning Warnings []TopLevelWarning }
func (JoinTopLevelWarnings) Error ¶
func (w JoinTopLevelWarnings) Error() string
func (JoinTopLevelWarnings) String ¶
func (w JoinTopLevelWarnings) String() string
type Literal ¶
type Literal interface { GetLiteralKind() LiteralKindID GetLiteralValue() interface{} GetLiteralValueIn(ty TypeID) interface{} GetMinimalTypeID() TypeID }
type LiteralKindID ¶
type LiteralKindID int
const ( LiteralKindID_Bool LiteralKindID = iota LiteralKindID_Int LiteralKindID_Float LiteralKindID_String )
func (LiteralKindID) IsBool ¶ added in v0.3.0
func (l LiteralKindID) IsBool() bool
func (LiteralKindID) IsFloat ¶ added in v0.3.0
func (l LiteralKindID) IsFloat() bool
func (LiteralKindID) IsInt ¶ added in v0.3.0
func (l LiteralKindID) IsInt() bool
func (LiteralKindID) IsString ¶ added in v0.3.0
func (l LiteralKindID) IsString() bool
func (LiteralKindID) String ¶
func (l LiteralKindID) String() string
type Method ¶
type Method interface { Position GetMethodKind() MethodKindID GetMethodName() string GetMethodBelongs() *NormalField SetMethodBelongs(*NormalField) }
type MethodKindID ¶
type MethodKindID int
const ( MethodKindID_Get MethodKindID = iota MethodKindID_Set )
func (MethodKindID) IsGet ¶ added in v0.4.0
func (m MethodKindID) IsGet() bool
func (MethodKindID) IsSet ¶ added in v0.4.0
func (m MethodKindID) IsSet() bool
func (MethodKindID) String ¶
func (m MethodKindID) String() string
type MethodTypeError ¶ added in v0.7.1
func (MethodTypeError) Error ¶ added in v0.7.1
func (e MethodTypeError) Error() string
func (MethodTypeError) String ¶ added in v0.7.1
func (e MethodTypeError) String() string
type MultipleInputFileError ¶ added in v0.4.0
type MultipleInputFileError struct {
Files []string
}
func (MultipleInputFileError) Error ¶ added in v0.4.0
func (e MultipleInputFileError) Error() string
func (MultipleInputFileError) String ¶ added in v0.4.0
func (e MultipleInputFileError) String() string
type NameStyleError ¶
func (NameStyleError) Error ¶
func (e NameStyleError) Error() string
func (NameStyleError) String ¶
func (e NameStyleError) String() string
type NameStyleNotStandardWarning ¶ added in v0.4.0
func (NameStyleNotStandardWarning) Error ¶ added in v0.4.0
func (w NameStyleNotStandardWarning) Error() string
func (NameStyleNotStandardWarning) String ¶ added in v0.4.0
func (w NameStyleNotStandardWarning) String() string
type NameStyleWarning ¶
func (NameStyleWarning) Error ¶
func (w NameStyleWarning) Error() string
func (NameStyleWarning) String ¶
func (w NameStyleWarning) String() string
type NoInputFileError ¶ added in v0.4.0
type NoInputFileError struct{}
func (NoInputFileError) Error ¶ added in v0.4.0
func (e NoInputFileError) Error() string
func (NoInputFileError) String ¶ added in v0.4.0
func (e NoInputFileError) String() string
type NormalField ¶
type NormalField struct { BasePosition FieldName string FieldType Type FieldBitSize int64 FieldMethods *util.OrderedMap[string, *util.OrderedMap[MethodKindID, Method]] FieldOptions *util.OrderedMap[string, *Option] FieldBelongs *Struct }
func (NormalField) Copy ¶
func (f NormalField) Copy() Field
func (NormalField) DumpString ¶ added in v0.4.0
func (f NormalField) DumpString() string
func (NormalField) GetFieldBelongs ¶
func (f NormalField) GetFieldBelongs() *Struct
func (NormalField) GetFieldBitSize ¶
func (f NormalField) GetFieldBitSize() int64
func (NormalField) GetFieldKind ¶
func (f NormalField) GetFieldKind() FieldKindID
func (NormalField) GetFieldUniqueName ¶
func (f NormalField) GetFieldUniqueName() string
func (*NormalField) SetFieldBelongs ¶
func (f *NormalField) SetFieldBelongs(s *Struct)
func (NormalField) String ¶
func (f NormalField) String() string
type Option ¶
type Option struct { BasePosition OptionName string OptionValue Literal }
type OptionDuplicateError ¶
func (OptionDuplicateError) Error ¶
func (e OptionDuplicateError) Error() string
func (OptionDuplicateError) String ¶
func (e OptionDuplicateError) String() string
type OptionNotAvailableWarning ¶ added in v0.4.0
func (OptionNotAvailableWarning) Error ¶ added in v0.4.0
func (w OptionNotAvailableWarning) Error() string
func (OptionNotAvailableWarning) String ¶ added in v0.4.0
func (w OptionNotAvailableWarning) String() string
type OptionNotSetWarning ¶ added in v1.0.0
func (OptionNotSetWarning) Error ¶ added in v1.0.0
func (w OptionNotSetWarning) Error() string
func (OptionNotSetWarning) String ¶ added in v1.0.0
func (w OptionNotSetWarning) String() string
type OptionTypeError ¶
func (OptionTypeError) Error ¶
func (e OptionTypeError) Error() string
func (OptionTypeError) String ¶
func (e OptionTypeError) String() string
type OptionUnknownWarning ¶
type OptionUnknownWarning struct {
OptionName string
}
func (OptionUnknownWarning) Error ¶
func (w OptionUnknownWarning) Error() string
func (OptionUnknownWarning) String ¶
func (w OptionUnknownWarning) String() string
type OptionValueError ¶
func (OptionValueError) Error ¶
func (e OptionValueError) Error() string
func (OptionValueError) String ¶
func (e OptionValueError) String() string
type Package ¶
type Package struct { BasePosition PackageFullPaths []string // com.example.app.module.pkgname PackagePath []string // com.example.app.module PackageName string // pkgname }
func NewPackage ¶ added in v0.3.0
func (Package) Difference ¶ added in v0.3.0
Difference returns the diffence of this package and other package name
e.g. com.example.app.module.pkgname and com.example.app.module.pkgname2 returns ["pkgname2"]
e.g. com.example.app.module.pkgname and com.example.app2 returns ["..", "..", "app2"]
e.g. com.example.app.module.pkgname and tt.t returns ["..", "..", "..", "..", "tt", "t"]
e.g. com.example.app.module.pkgname and com.example.app.module.pkgname.subpkg.abc returns ["subpkg", "abc"]
func (Package) PackageEquals ¶ added in v0.4.0
func (Package) ToFilePath ¶ added in v0.3.0
ToFilePath returns the file path of this package
ext must start with a dot (e.g. ".h", ".c", ".py")
func (Package) ToPath ¶ added in v0.3.0
ToPath returns the path of this package
sep must be a valid path separator (e.g. "/", ".")
ext must start with a dot (e.g. ".h", ".c", ".py")
func (Package) ToRelativePath ¶ added in v0.3.0
ToRelativePath returns the relative path of this package to other package
ext must start with a dot (e.g. ".h", ".c", ".py")
type PackageDefinitionDuplicateError ¶ added in v0.3.0
func (PackageDefinitionDuplicateError) Error ¶ added in v0.3.0
func (e PackageDefinitionDuplicateError) Error() string
func (PackageDefinitionDuplicateError) String ¶ added in v0.3.0
func (e PackageDefinitionDuplicateError) String() string
type PackageDuplicateError ¶
func (PackageDuplicateError) Error ¶
func (e PackageDuplicateError) Error() string
func (PackageDuplicateError) String ¶
func (e PackageDuplicateError) String() string
type PackageNameNotSetError ¶ added in v0.3.0
type PackageNameNotSetError struct{}
func (PackageNameNotSetError) Error ¶ added in v0.3.0
func (e PackageNameNotSetError) Error() string
func (PackageNameNotSetError) String ¶ added in v0.3.0
func (e PackageNameNotSetError) String() string
type PackageNameNotSetWarning ¶
type PackageNameNotSetWarning struct{}
func (PackageNameNotSetWarning) Error ¶
func (w PackageNameNotSetWarning) Error() string
func (PackageNameNotSetWarning) String ¶
func (w PackageNameNotSetWarning) String() string
type RawExpr ¶ added in v0.4.0
type RawExpr struct { BasePosition ExprType *BasicType Expr string }
func (RawExpr) GetExprKind ¶ added in v0.4.0
func (r RawExpr) GetExprKind() ExprKindID
func (RawExpr) GetExprType ¶ added in v0.4.0
type SetMethod ¶ added in v0.4.0
type SetMethod struct { BasePosition MethodName string MethodParamType Type MethodExpr Expr MethodBelongs *NormalField }
func (SetMethod) GetMethodBelongs ¶ added in v0.4.0
func (m SetMethod) GetMethodBelongs() *NormalField
func (SetMethod) GetMethodKind ¶ added in v0.4.0
func (m SetMethod) GetMethodKind() MethodKindID
func (SetMethod) GetMethodName ¶ added in v0.4.0
func (*SetMethod) SetMethodBelongs ¶ added in v0.4.0
func (m *SetMethod) SetMethodBelongs(belongs *NormalField)
type String ¶
type String struct{}
func (String) GetTypeBitSize ¶
func (String) GetTypeDynamic ¶ added in v1.0.0
func (String) GetTypeName ¶
type StringLiteral ¶
type StringLiteral struct { BasePosition StringValue string }
func (StringLiteral) GetLiteralKind ¶
func (l StringLiteral) GetLiteralKind() LiteralKindID
func (StringLiteral) GetLiteralValue ¶
func (l StringLiteral) GetLiteralValue() interface{}
func (StringLiteral) GetLiteralValueIn ¶
func (l StringLiteral) GetLiteralValueIn(ty TypeID) interface{}
func (StringLiteral) GetMinimalTypeID ¶ added in v0.4.0
func (l StringLiteral) GetMinimalTypeID() TypeID
func (StringLiteral) String ¶
func (l StringLiteral) String() string
type Struct ¶
type Struct struct { BasePosition StructName string StructBitSize int64 StructDynamic bool StructFields *util.OrderedMap[string, Field] StructBelongs *CompilationUnit }
func (Struct) DumpString ¶ added in v0.4.0
func (*Struct) ForEachField ¶ added in v0.4.0
func (*Struct) ForEachFieldWithPos ¶ added in v0.4.0
func (Struct) GetBelongs ¶ added in v0.6.0
func (s Struct) GetBelongs() *CompilationUnit
func (Struct) GetTypeBitSize ¶
func (Struct) GetTypeDynamic ¶ added in v1.0.0
func (Struct) GetTypeName ¶
func (*Struct) SetBelongs ¶ added in v0.6.0
func (s *Struct) SetBelongs(c *CompilationUnit)
func (*Struct) SumFieldBitSize ¶
type SyntaxError ¶
type SyntaxError struct { TopLevelError Position Err error }
func (SyntaxError) Error ¶
func (e SyntaxError) Error() string
func (*SyntaxError) String ¶
func (e *SyntaxError) String() string
type TargetNotSpecifiedError ¶ added in v0.4.0
type TargetNotSpecifiedError struct{}
func (TargetNotSpecifiedError) Error ¶ added in v0.4.0
func (e TargetNotSpecifiedError) Error() string
func (TargetNotSpecifiedError) String ¶ added in v0.4.0
func (e TargetNotSpecifiedError) String() string
type TargetNotSupportedError ¶ added in v0.4.0
type TargetNotSupportedError struct {
Target string
}
func (TargetNotSupportedError) Error ¶ added in v0.4.0
func (e TargetNotSupportedError) Error() string
func (TargetNotSupportedError) String ¶ added in v0.4.0
func (e TargetNotSupportedError) String() string
type TenaryExpr ¶
type TenaryExpr struct { BasePosition // ExprType is the type of Expr1 or Expr2 // Expr1 and Expr2 must be the same type Cond Expr Expr1 Expr Expr2 Expr }
func (TenaryExpr) GetExprKind ¶
func (t TenaryExpr) GetExprKind() ExprKindID
func (TenaryExpr) GetExprType ¶
func (t TenaryExpr) GetExprType() *BasicType
func (TenaryExpr) String ¶
func (t TenaryExpr) String() string
type TopLevelError ¶
type TopLevelError interface { error IsTopLevelError() }
func TopLevelErrorsJoin ¶
func TopLevelErrorsJoin(errs ...TopLevelError) TopLevelError
type TopLevelWarning ¶
type TopLevelWarning interface { error IsTopLevelWarning() }
func TopLevelWarningsJoin ¶
func TopLevelWarningsJoin(warnings ...TopLevelWarning) TopLevelWarning
type TypeBinopError ¶
func (TypeBinopError) Error ¶
func (e TypeBinopError) Error() string
func (TypeBinopError) String ¶
func (e TypeBinopError) String() string
type TypeNotMatchError ¶
func (TypeNotMatchError) Error ¶
func (e TypeNotMatchError) Error() string
func (TypeNotMatchError) String ¶
func (e TypeNotMatchError) String() string
type TypeUnopError ¶
func (TypeUnopError) Error ¶
func (e TypeUnopError) Error() string
func (TypeUnopError) String ¶
func (e TypeUnopError) String() string
type UnopExpr ¶
type UnopExpr struct { BasePosition ExprType *BasicType Op ExprOp Expr1 Expr }
func (UnopExpr) GetExprKind ¶
func (u UnopExpr) GetExprKind() ExprKindID
func (UnopExpr) GetExprType ¶
type ValueExpr ¶
type ValueExpr struct { BasePosition ValueType *BasicType }
func (ValueExpr) GetExprKind ¶
func (v ValueExpr) GetExprKind() ExprKindID
func (ValueExpr) GetExprType ¶
type VoidField ¶
type VoidField struct { BasePosition FieldBitSize int64 FieldOptions *util.OrderedMap[string, *Option] FieldBelongs *Struct }
func (VoidField) DumpString ¶ added in v0.4.0
func (VoidField) GetFieldBelongs ¶
func (VoidField) GetFieldBitSize ¶
func (VoidField) GetFieldKind ¶
func (f VoidField) GetFieldKind() FieldKindID