parser

package
v0.0.0-...-33d807f Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToHex

func ByteToHex(data byte) string

func PError

func PError(err string)

func PWarning

func PWarning(n int, info string)

func SetTypeMap

func SetTypeMap(tm map[string]string)

func TBaseName

func TBaseName(tbase TBase) string

Types

type EReq

type EReq int
const (
	T_REQUIRED EReq = iota
	T_OPTIONAL
	T_OPT_IN_REQ_OUT
)

type IAnnotation

type IAnnotation interface {
	Annotations() map[string]string
	SetAnnotations(v map[string]string)
}

type IBaseType

type IBaseType interface {
	IType
	GetBase() TBase
	SetStringList(val bool)
	IsStringList() bool
	SetBinary(val bool)
	SetStringEnum(val bool)
	IsStringEnum() bool
	AddStringEnumVal(val string)
	GetStringEnumVals() []string
}

func NewTBaseType

func NewTBaseType(name string, base TBase) IBaseType

type IConst

type IConst interface {
	IDoc
	GetType() IType
	GetName() string
	GetValue() IConstValue
}

func NewTConst

func NewTConst(types IType, name string, val IConstValue) IConst

type IConstValue

type IConstValue interface {
	SetString(val string)
	GetString() string
	SetInteger(val int64)
	GetInteger() int64
	SetDouble(val float64)
	GetDouble() float64
	SetMap()
	AddMap(key, val IConstValue)
	GetMap() map[IConstValue]IConstValue
	SetList()
	AddList(val IConstValue)
	GetList() []IConstValue
	SetIdentifier(val string)
	GetIdentifier() string
	GetIdentifierName() (string, error)
	GetIdentifierWithParent() (string, error)
	SetEnum(val IEnum)
	SetEnumVal(val IEnumValue)
	GetEnumVal() IEnumValue
	GetType() TConstValueType
}

func NewConstValue

func NewConstValue() IConstValue

func NewIntConstValue

func NewIntConstValue(v int64) IConstValue

func NewStringConstValue

func NewStringConstValue(v string) IConstValue

type IContainer

type IContainer interface {
	IType
	SetCppName(name string)
	HasCppName() bool
	GetCppName() string
}

type IDoc

type IDoc interface {
	SetDoc(str string)
	GetDoc() string
	HasDoc() bool
}

type IEnum

type IEnum interface {
	IType
	Append(val IEnumValue)
	GetConstants() []IEnumValue
	GetConstantByName(name string) IEnumValue
	GetConstantByValue(val int64) IEnumValue
	GetMinValue() IEnumValue
	GetMaxValue() IEnumValue
}

func NewTEnum

func NewTEnum(prog IProgram) IEnum

type IEnumValue

type IEnumValue interface {
	IDoc
	IAnnotation
	GetName() string
	GetValue() int
}

func NewTEnumValue

func NewTEnumValue(name string, val int) IEnumValue

type IField

type IField interface {
	IDoc
	IAnnotation
	GetType() IType
	GetName() string
	GetKey() int
	SetReq(req EReq)
	GetReq() EReq
	SetValue(val IConstValue)
	GetValue() IConstValue
	SetXsdOptional(op bool)
	GetXsdOptional() bool
	SetXsdNillAble(able bool)
	GetXsdNillAble() bool
	SetXsdAttrs(attr IStruct)
	GetXsdAttr() IStruct
	SetReference(ref bool)
	GetReference() bool
}

func NewTField

func NewTField(types IType, name string) IField

func NewTFieldWithKey

func NewTFieldWithKey(types IType, name string, key int) IField

type IFunction

type IFunction interface {
	IDoc
	IAnnotation
	GetRetType() IType
	GetName() string
	GetArgList() IStruct
	GetExceptons() IStruct
	IsOneWay() bool
	SetOneWay(oneWay bool)
	SetException(ex IStruct)
}

func NewTFunc

func NewTFunc(ret IType, name string, args IStruct) IFunction

type IList

type IList interface {
	IContainer
	GetElemType() IType
}

func NewTList

func NewTList(et IType) IList

type IMap

type IMap interface {
	IContainer
	GetKeyType() IType
	GetValueType() IType
}

func NewTMap

func NewTMap(key, val IType) IMap

type IProgram

