convert

package
v0.0.0-...-fcffdc5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const LocalVariablePrefix = "var"

Variables

This section is empty.

Functions

func AssignPath

func AssignPath(dt *gen.DefinedTree, path path.TypePath, variable string, expr ast.Expression, loc tokenizer.SourceLocation) error

func ConstantPath

func ConstantPath(expr ast.Expression) path.TypePath

func ConstantString

func ConstantString(expr ast.Expression) string

func Convert

func Convert(dmf *ast.File, packageName string, importPath string) (*gen.DefinedTree, error)

func ConvertFiles

func ConvertFiles(inputFiles []string, outputGo string, outputPack string, packageName string, importPath string) error

func DefaultSrcSetting

func DefaultSrcSetting(tree *gen.DefinedTree, typePath path.TypePath) types.SrcSetting

func DefinePath

func DefinePath(dt *gen.DefinedTree, path path.TypePath) error

func DefineProc

func DefineProc(dt *gen.DefinedTree, typePath path.TypePath, isVerb bool, variable string, loc tokenizer.SourceLocation) error

func DefineVar

func DefineVar(dt *gen.DefinedTree, path path.TypePath, varType path.TypePath, variable string, loc tokenizer.SourceLocation) error

func ExprToGo

func ExprToGo(expr ast.Expression, ctx CodeGenContext) (exprString string, etype dtype.DType, err error)

expressions should always produce a types.Value

func FuncBodyToGo

func FuncBodyToGo(body []ast.Statement, ctx CodeGenContext) (lines []string, err error)

func ImplementFunction

func ImplementFunction(dt *gen.DefinedTree, path path.TypePath, function string, arguments []ast.ProcArgument, body []ast.Statement, loc tokenizer.SourceLocation) error

func MergeGoLines

func MergeGoLines(lines []string) string

func ParseSettings

func ParseSettings(dt *gen.DefinedTree, typePath path.TypePath, body []ast.Statement) (types.ProcSettings, []ast.Statement, error)

func ParseSrcSetting

func ParseSrcSetting(expr ast.Expression, stype ast.StatementType) (types.SrcSetting, error)

func StatementToGo

func StatementToGo(statement ast.Statement, ctx CodeGenContext) (lines []string, err error)

Types

type CodeGenContext

type CodeGenContext struct {
	WorldRef string
	Tree     *gen.DefinedTree
	VarTypes map[string]dtype.DType
	VarsUsed map[string]struct{}
	Result   string
	ThisProc string
	DefIndex uint
}

func (CodeGenContext) ChunkName

func (ctx CodeGenContext) ChunkName() string

func (CodeGenContext) ResolveNonLocal

func (ctx CodeGenContext) ResolveNonLocal(name string) (get string, set func(to string) string, vtype dtype.DType, ok bool)

func (CodeGenContext) UseVar

func (ctx CodeGenContext) UseVar(v string)

func (CodeGenContext) UsrRef

func (ctx CodeGenContext) UsrRef() string

func (CodeGenContext) WithVar

func (ctx CodeGenContext) WithVar(name string, varType dtype.DType) CodeGenContext

type ResourceType

type ResourceType int
const (
	ResourceTypeNone ResourceType = iota
	ResourceTypeIcon
	ResourceTypeAudio
)

func ResourceTypeByName

func ResourceTypeByName(name string) ResourceType

Jump to

Keyboard shortcuts

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