types

package
v0.0.0-...-c211321 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug bool = false
)
View Source
var Gogc bool
View Source
var TypeName func(s string, n *Node) (string, *Node)
View Source
var TypeParameters map[string]map[string]string

TypeParameters maps, for each class, a TypedefName to a type, representing the Objective-C type parameters for that class

View Source
var Typesubs map[string]string

Functions

func AddTypedef

func AddTypedef(n string, tp *Type)

func GoToC

func GoToC(sname, name string, pnames, snames []string, rtype *Type, ptypes []*Type, fun, fin bool, cm bool, goImports map[string]bool) string

Call a C function from Go with a given return type and parameter types

func IsGoInterface

func IsGoInterface(gt string) bool

func PtrIsGoInterface

func PtrIsGoInterface(gt string) bool

func PtrShouldWrap

func PtrShouldWrap(gt string) bool

func SetSuper

func SetSuper(c, p string)

func SetTypeParam

func SetTypeParam(c, n, t string)

func ShouldWrap

func ShouldWrap(gt string) bool

func Super

func Super(c string) string

func TypedefShouldWrap

func TypedefShouldWrap(gt string) bool

func Wrap

func Wrap(s string)

Types

type Node

type Node struct {
	Kind, Content string
	Children      []*Node
}

func APIAvailable

func APIAvailable(s string, n *Node) (string, *Node)

func APIDeprecated

func APIDeprecated(s string, n *Node) (string, *Node)

func APIDeprecatedWithReplacement

func APIDeprecatedWithReplacement(s string, n *Node) (string, *Node)

func APIUnavailable

func APIUnavailable(s string, n *Node) (string, *Node)

func AbstractDeclarator

func AbstractDeclarator(s string, n *Node) (string, *Node)

func ArrayDeclarator

func ArrayDeclarator(s string, n *Node) (string, *Node)

func Attr

func Attr(s string, n *Node) (string, *Node)

func Attribute

func Attribute(s string, n *Node) (string, *Node)

func BareTypedefName

func BareTypedefName(s string, n *Node) (string, *Node)

func Block

func Block(s string, n *Node) (string, *Node)

FIXME: not sure how correct this is...

func DeclarationSpecifiers

func DeclarationSpecifiers(s string, n *Node) (string, *Node)

func Declarator

func Declarator(s string, n *Node) (string, *Node)

func DirectAbstractDeclarator

func DirectAbstractDeclarator(s string, n *Node) (string, *Node)

func DirectDeclarator

func DirectDeclarator(s string, n *Node) (string, *Node)

func DispatchReturns

func DispatchReturns(s string, n *Node) (string, *Node)

func EnumSpecifier

func EnumSpecifier(s string, n *Node) (string, *Node)

func FirstMethodParameter

func FirstMethodParameter(s string, n *Node) (string, *Node)

func FunctionDeclarator

func FunctionDeclarator(s string, n *Node) (string, *Node)

func Generic

func Generic(s string, n *Node) (string, *Node)

func GenericList

func GenericList(s string, n *Node) (string, *Node)

func Identifier

func Identifier(s string, n *Node) (string, *Node)

func MethodParameter

func MethodParameter(s string, n *Node) (string, *Node)

func MethodParameterList

func MethodParameterList(s string, n *Node) (string, *Node)

func MethodSignature

func MethodSignature(s string, n *Node) (string, *Node)

func NSAvailable

func NSAvailable(s string, n *Node) (string, *Node)

func NSAvailableMac

func NSAvailableMac(s string, n *Node) (string, *Node)

func NSDeprecated

func NSDeprecated(s string, n *Node) (string, *Node)

func NewNode

func NewNode(k string, cs ...string) *Node

NewNode returns a new node of kind k with an optional content string as its second parameter.

func NullableAnnotation

func NullableAnnotation(s string, n *Node) (string, *Node)

func ParameterDeclaration

func ParameterDeclaration(s string, n *Node) (string, *Node)

func ParameterList

func ParameterList(s string, n *Node) (string, *Node)

func ParenAbstractDeclarator

func ParenAbstractDeclarator(s string, n *Node) (string, *Node)

func Parse

func Parse(s string) (*Node, error)

func Pointer

func Pointer(s string, n *Node) (string, *Node)

func ReturnsInnerPointer

func ReturnsInnerPointer(s string, n *Node) (string, *Node)

func SpecifierQualifierList

func SpecifierQualifierList(s string, n *Node) (string, *Node)

func StorageClassSpecifier

func StorageClassSpecifier(s string, n *Node) (string, *Node)

func StructOrUnion

func StructOrUnion(s string, n *Node) (string, *Node)

func StructOrUnionSpecifier

func StructOrUnionSpecifier(s string, n *Node) (string, *Node)

func SwiftUnavailable

func SwiftUnavailable(s string, n *Node) (string, *Node)

func TypeQualifier

func TypeQualifier(s string, n *Node) (string, *Node)

func TypeQualifierList

func TypeQualifierList(s string, n *Node) (string, *Node)

func TypeSpecifier

func TypeSpecifier(s string, n *Node) (string, *Node)

func TypedefName

func TypedefName(s string, n *Node) (string, *Node)

func (*Node) AddChild

func (n *Node) AddChild(c *Node) *Node

func (*Node) Annotations

func (n *Node) Annotations() string

