golang

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
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)

View Source
var BuiltinTypes syms.TypeMap
View Source
var TheGoLang = GoLang{}

TheGoLang is the instance variable providing support for the Go language

View Source
var TraceTypes = false

Functions

func InstallBuiltinTypes

func InstallBuiltinTypes()

InstallBuiltinTypes initializes the BuiltinTypes map

Types

type GoLang

type GoLang struct {
	Pr *pi.Parser
}

GoLang implements the Lang interface for the Go language

func (*GoLang) AddImportToExts

func (gl *GoLang) AddImportToExts(fs *pi.FileState, im string)

AddImportToExts adds given import into pi.FileState.ExtSyms list assumed to be called as a separate goroutine

func (*GoLang) AddImportsToExts

func (gl *GoLang) AddImportsToExts(fs *pi.FileState, pkg *syms.Symbol)

AddImportsToExts adds imports from given package into pi.FileState.ExtSyms list imports are coded as NameLibrary symbols with names = import path

func (*GoLang) AddPathToExts

func (gl *GoLang) AddPathToExts(fs *pi.FileState, path string)

AddPathToExts adds given path into pi.FileState.ExtSyms list assumed to be called as a separate goroutine

func (*GoLang) AddPathToSyms

func (gl *GoLang) AddPathToSyms(fs *pi.FileState, path string)

AddPathToSyms adds given path into pi.FileState.Syms list assumed to be called as a separate goroutine

func (*GoLang) AddPkgToExts

func (gl *GoLang) AddPkgToExts(fs *pi.FileState, pkg *syms.Symbol) bool

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

func (gl *GoLang) AddPkgToSyms(fs *pi.FileState, pkg *syms.Symbol) bool

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 (gl *GoLang) CompleteLine(fs *pi.FileState, str string, pos lex.Pos) (md complete.MatchData)

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

func (gl *GoLang) CompleteReturnMatches(matches syms.SymMap, scope string, md *complete.MatchData)

CompleteReturnMatches returns the matched syms in given map as completion edit data

func (*GoLang) DeleteUnexported

func (gl *GoLang) DeleteUnexported(sy *syms.Symbol)

DeleteUnexported deletes lower-case unexported items from map, and children of symbols on map

func (*GoLang) ExtsPkg added in v0.5.7

func (gl *GoLang) ExtsPkg(fs *pi.FileState, nm string) (*syms.Symbol, bool)

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

func (gl *GoLang) FindTypeName(tynm string, fs *pi.FileState, pkg *syms.Symbol) *syms.Type

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) HiLine

func (gl *GoLang) HiLine(fs *pi.FileState, line int) lex.Line

func (*GoLang) InferSymbolType

func (gl *GoLang) InferSymbolType(sy *syms.Symbol, fs *pi.FileState, pkg *syms.Symbol)

InferSymbolType infers the symbol types for given symbol and all of its children

func (*GoLang) LexLine

func (gl *GoLang) LexLine(fs *pi.FileState, line int) lex.Line

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) ParseDir

func (gl *GoLang) ParseDir(path string, opts pi.LangDirOpts) *syms.Symbol

func (*GoLang) ParseFile

func (gl *GoLang) ParseFile(fs *pi.FileState)

func (*GoLang) ParseLine

func (gl *GoLang) ParseLine(fs *pi.FileState, line int) *pi.FileState

func (*GoLang) Parser

func (gl *GoLang) Parser() *pi.Parser

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

func (gl *GoLang) ResolveTypes(fs *pi.FileState, pkg *syms.Symbol)

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

func (*GoLang) TypeFromAst

func (gl *GoLang) TypeFromAst(fs *pi.FileState, pkg *syms.Symbol, ty *syms.Type, tyast *parse.Ast) bool

TypeFromAst initializes the types from their Ast parse -- returns true if successful

func (*GoLang) TypesFromAst

func (gl *GoLang) TypesFromAst(fs *pi.FileState, pkg *syms.Symbol)

TypesFromAst initializes the types from their Ast parse

Jump to

Keyboard shortcuts

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