Documentation ¶
Index ¶
- Constants
- Variables
- func Format(format string) error
- func IN(f string, fields ...string) bool
- func ToUnderLine(src string) string
- type BaseArrayV1
- type BaseStructV1
- type BaseV1
- type Byte
- type CStruct
- type DelimiterToken
- type DigitToken
- type F32
- type F64
- type Field
- type FieldSet
- type FieldType
- type LetterToken
- type Lexer
- type LexerV1
- type OperatorToken
- type ReservedWordToken
- type S16
- type S32
- type S64
- type S8
- type Scanner
- type Statement
- type StatementV1
- type Token
- type TokenType
- type U16
- type U32
- type U64
- type U8
Constants ¶
View Source
const ( // C语言中的数据类型 BYTE = FieldType("byte") UInt8 = FieldType("uint8") UInt16 = FieldType("uint16") UInt32 = FieldType("uint32") UInt64 = FieldType("uint64") Int8 = FieldType("int8") Int16 = FieldType("int16") Int32 = FieldType("int32") Int64 = FieldType("int64") Float32 = FieldType("float32") Float64 = FieldType("float64") // string和bytes的区别是,bytes解析出来后是base64编码,string是asc/utf-8编码 Bytes = FieldType("bytes") String = FieldType("string") Hex = FieldType("hex") // 内部结构体 Struct = FieldType("struct") Array = FieldType("array") LEN0 = 0 LEN1 = 1 LEN2 = 2 LEN4 = 4 LEN8 = 8 )
View Source
const ( TFloat32 = TokenType(iota) TFloat64 TInt64 TInt32 TInt16 TInt8 TUint64 TUint32 TUint16 TUint8 TByte TLineEnd TStruct TType TTypedef TLeftBrace TRightBrace TLeftBracket TRightBracket TInteger TFloatingPoint TString )
Variables ¶
View Source
var ( ReserveWords = []string{ "auto", "break", "case", "byte", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "int", "long", "s64", "s32", "s16", "s8", "u64", "u32", "u16", "u8", "register", "return", "short", "signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while", } IntegerWords = []string{ "s64", "s32", "s16", "s8", "u64", "u32", "u16", "u8", } FloatingPointWords = []string{ "float", "double", } TokenTypeMap = map[TokenType]string{ TFloat32: "float32", TFloat64: "float64", TInt64: "int64", TInt32: "int32", TInt16: "int16", TInt8: "int8", TUint64: "uint64", TUint32: "uint32", TUint16: "uint16", TUint8: "uint8", TLineEnd: "line_end", TStruct: "struct", TType: "type", TTypedef: "typedef", TLeftBrace: "left_brace", TRightBrace: "right_brace", TLeftBracket: "left_bracket", TRightBracket: "right_bracket", TInteger: "integer", TFloatingPoint: "floating_point", TString: "string", TByte: "byte", } )
Functions ¶
func ToUnderLine ¶
Types ¶
type BaseArrayV1 ¶
type BaseArrayV1 struct {
// contains filtered or unexported fields
}
func (*BaseArrayV1) Copy ¶
func (b *BaseArrayV1) Copy() StatementV1
func (*BaseArrayV1) Flat ¶
func (b *BaseArrayV1) Flat() ([]StatementV1, error)
func (*BaseArrayV1) Name ¶
func (b *BaseArrayV1) Name() string
func (*BaseArrayV1) SetFieldName ¶
func (b *BaseArrayV1) SetFieldName(name string)
func (*BaseArrayV1) Type ¶
func (b *BaseArrayV1) Type() FieldType
type BaseStructV1 ¶
type BaseStructV1 struct {
// contains filtered or unexported fields
}
func (*BaseStructV1) ClassName ¶
func (b *BaseStructV1) ClassName() string
func (*BaseStructV1) Copy ¶
func (b *BaseStructV1) Copy() StatementV1
func (*BaseStructV1) Flat ¶
func (b *BaseStructV1) Flat() ([]StatementV1, error)
func (*BaseStructV1) Name ¶
func (b *BaseStructV1) Name() string
func (*BaseStructV1) SetFieldName ¶
func (b *BaseStructV1) SetFieldName(name string)
func (*BaseStructV1) Type ¶
func (b *BaseStructV1) Type() FieldType
type BaseV1 ¶
type BaseV1 struct {
// contains filtered or unexported fields
}
func (*BaseV1) Copy ¶
func (b *BaseV1) Copy() StatementV1
func (*BaseV1) Flat ¶
func (b *BaseV1) Flat() ([]StatementV1, error)
func (*BaseV1) SetFieldName ¶
type CStruct ¶
func (*CStruct) FieldNameToLower ¶
func (c *CStruct) FieldNameToLower()
func (*CStruct) ToStatement ¶
type DelimiterToken ¶
type DelimiterToken struct {
// contains filtered or unexported fields
}
界符
func (*DelimiterToken) Type ¶
func (d *DelimiterToken) Type() TokenType
func (*DelimiterToken) Value ¶
func (d *DelimiterToken) Value() interface{}
type DigitToken ¶
type DigitToken struct {
// contains filtered or unexported fields
}
常数
func (*DigitToken) Type ¶
func (d *DigitToken) Type() TokenType
func (*DigitToken) Value ¶
func (d *DigitToken) Value() interface{}
type LetterToken ¶
type LetterToken struct {
// contains filtered or unexported fields
}
标识符
func (*LetterToken) Type ¶
func (l *LetterToken) Type() TokenType
func (*LetterToken) Value ¶
func (l *LetterToken) Value() interface{}
type Lexer ¶
type LexerV1 ¶
type ReservedWordToken ¶
type ReservedWordToken struct {
// contains filtered or unexported fields
}
保留字
func (*ReservedWordToken) Type ¶
func (r *ReservedWordToken) Type() TokenType
func (*ReservedWordToken) Value ¶
func (r *ReservedWordToken) Value() interface{}
type Scanner ¶
type Scanner interface { Format() error Fetch() (byte, error) Next() (byte, error) Index(n int) (byte, error) CurrentIndex() (int, error) ScanDigit() (Token, error) ScanLetter() (Token, error) Scan() ([]Token, error) }
func NewScanner ¶
func NewScannerString ¶
type StatementV1 ¶
type StatementV1 interface { Type() FieldType Name() string SetFieldName(name string) Copy() StatementV1 }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.