func (*Node) ArrayOf

func (n *Node) ArrayOf() *Node

ArrayOf, when called on an array node returns a node describing the type of the elements of the array. Otherwise returns nil when called on non-array types.

func (*Node) BaseType

func (n *Node) BaseType() *Node

BaseType strips off all layers of pointer indirection

func (*Node) CType

func (n *Node) CType() string

func (*Node) CTypeSimplified

func (n *Node) CTypeSimplified() string

func (*Node) HasFunc

func (n *Node) HasFunc() bool

func (*Node) IsArray

func (n *Node) IsArray() bool

IsArray returns true if the node is an array

func (*Node) IsFunction

func (n *Node) IsFunction() bool

func (*Node) IsId

func (n *Node) IsId() bool

func (*Node) IsInstancetype

func (n *Node) IsInstancetype() bool

func (*Node) IsPointer

func (n *Node) IsPointer() bool

IsPointer returns true if the node is a pointer

func (*Node) IsStruct

func (n *Node) IsStruct() bool

func (*Node) PointsTo

func (n *Node) PointsTo() *Node

PointsTo, when called on a pointer node returns a node describing the type pointed to. Otherwise returns nil when called on non-pointer types.

func (*Node) Qualifiers

func (n *Node) Qualifiers() string

func (*Node) ReturnType

func (n *Node) ReturnType() *Node

func (*Node) String

func (n *Node) String(ls ...int) string

type Parser

type Parser func(string, *Node) (string, *Node)

Parser is a function that takes the string to be parsed plus an input Node and returns a new Node and the unparsed remainder string. If the parser fails to parse anything in the input, it should return a nil Node.

func AngBracketed

func AngBracketed(p Parser) Parser

AngBracketed matches the input parser surrounded by literal angled brackets.

func Bracketed

func Bracketed(p Parser) Parser

Bracketed matches the input parser surrounded by literal square brackets.

func ChildOf

func ChildOf(ret *Node, p Parser) Parser

ChildOf takes a node and adds results of a parser to it as a child

func Children

func Children(ps ...Parser) Parser

Children takes a parser and returns a parser that adds the children of its output node to the tree. If multiple parsers are passed in, they are passed to Seq(...)

func ChildrenOf

func ChildrenOf(ret *Node, p Parser) Parser

ChildrenOf takes a node and adds the children of a parser's output node to it as its children.

func CurlyBracketed

func CurlyBracketed(p Parser) Parser

CurlyBracketed matches the input parser surrounded by literal curly brackets.

func Lit

func Lit(f string, ws ...bool) Parser

Lit matches a literal string

func Nest

func Nest(ps ...Parser) Parser

Nest is like Seq but subsequent children are nested inside their earlier siblings.

func NodeNamed

func NodeNamed(k string, p Parser) Parser

func OneOf

func OneOf(ps ...Parser) Parser

OneOf picks the first matching parser and returns its result

func OneOrMore

func OneOrMore(p Parser) Parser

OneOrMore is ZeroOrMore, but fails (returns nil) if the input parser does not match any elements.

func Opt

func Opt(p Parser) Parser

Opt optionally runs a Parser, returning the input Node (instead of nil) if it fails

func Parenthesized

func Parenthesized(p Parser) Parser

Parenthesized matches the input parser surrounded by literal parenthesis.

func Regexp

func Regexp(f string) Parser

Regexp matches a regular expression at the beginning of the input string

func Seq

func Seq(ps ...Parser) Parser

Seq applies parsers in sequence, adding results as children to the input node. Returns nil and the input string unless the entire sequence succeeds

func Word

func Word(f string) Parser

Word matches an element with a word boundary after its end

func ZeroOrMore

func ZeroOrMore(p Parser) Parser

ZeroOrMore returns a sequence of zero or more nodes

type Type

type Type struct {
	Node     *Node
	Class    string
	Variadic bool
}

func NewType

func NewType(n *Node, c string) *Type

func NewTypeFromString

func NewTypeFromString(t, c string) *Type

func (*Type) BaseType

func (t *Type) BaseType() *Type

func (*Type) CGoType

func (t *Type) CGoType() string

func (*Type) CToGo

func (t *Type) CToGo(cval string) string

cast C value to CGo

func (*Type) CType

func (t *Type) CType() string

func (*Type) CTypeAttrib

func (t *Type) CTypeAttrib() string

func (*Type) CloneToClass

func (t *Type) CloneToClass(c string) *Type

func (*Type) GoInterfaceDecl

func (t *Type) GoInterfaceDecl(fin bool) string

func (*Type) GoType

func (t *Type) GoType() string

func (*Type) GoTypeDecl

func (t *Type) GoTypeDecl(fin bool) string

func (*Type) IsFunction

func (t *Type) IsFunction() bool

func (*Type) IsFunctionPtr

func (t *Type) IsFunctionPtr() bool

func (*Type) IsPointer

func (t *Type) IsPointer() bool

func (*Type) IsValist

func (t *Type) IsValist() bool

func (*Type) PointsTo

func (t *Type) PointsTo() *Type

func (*Type) ReturnType

func (t *Type) ReturnType() *Type

func (*Type) String

func (t *Type) String() string

func (*Type) Typedef

func (t *Type) Typedef() *Type

Jump to

Keyboard shortcuts

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