Documentation ¶
Index ¶
- Variables
- func InstallBuiltinTypes()
- type GoLang
- func (gl *GoLang) AddImportToExts(fs *pi.FileState, im string)
- func (gl *GoLang) AddImportsToExts(fs *pi.FileState, pkg *syms.Symbol)
- func (gl *GoLang) AddPathToExts(fs *pi.FileState, path string)
- func (gl *GoLang) AddPathToSyms(fs *pi.FileState, path string)
- func (gl *GoLang) AddPkgToExts(fs *pi.FileState, pkg *syms.Symbol) bool
- func (gl *GoLang) AddPkgToSyms(fs *pi.FileState, pkg *syms.Symbol) bool
- func (gl *GoLang) CompleteEdit(fs *pi.FileState, text string, cp int, comp complete.Completion, seed string) (ed complete.EditData)
- func (gl *GoLang) CompleteLine(fs *pi.FileState, str string, pos lex.Pos) (md complete.MatchData)
- func (gl *GoLang) CompleteLinePkg(fs *pi.FileState, str string, pos lex.Pos, pkg, scope, name string) (md complete.MatchData)
- func (gl *GoLang) CompleteReturnMatches(matches syms.SymMap, scope string, md *complete.MatchData)
- func (gl *GoLang) DeleteUnexported(sy *syms.Symbol)
- func (gl *GoLang) ExtsPkg(fs *pi.FileState, nm string) (*syms.Symbol, bool)
- func (gl *GoLang) FindTypeName(tynm string, fs *pi.FileState, pkg *syms.Symbol) *syms.Type
- func (gl *GoLang) FuncTypeFromAst(fs *pi.FileState, pkg *syms.Symbol, ast *parse.Ast, fty *syms.Type)
- func (gl *GoLang) HiLine(fs *pi.FileState, line int) lex.Line
- func (gl *GoLang) InferSymbolType(sy *syms.Symbol, fs *pi.FileState, pkg *syms.Symbol)
- func (gl *GoLang) LexLine(fs *pi.FileState, line int) lex.Line
- func (gl *GoLang) NamesFromAst(fs *pi.FileState, pkg *syms.Symbol, ast *parse.Ast, idx int) []string
- func (gl *GoLang) ParamsFromAst(fs *pi.FileState, pkg *syms.Symbol, pars *parse.Ast, fty *syms.Type)
- func (gl *GoLang) ParseDir(path string, opts pi.LangDirOpts) *syms.Symbol
- func (gl *GoLang) ParseFile(fs *pi.FileState)
- func (gl *GoLang) ParseLine(fs *pi.FileState, line int) *pi.FileState
- func (gl *GoLang) Parser() *pi.Parser
- func (gl *GoLang) PathNamesInString(fs *pi.FileState, str string, pos lex.Pos) (pkg, scope, name string, tok token.KeyToken)
- func (gl *GoLang) ResolveTypes(fs *pi.FileState, pkg *syms.Symbol)
- func (gl *GoLang) SubTypeFromAst(fs *pi.FileState, pkg *syms.Symbol, ast *parse.Ast, idx int) *syms.Type
- func (gl *GoLang) TypeFromAst(fs *pi.FileState, pkg *syms.Symbol, ty *syms.Type, tyast *parse.Ast) bool
- func (gl *GoLang) TypesFromAst(fs *pi.FileState, pkg *syms.Symbol)
Constants ¶
This section is empty.
Variables ¶
var BuiltinTypeKind = []syms.TypeKindSize{ {"int", syms.Int, int(unsafe.Sizeof(int(0)))}, {"int8", syms.Int8, 1}, {"int16", syms.Int16, 2}, {"int32", syms.Int32, 4}, {"int64", syms.Int64, 8}, {"uint", syms.Uint, int(unsafe.Sizeof(uint(0)))}, {"uint8", syms.Uint8, 1}, {"uint16", syms.Uint16, 2}, {"uint32", syms.Uint32, 4}, {"uint64", syms.Uint64, 8}, {"uintptr", syms.Uintptr, 8}, {"byte", syms.Uint8, 1}, {"rune", syms.Int32, 4}, {"float32", syms.Float32, 4}, {"float64", syms.Float64, 8}, {"complex64", syms.Complex64, 8}, {"complex128", syms.Complex128, 16}, {"bool", syms.Bool, 1}, {"string", syms.String, 0}, {"error", syms.Interface, 0}, }
BuiltinTypeKind are the type names and kinds for builtin Go primitive types (i.e., those with names)
var BuiltinTypes syms.TypeMap
var TheGoLang = GoLang{}
TheGoLang is the instance variable providing support for the Go language
var TraceTypes = false
Functions ¶
func InstallBuiltinTypes ¶
func InstallBuiltinTypes()
InstallBuiltinTypes initializes the BuiltinTypes map
Types ¶
type GoLang ¶
GoLang implements the Lang interface for the Go language
func (*GoLang) AddImportToExts ¶
AddImportToExts adds given import into pi.FileState.ExtSyms list assumed to be called as a separate goroutine
func (*GoLang) AddImportsToExts ¶
AddImportsToExts adds imports from given package into pi.FileState.ExtSyms list imports are coded as NameLibrary symbols with names = import path
func (*GoLang) AddPathToExts ¶
AddPathToExts adds given path into pi.FileState.ExtSyms list assumed to be called as a separate goroutine
func (*GoLang) AddPathToSyms ¶
AddPathToSyms adds given path into pi.FileState.Syms list assumed to be called as a separate goroutine
func (*GoLang) AddPkgToExts ¶
AddPkgToExts adds given package symbol, with children from package to pi.FileState.ExtSyms map -- merges with anything already there does NOT add imports -- that is an optional second step. Returns true if there was an existing entry for this package.
func (*GoLang) AddPkgToSyms ¶
AddPkgToSyms adds given package symbol, with children from package to pi.FileState.Syms map -- merges with anything already there does NOT add imports -- that is an optional second step. Returns true if there was an existing entry for this package.
func (*GoLang) CompleteEdit ¶
func (gl *GoLang) CompleteEdit(fs *pi.FileState, text string, cp int, comp complete.Completion, seed string) (ed complete.EditData)
CompleteEdit returns the completion edit data for integrating the selected completion into the source
func (*GoLang) CompleteLine ¶
func (*GoLang) CompleteLinePkg ¶ added in v0.5.7
func (gl *GoLang) CompleteLinePkg(fs *pi.FileState, str string, pos lex.Pos, pkg, scope, name string) (md complete.MatchData)
CompleteLinePkg returns completion for symbol in given external package
func (*GoLang) CompleteReturnMatches ¶ added in v0.5.7
CompleteReturnMatches returns the matched syms in given map as completion edit data
func (*GoLang) DeleteUnexported ¶
DeleteUnexported deletes lower-case unexported items from map, and children of symbols on map
func (*GoLang) ExtsPkg ¶ added in v0.5.7
ExtsPkg returns the symbol in fs.ExtSyms for given name that is a package -- false if not found -- assumed to be called under SymsMu lock
func (*GoLang) FindTypeName ¶
FindTypeName finds given type name in pkg and in broader context
func (*GoLang) FuncTypeFromAst ¶
func (gl *GoLang) FuncTypeFromAst(fs *pi.FileState, pkg *syms.Symbol, ast *parse.Ast, fty *syms.Type)
FuncTypeFromAst initializes a function type from ast -- type can either be anon or a named type -- if anon then the name is the full type signature without param names
func (*GoLang) InferSymbolType ¶
InferSymbolType infers the symbol types for given symbol and all of its children
func (*GoLang) NamesFromAst ¶
func (gl *GoLang) NamesFromAst(fs *pi.FileState, pkg *syms.Symbol, ast *parse.Ast, idx int) []string
NamesFromAst returns a slice of name(s) from namelist nodes
func (*GoLang) ParamsFromAst ¶
func (gl *GoLang) ParamsFromAst(fs *pi.FileState, pkg *syms.Symbol, pars *parse.Ast, fty *syms.Type)
ParamsFromAst sets params as Els for given function type (also for return types)
func (*GoLang) PathNamesInString ¶ added in v0.5.7
func (gl *GoLang) PathNamesInString(fs *pi.FileState, str string, pos lex.Pos) (pkg, scope, name string, tok token.KeyToken)
PathNamesInString returns the package, scope (type, fun) and element names in given string (line of code) at given position
func (*GoLang) ResolveTypes ¶
ResolveTypes initializes all user-defined types from Ast data and then resolves types of symbols. The pkg must be a single package symbol i.e., the children there are all the elements of the package and the types are all the global types within the package.
func (*GoLang) SubTypeFromAst ¶
func (gl *GoLang) SubTypeFromAst(fs *pi.FileState, pkg *syms.Symbol, ast *parse.Ast, idx int) *syms.Type
SubTypeFromAst returns a subtype from child ast at given index, nil if failed