Documentation ¶
Index ¶
- Variables
- type Argument
- func (arg *Argument) Declaration() string
- func (arg *Argument) Expression() string
- func (arg *Argument) IsListRef(ri int) bool
- func (arg *Argument) Parse(expr ast.Expr) *Argument
- func (arg *Argument) Parser(aName, pName, iName string, argPos, numArgs, reqArgs int) []string
- func (arg *Argument) ProtoGo() string
- func (arg *Argument) ProtoSh() string
- func (arg *Argument) Prototype(sh bool) string
- func (arg *Argument) String() string
- type FormatOptions
- type Function
- func (fun *Function) Elements(sh bool, pkg string) (name string, args, rets []string)
- func (fun *Function) FullName(pkg string) string
- func (fun *Function) ImportedName(pkg string) string
- func (fun *Function) MinArgs() int
- func (fun *Function) Parse(decl *ast.FuncDecl) *Function
- func (fun *Function) ProtoGo(pkg string) string
- func (fun *Function) ProtoSh(pkg string) string
- func (fun *Function) Prototype(sh bool, pkg string) string
- type Package
- type Reference
- type Return
- func (ret *Return) Declaration() string
- func (ret *Return) Formatter(rName, qName string, retPos, numRets int, format FormatOptions) []string
- func (ret *Return) IsListRef(ri int) bool
- func (ret *Return) Parse(expr ast.Expr) *Return
- func (ret *Return) ProtoGo() string
- func (ret *Return) ProtoSh() string
- func (ret *Return) Prototype(sh bool) string
- func (ret *Return) String() string
Constants ¶
This section is empty.
Variables ¶
var DefaultFormat = FormatOptions{
IntegerBase: 10,
FloatFormat: 'g',
FloatPrecision: -1,
ComplexFormat: 'g',
ComplexPrecision: -1,
}
DefaultFormat contains the default formatting options for a Return value formatted as a string.
Functions ¶
This section is empty.
Types ¶
type Argument ¶
Argument represents an individual argument variable in the list of argument variables of an individual function definition.
func NewArgument ¶
NewArgument creates a new Argument by inspecting the parsed AST field.
func (*Argument) Declaration ¶
Declaration returns a representation of the type of this argument that can be attached to a local variable identifier.
func (*Argument) Expression ¶
Expression returns a string representation of the receiver arg suitable for passing on as argument in a function call.
func (*Argument) IsListRef ¶
IsListRef returns whether or not the reference at index ri is one of the list types (array or ellipses).
func (*Argument) Parser ¶
Parser returns a slice of Go source code lines defining an anonymous function that will parse a string into a variable whose type is identified by the receiver arg's Type.
func (*Argument) ProtoGo ¶
ProtoGo returns the signature used for this Argument value for the Go interface.
func (*Argument) ProtoSh ¶
ProtoSh returns the signature used for this Argument value for the shell interface.
type FormatOptions ¶
type FormatOptions struct { IntegerBase int FloatFormat byte FloatPrecision int ComplexFormat byte ComplexPrecision int }
FormatOptions stores the various formatting options used to format a Return value as a string.
type Function ¶
Function represents the signature or definition of an individual function.
func (*Function) Elements ¶
Elements returns the primary components of a prototype formatted for either the Go (sh == false) or the shell (sh == true) interface.
func (*Function) FullName ¶
FullName returns the fully-qualified name of the receiver fun, escaped for use as either Go function or shell command.
func (*Function) ImportedName ¶
ImportedName returns the import-qualified name of the receiver fun.
func (*Function) MinArgs ¶
MinArgs returns the minimum number of arguments required to invoke this function.
func (*Function) Parse ¶
Parse constructs an individual function signature using a node in the AST parsed from a given Go package. Returns affirmation function is supported, i.e., has a signature we currently support.
type Package ¶
type Package struct { Func []*Function // contains filtered or unexported fields }
Package represents the list of function signatures exported from a given Go package.
func (*Package) SetAllowedArgument ¶
SetAllowedArgument defines the base type of arguments we want to keep. If an argument type identifier encountered does not exist in this list, then the entire corresponding function is ignored.
func (*Package) SetAllowedReturn ¶
SetAllowedReturn defines the base type of returns we want to keep. If a return type identifier encountered does not exist in this list, then the entire corresponding function is ignored.
type Reference ¶
type Reference int
Reference represents a reference to a subtype in either the argument list or the return list of a function definition.
Constant values for the enumerated type Reference.
type Return ¶
Return represents an individual return variable in the list of return variables of an individual function definition.
func (*Return) Declaration ¶
Declaration returns a representation of the type of this return variable that can be attached to a local variable identifier.
func (*Return) Formatter ¶
func (ret *Return) Formatter(rName, qName string, retPos, numRets int, format FormatOptions) []string
Formatter returns a slice of Go source code lines defining an anonymous function that will convert a variable whose type is identified by the receiver ret's Type into a string.
func (*Return) IsListRef ¶
IsListRef returns whether or not the reference at index ri is one of the list types (array or ellipses).
func (*Return) ProtoGo ¶
ProtoGo returns the signature used for this Return value for the Go interface.
func (*Return) ProtoSh ¶
ProtoSh returns the signature used for this Return value for the shell interface.