declparse

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgInfo

type ArgInfo struct {
	Name string
	Type TypeInfo
}

func (ArgInfo) String

func (arg ArgInfo) String() string

type EnumDecl

type EnumDecl struct {
	Name  string
	Type  TypeInfo
	Cases []VariableDecl
}

func (EnumDecl) String

func (e EnumDecl) String() string

type FuncArgs

type FuncArgs []ArgInfo

func (FuncArgs) String

func (args FuncArgs) String() string

type FunctionDecl

type FunctionDecl struct {
	Name       string
	ReturnType TypeInfo
	Args       FuncArgs
	IsBlock    bool
	IsPtr      bool
	Variadic   bool
}

func (*FunctionDecl) Ident

func (f *FunctionDecl) Ident() string

func (FunctionDecl) String

func (f FunctionDecl) String() string

type Hint

type Hint int
const (
	HintNone Hint = iota
	HintVariable
	HintEnumCase
	HintFunction
)

type InterfaceDecl

type InterfaceDecl struct {
	Name      string
	Params    []TypeInfo
	SuperName string
}

func (InterfaceDecl) String

func (i InterfaceDecl) String() string

type MethodDecl

type MethodDecl struct {
	TypeMethod  bool // instance method otherwise
	ReturnType  TypeInfo
	NameParts   []string
	Args        []ArgInfo
	Variadic    bool
	Unavailable bool
}

func (*MethodDecl) Name

func (m *MethodDecl) Name() string

func (MethodDecl) String

func (m MethodDecl) String() string

type Node

type Node interface {
	String() string
}

type Parser

type Parser struct {
	Hint Hint
	// contains filtered or unexported fields
}

func NewParser

func NewParser(r io.Reader) *Parser

func NewStringParser

func NewStringParser(s string) *Parser

func (*Parser) Parse

func (p *Parser) Parse() (*Statement, error)

type PropAttr

type PropAttr int
const (
	PropAttrClass PropAttr = iota
	PropAttrWeak
	PropAttrStrong
	PropAttrReadonly
	PropAttrReadwrite
	PropAttrNonatomic
	PropAttrAtomic
	PropAttrCopy
	PropAttrAssign
	PropAttrRetain
	PropAttrNullable
	PropAttrNonnull
	PropAttrGetter
	PropAttrSetter
)

func PropAttrs

func PropAttrs() []PropAttr

func (PropAttr) String

func (attr PropAttr) String() string

type PropertyDecl

type PropertyDecl struct {
	Name     string
	Type     TypeInfo
	Attrs    map[PropAttr]string
	IsOutlet bool
}

func (*PropertyDecl) HasAttr

func (p *PropertyDecl) HasAttr(attr PropAttr) bool

func (PropertyDecl) String

func (p PropertyDecl) String() string

type ProtocolDecl

type ProtocolDecl struct {
	Name      string
	SuperName string
}

func (ProtocolDecl) String

func (i ProtocolDecl) String() string

type Statement

type Statement struct {
	Method    *MethodDecl
	Property  *PropertyDecl
	Interface *InterfaceDecl
	Protocol  *ProtocolDecl
	Function  *FunctionDecl
	Variable  *VariableDecl
	Enum      *EnumDecl
	Struct    *StructDecl
	TypeAlias *TypeInfo
	Typedef   string
}

func (Statement) String

func (s Statement) String() string

type StructDecl

type StructDecl struct {
	Name   string
	Fields []VariableDecl
}

func (StructDecl) String

func (s StructDecl) String() string

type TypeAnnotation

type TypeAnnotation int
const (
	TypeAnnotConst TypeAnnotation = iota
	TypeAnnotOneway
	TypeAnnotSigned
	TypeAnnotUnsigned
	TypeAnnotKindOf
	TypeAnnotCovariant
	TypeAnnotIn
	TypeAnnotOut
	TypeAnnotInout
	TypeAnnotByCopy
	TypeAnnotByRef

	TypeAnnotNullable
	TypeAnnotNonnull
	TypeAnnotNullUnspecified
	TypeAnnotStruct
	TypeAnnotUnavailable
)

func TypeAnnotations

func TypeAnnotations() []TypeAnnotation

func (TypeAnnotation) Format

func (annot TypeAnnotation) Format() string

func (TypeAnnotation) String

func (annot TypeAnnotation) String() string

type TypeInfo

type TypeInfo struct {
	Name     string
	IsPtr    bool
	IsPtrPtr bool
	Annots   map[TypeAnnotation]bool
	Func     *FunctionDecl
	Params   []TypeInfo
}

func (TypeInfo) String

func (t TypeInfo) String() string

func (TypeInfo) TypeNames

func (ti TypeInfo) TypeNames() (t []string)

type VariableDecl

type VariableDecl struct {
	Name  string
	Type  TypeInfo
	Value string
}

func (VariableDecl) String

func (v VariableDecl) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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