ast

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpStatementList

func DumpStatementList(output io.Writer, header string, indent int, statements []Statement) error

Types

type DefType

type DefType int
const (
	DefTypeNone DefType = iota
	DefTypeDefine
	DefTypeAssign
	DefTypeVarDef
	DefTypeProcDecl
	DefTypeVerbDecl
	DefTypeImplement
)

func (DefType) String

func (t DefType) String() string

type Definition

type Definition struct {
	Type       DefType
	Path       path.TypePath
	VarType    path.TypePath
	Variable   string
	Expression Expression
	Arguments  []ProcArgument
	Body       []Statement
	SourceLoc  tokenizer.SourceLocation
}

func DefAssign

func DefAssign(path path.TypePath, variable string, value Expression, location tokenizer.SourceLocation) Definition

func DefDefine

func DefDefine(path path.TypePath, location tokenizer.SourceLocation) Definition

func DefImplement

func DefImplement(path path.TypePath, function string, arguments []ProcArgument, body []Statement, location tokenizer.SourceLocation) Definition

func DefProcDecl

func DefProcDecl(path path.TypePath, variable string, location tokenizer.SourceLocation) Definition

func DefVarDef

func DefVarDef(path path.TypePath, varType path.TypePath, variable string, location tokenizer.SourceLocation) Definition

func DefVerbDecl

func DefVerbDecl(path path.TypePath, variable string, location tokenizer.SourceLocation) Definition

func (Definition) Dump

func (dmd Definition) Dump(output io.Writer) error

type ExprType

type ExprType uint8
const (
	ExprTypeNone ExprType = iota
	ExprTypeResourceLiteral
	ExprTypePathLiteral
	ExprTypeIntegerLiteral
	ExprTypeStringLiteral
	ExprTypeStringMacro
	ExprTypeStringConcat
	ExprTypeGetLocal
	ExprTypeGetNonLocal
	ExprTypeGetField
	ExprTypeBooleanNot
	ExprTypeCall
	ExprTypeNew
)

func (ExprType) String

func (et ExprType) String() string

type Expression

type Expression struct {
	Type      ExprType
	Str       string
	Integer   int64
	Names     []string
	Children  []Expression
	Path      path.TypePath
	SourceLoc tokenizer.SourceLocation
}

func ExprBooleanNot

func ExprBooleanNot(expr Expression, loc tokenizer.SourceLocation) Expression

func ExprCall

func ExprCall(expr Expression, keywords []string, arguments []Expression, loc tokenizer.SourceLocation) Expression

func ExprGetField

func ExprGetField(expr Expression, field string, loc tokenizer.SourceLocation) Expression

func ExprGetLocal

func ExprGetLocal(name string, loc tokenizer.SourceLocation) Expression

func ExprGetNonLocal

func ExprGetNonLocal(name string, loc tokenizer.SourceLocation) Expression

func ExprIntegerLiteral

func ExprIntegerLiteral(literal int64, loc tokenizer.SourceLocation) Expression

func ExprNew

func ExprNew(typepath path.TypePath, keywords []string, arguments []Expression, loc tokenizer.SourceLocation) Expression

func ExprNone

func ExprNone() Expression

func ExprPathLiteral

func ExprPathLiteral(path path.TypePath, loc tokenizer.SourceLocation) Expression

func ExprResourceLiteral

func ExprResourceLiteral(literal string, loc tokenizer.SourceLocation) Expression

func ExprStringConcat

func ExprStringConcat(exprs []Expression, loc tokenizer.SourceLocation) Expression

func ExprStringLiteral

func ExprStringLiteral(literal string, loc tokenizer.SourceLocation) Expression

func ExprStringMacro

func ExprStringMacro(macro string, expr Expression, loc tokenizer.SourceLocation) Expression

func (Expression) IsNone

func (dme Expression) IsNone() bool

func (Expression) String

func (dme Expression) String() string

type File

type File struct {
	Definitions []Definition
	SearchPath  []string
	Maps        []string
}

func (*File) Dump

func (f *File) Dump(output io.Writer) error

func (*File) Extend

func (f *File) Extend(file *File)

type ProcArgument

type ProcArgument struct {
	Type dtype.DType
	Name string
	As   ProcArgumentAs // for verbs
}

type ProcArgumentAs

type ProcArgumentAs int
const (
	ProcArgumentNone ProcArgumentAs = iota
	ProcArgumentText
	ProcArgumentMessage
	ProcArgumentNum
	ProcArgumentIcon
	ProcArgumentSound
	ProcArgumentFile
	ProcArgumentKey
	ProcArgumentNull
	ProcArgumentMob
	ProcArgumentObj
	ProcArgumentTurf
	ProcArgumentArea
	ProcArgumentAnything
)

func ProcArgumentFromString

func ProcArgumentFromString(arg string) ProcArgumentAs

func (ProcArgumentAs) String

func (t ProcArgumentAs) String() string

type Statement

type Statement struct {
	Type      StatementType
	VarType   dtype.DType
	Name      string
	From      Expression
	To        Expression
	Body      []Statement
	SourceLoc tokenizer.SourceLocation
}

func StatementAssign

func StatementAssign(destination Expression, value Expression, loc tokenizer.SourceLocation) Statement

func StatementDel

func StatementDel(expr Expression, loc tokenizer.SourceLocation) Statement

func StatementEvaluate

func StatementEvaluate(expr Expression, loc tokenizer.SourceLocation) Statement

func StatementForList

func StatementForList(vartype dtype.DType, varname string, inExpr Expression, body []Statement, loc tokenizer.SourceLocation) Statement

func StatementIf

func StatementIf(condition Expression, body []Statement, loc tokenizer.SourceLocation) Statement

func StatementNone

func StatementNone() Statement

func StatementReturn

func StatementReturn(loc tokenizer.SourceLocation) Statement

func StatementSetIn

func StatementSetIn(field string, expr Expression, loc tokenizer.SourceLocation) Statement

func StatementSetTo

func StatementSetTo(field string, expr Expression, loc tokenizer.SourceLocation) Statement

func StatementWrite

func StatementWrite(destination Expression, value Expression, loc tokenizer.SourceLocation) Statement

func (Statement) Dump

func (dms Statement) Dump(output io.Writer, indent int) error

func (Statement) IsNone

func (dms Statement) IsNone() bool

func (Statement) String

func (dms Statement) String() string

type StatementType

type StatementType uint8
const (
	StatementTypeNone StatementType = iota
	StatementTypeWrite
	StatementTypeIf
	StatementTypeReturn
	StatementTypeSetIn
	StatementTypeSetTo
	StatementTypeEvaluate
	StatementTypeAssign
	StatementTypeDel
	StatementTypeForList
)

func (StatementType) String

func (et StatementType) String() string

Jump to

Keyboard shortcuts

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