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) GetFieldBelongs() *Struct
- func (f ConstantField) GetFieldBitSize() int64
- func (f ConstantField) GetFieldFromEmbedded() *EmbeddedField
- func (f ConstantField) GetFieldKind() FieldKindID
- func (f ConstantField) GetFieldUniqueName() string
- func (f *ConstantField) SetFieldBelongs(s *Struct)
- func (f *ConstantField) SetFieldFromEmbedded(e *EmbeddedField)
- func (f ConstantField) ShortString() string
- func (f ConstantField) String() string
- type CustomType
- type DefinitionDuplicateError
- type DefinitionNotFoundError
- type DefinitionTypeConflictError
- type EmbeddedField
- func (f EmbeddedField) Copy() Field
- func (f EmbeddedField) GetFieldBelongs() *Struct
- func (f EmbeddedField) GetFieldBitSize() int64
- func (f EmbeddedField) GetFieldFromEmbedded() *EmbeddedField
- func (f EmbeddedField) GetFieldKind() FieldKindID
- func (f EmbeddedField) GetFieldUniqueName() string
- func (f *EmbeddedField) SetFieldBelongs(s *Struct)
- func (f *EmbeddedField) SetFieldFromEmbedded(e *EmbeddedField)
- func (f EmbeddedField) ShortString() string
- func (f EmbeddedField) String() string
- type EmbeddedFieldError
- type Enum
- type EnumConstValueTypeError
- type EnumValue
- type Expr
- type ExprKindID
- type ExprOp
- type Field
- type FieldConstValueTypeError
- type FieldKindID
- type FileIdentifer
- type FileNotFoundError
- type FileReadError
- type FileWriteError
- type FloatLiteral
- type GeneralError
- type GeneralWarning
- type ImportCycleError
- type ImportSelfError
- type ImportingError
- type ImportingWarning
- type IntLiteral
- type InvalidEmbeddedFieldError
- type InvalidEnumDefError
- type InvalidFieldError
- type InvalidLiteralError
- type InvalidSizeError
- type InvalidStructDefError
- type JoinTopLevelErrors
- type JoinTopLevelWarnings
- type Literal
- type LiteralKindID
- type Method
- type MethodKindID
- type NameStyleError
- type NameStyleWarning
- type NormalField
- func (f NormalField) Copy() Field
- func (f NormalField) GetFieldBelongs() *Struct
- func (f NormalField) GetFieldBitSize() int64
- func (f NormalField) GetFieldFromEmbedded() *EmbeddedField
- func (f NormalField) GetFieldKind() FieldKindID
- func (f NormalField) GetFieldUniqueName() string
- func (f *NormalField) SetFieldBelongs(s *Struct)
- func (f *NormalField) SetFieldFromEmbedded(e *EmbeddedField)
- func (f NormalField) ShortString() string
- func (f NormalField) String() string
- type Option
- type OptionDuplicateError
- type OptionTypeError
- type OptionUnknownWarning
- type OptionValueError
- type Package
- type PackageDefinitionDuplicateError
- type PackageDuplicateError
- type PackageNameNotSetError
- type PackageNameNotSetWarning
- type Position
- type String
- type StringLiteral
- type Struct
- func (s *Struct) GetFieldByName(name string) Field
- func (s *Struct) GetFieldByUniqueName(name string) Field
- func (s *Struct) GetFieldsStartBit() []int64
- func (s Struct) GetTypeBitSize() int64
- func (s Struct) GetTypeID() TypeID
- func (s Struct) GetTypeName() string
- func (s Struct) ShortString() string
- func (s Struct) String() string
- func (s *Struct) SumFieldBitSize() (fixed_size int64, has_dynamic bool)
- type SyntaxError
- 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) GetFieldBelongs() *Struct
- func (f VoidField) GetFieldBitSize() int64
- func (f VoidField) GetFieldFromEmbedded() *EmbeddedField
- func (f VoidField) GetFieldKind() FieldKindID
- func (f VoidField) GetFieldUniqueName() string
- func (f *VoidField) SetFieldBelongs(s *Struct)
- func (f *VoidField) SetFieldFromEmbedded(e *EmbeddedField)
- func (f VoidField) ShortString() string
- 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{}
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 BasePosition ¶
func (BasePosition) Eqauals ¶ added in v0.3.0
func (p BasePosition) Eqauals(pos Position) bool
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) String ¶
func (p BasePosition) String() string
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 *BasicType) interface{}
func (BoolLiteral) String ¶
func (l BoolLiteral) String() string
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 FieldBelongs *Struct FieldOptions *util.OrderedMap[string, *Option] FromEmbedded *EmbeddedField }
func (ConstantField) Copy ¶
func (f ConstantField) Copy() Field
func (ConstantField) GetFieldBelongs ¶
func (f ConstantField) GetFieldBelongs() *Struct
func (ConstantField) GetFieldBitSize ¶
func (f ConstantField) GetFieldBitSize() int64
func (ConstantField) GetFieldFromEmbedded ¶
func (f ConstantField) GetFieldFromEmbedded() *EmbeddedField
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) SetFieldFromEmbedded ¶
func (f *ConstantField) SetFieldFromEmbedded(e *EmbeddedField)
func (ConstantField) ShortString ¶
func (f ConstantField) ShortString() string
func (ConstantField) String ¶
func (f ConstantField) String() string
type CustomType ¶
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 FieldBelongs *Struct FieldOptions *util.OrderedMap[string, *Option] FromEmbedded *EmbeddedField }
func (EmbeddedField) Copy ¶
func (f EmbeddedField) Copy() Field
func (EmbeddedField) GetFieldBelongs ¶
func (f EmbeddedField) GetFieldBelongs() *Struct
func (EmbeddedField) GetFieldBitSize ¶
func (f EmbeddedField) GetFieldBitSize() int64
func (EmbeddedField) GetFieldFromEmbedded ¶
func (f EmbeddedField) GetFieldFromEmbedded() *EmbeddedField
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) SetFieldFromEmbedded ¶
func (f *EmbeddedField) SetFieldFromEmbedded(e *EmbeddedField)
func (EmbeddedField) ShortString ¶
func (f EmbeddedField) ShortString() string
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] }
func (*Enum) GetEnumValueByName ¶
func (*Enum) GetEnumValueByValue ¶
func (*Enum) GetTypeBitSize ¶
func (*Enum) GetTypeName ¶
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 EnumBelongs *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 )
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 )
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 *BasicType) interface{}
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 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 *BasicType) interface{}
func (IntLiteral) String ¶
func (l IntLiteral) 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 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 *BasicType) interface{} }
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
func (LiteralKindID) ToTypeID ¶
func (l LiteralKindID) ToTypeID() TypeID
type Method ¶
type Method struct { BasePosition MethodKind MethodKindID MethodName string MethodParamType Type MethodExpr Expr MethodBelongs *NormalField // TODO: fix relation }
type MethodKindID ¶
type MethodKindID int
const ( MethodKindID_Get MethodKindID = iota MethodKindID_Set )
func (MethodKindID) String ¶
func (m MethodKindID) String() string
type NameStyleError ¶
func (NameStyleError) Error ¶
func (e NameStyleError) Error() string
func (NameStyleError) String ¶
func (e NameStyleError) String() string
type NameStyleWarning ¶
func (NameStyleWarning) Error ¶
func (w NameStyleWarning) Error() string
func (NameStyleWarning) String ¶
func (w NameStyleWarning) String() string
type NormalField ¶
type NormalField struct { BasePosition FieldName string FieldType Type FieldBitSize int64 FieldBelongs *Struct FieldMethods []*Method FieldOptions *util.OrderedMap[string, *Option] FromEmbedded *EmbeddedField }
func (NormalField) Copy ¶
func (f NormalField) Copy() Field
func (NormalField) GetFieldBelongs ¶
func (f NormalField) GetFieldBelongs() *Struct
func (NormalField) GetFieldBitSize ¶
func (f NormalField) GetFieldBitSize() int64
func (NormalField) GetFieldFromEmbedded ¶
func (f NormalField) GetFieldFromEmbedded() *EmbeddedField
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) SetFieldFromEmbedded ¶
func (f *NormalField) SetFieldFromEmbedded(e *EmbeddedField)
func (NormalField) ShortString ¶
func (f NormalField) ShortString() string
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 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) 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")
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 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 *BasicType) interface{}
func (StringLiteral) String ¶
func (l StringLiteral) String() string
type Struct ¶
type Struct struct { BasePosition StructName string StructBitSize int64 StructFields []Field }
func (*Struct) GetFieldByName ¶
func (*Struct) GetFieldByUniqueName ¶
func (*Struct) GetFieldsStartBit ¶
func (Struct) GetTypeBitSize ¶
func (Struct) GetTypeName ¶
func (Struct) ShortString ¶
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 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 FieldBelongs *Struct FieldOptions *util.OrderedMap[string, *Option] FromEmbedded *EmbeddedField }
func (VoidField) GetFieldBelongs ¶
func (VoidField) GetFieldBitSize ¶
func (VoidField) GetFieldFromEmbedded ¶
func (f VoidField) GetFieldFromEmbedded() *EmbeddedField
func (VoidField) GetFieldKind ¶
func (f VoidField) GetFieldKind() FieldKindID
func (VoidField) GetFieldUniqueName ¶
func (*VoidField) SetFieldBelongs ¶
func (*VoidField) SetFieldFromEmbedded ¶
func (f *VoidField) SetFieldFromEmbedded(e *EmbeddedField)