type IProgram interface {
	IDoc
	GetPath() string
	GetOutPath() string
	IsOutputPathAbsolute() bool
	GetName() string
	GetNamespace() string
	GetIncludePrefix() string
	GetTypedefs() []ITypedef
	GetEnums() []IEnum
	GetConsts() []IConst
	GetStruct() []IStruct
	GetExceptions() []IStruct
	GetObjs() []IStruct
	GetService() []IService
	GetNamespacesMap() map[string]string
	AddTypedef(def ITypedef)
	AddEnum(en IEnum)
	AddConst(ct IConst)
	AddStruct(st IStruct)
	AddException(xp IStruct)
	AddService(sv IService)
	GetIncludes() []IProgram
	SetOutPath(path string, absolute bool)
	IsUniqueTypename(tp IType) bool
	SetNamespace(name string)
	Scope() IScope
	AddInclude(prog IProgram)
	AddIncludeNew(path, includeSite string)
	GetIncludeProgs() []IProgram
	SetPrefix(prefix string)
	SetNamespaceLang(lang, namespace string)
	GetNamespaceLang(language string) string
	GetAllNamespace() map[string]string
	SetNamespaceAnnotations(language string, annotations map[string]string)
	GetNamespaceAnnotations(language string) map[string]string
	GetAllNamespaceAnnotations() map[string]map[string]string
	AddCppInclude(path string)
	GetCppInclude() []string
	AddCInclude(path string)
	GetCInclude() []string
}

func NewProgram

func NewProgram(path, name string) IProgram

func NewProgramFile

func NewProgramFile(path string) IProgram

type IScope

type IScope interface {
	AddType(name string, tp IType)
	GetType(name string) IType
	AddService(name string, svr IService)
	GetService(name string) IService
	AddConstant(name string, svr IConst)
	GetConstant(name string) IConst
	Print()
	ResolveConstValue(val IConstValue, tp IType)
}

func NewScope

func NewScope() IScope

type IService

type IService interface {
	IType
	IsService() bool
	SetExtends(extends IService)
	AddFunction(function IFunction)
	GetFunctions() []IFunction
	GetExtends() IService
}

func NewTService

func NewTService(prog IProgram) IService

type ISet

type ISet interface {
	IContainer
	GetElemType() IType
}

func NewTSet

func NewTSet(et IType) ISet

type IStruct

type IStruct interface {
	IType
	SetException(is bool)
	SetUnion(is bool)
	SetXsdAll(all bool)
	GetXsdAll() bool
	Append(field IField) bool
	GetMembers() []IField
	GetSortedMembers() []IField
	IsException() bool
	IsUnion() bool
	GetFieldByName(name string) IField
}

func NewTStruct

func NewTStruct(prog IProgram) IStruct

type IType

type IType interface {
	IDoc
	IAnnotation
	SetName(name_ string)
	GetName() string
	IsVoid() bool
	IsBaseType() bool
	IsString() bool
	IsBinary() bool
	IsBool() bool
	IsTypedef() bool
	IsEnum() bool
	IsStruct() bool
	IsXExcption() bool
	IsContainer() bool
	IsList() bool
	IsSet() bool
	IsMap() bool
	IsSerivce() bool
	GetProgram() IProgram
	GetTrueType() IType
	ByteToHex(data byte) string
}

func NewType

func NewType(program IProgram, name string) IType

func NewTypeDefault

func NewTypeDefault() IType

func NewTypeName

func NewTypeName(name string) IType

func NewTypeProgram

func NewTypeProgram(program IProgram) IType

type ITypedef

type ITypedef interface {
	IType
	GetType() IType
	IsForwardTypedef() bool
	GetSymbolic() string
}

func NewTTypedef

func NewTTypedef(prog IProgram, et IType, symbolic string) ITypedef

func NewTTypedefForward

func NewTTypedefForward(prog IProgram, symbolic string, forward bool) ITypedef

type TAnnotation

type TAnnotation struct {
	Key string
	Val string
}

type TBase

type TBase int
const (
	TYPE_VOID TBase = iota
	TYPE_STRING
	TYPE_BOOL
	TYPE_I8
	TYPE_I16
	TYPE_I32
	TYPE_I64
	TYPE_DOUBLE
)

func (*TBase) String

func (t *TBase) String() string

type TConstValueType

type TConstValueType int
const (
	CV_UNKNOWN TConstValueType = iota
	CV_INTEGER
	CV_DOUBLE
	CV_STRING
	CV_MAP
	CV_LIST
	CV_IDENTIFIER
	CV_ENUM
)

type TFieldId

type TFieldId struct {
	Value        int
	AutoAssigned bool
}

Jump to

Keyboard shortcuts

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