goPigeon

package
v0.0.0-...-f8f9fbc Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2018 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayType

type ArrayType struct {
	Size int
	Type DataType
}

func (ArrayType) DataType

func (t ArrayType) DataType()

type AssignmentStatement

type AssignmentStatement struct {
	LineNumber int
	Column     int
	Targets    []Expression
	Value      Expression
}

func (AssignmentStatement) Line

func (t AssignmentStatement) Line() int

func (AssignmentStatement) Statement

func (t AssignmentStatement) Statement()

type BreakStatement

type BreakStatement struct {
	LineNumber int
	Column     int
}

func (BreakStatement) Line

func (t BreakStatement) Line() int

func (BreakStatement) Statement

func (t BreakStatement) Statement()

type BuiltinType

type BuiltinType struct {
	Name   string
	Params []DataType
}

func (BuiltinType) DataType

func (t BuiltinType) DataType()

type ContinueStatement

type ContinueStatement struct {
	LineNumber int
	Column     int
}

func (ContinueStatement) Line

func (t ContinueStatement) Line() int

func (ContinueStatement) Statement

func (t ContinueStatement) Statement()

type DataType

type DataType interface {
	DataType()
}

type Definition

type Definition interface {
	Definition()
	Line() int
}

type ElseClause

type ElseClause struct {
	LineNumber int
	Column     int
	Body       []Statement
}

type ElseifClause

type ElseifClause struct {
	LineNumber int
	Column     int
	Condition  Expression
	Body       []Statement
}

type Expression

type Expression interface {
	Expression()
	Line() int
}

type ForeachStatement

type ForeachStatement struct {
	LineNumber int
	Column     int
	IndexName  string
	IndexType  ParsedDataType
	ValName    string
	ValType    ParsedDataType
	Collection Expression
	Body       []Statement
}

func (ForeachStatement) Line

func (t ForeachStatement) Line() int

func (ForeachStatement) Statement

func (t ForeachStatement) Statement()

type ForincStatement

type ForincStatement struct {
	LineNumber int
	Column     int
	IndexName  string
	IndexType  ParsedDataType
	StartVal   Expression
	EndVal     Expression
	Body       []Statement
	Dec        bool
}

func (ForincStatement) Line

func (t ForincStatement) Line() int

func (ForincStatement) Statement

func (t ForincStatement) Statement()

type FunctionCall

type FunctionCall struct {
	LineNumber int
	Column     int
	Function   Expression // either an identifier or another function/operator call
	Arguments  []Expression
}

func (FunctionCall) Expression

func (t FunctionCall) Expression()

func (FunctionCall) Line

func (t FunctionCall) Line() int

func (FunctionCall) Statement

func (t FunctionCall) Statement()

type FunctionDefinition

type FunctionDefinition struct {
	LineNumber  int
	Column      int
	Name        string
	Parameters  []Variable
	ReturnTypes []ParsedDataType
	Body        []Statement
	NativeCode  string // a native function has a string of native code and an empty body
	Pkg         *Package
}

func (FunctionDefinition) Definition

func (t FunctionDefinition) Definition()

func (FunctionDefinition) Line

func (t FunctionDefinition) Line() int

type FunctionType

type FunctionType struct {
	Params      []DataType
	ReturnTypes []DataType
}

func (FunctionType) DataType

func (t FunctionType) DataType()

type GlobalDefinition

type GlobalDefinition struct {
	LineNumber int
	Column     int
	Name       string
	Value      Expression
	Type       ParsedDataType
	Pkg        *Package
}

func (GlobalDefinition) Definition

func (t GlobalDefinition) Definition()

func (GlobalDefinition) Line

func (t GlobalDefinition) Line() int

type GoStatement

type GoStatement struct {
	LineNumber int
	Column     int
	Call       Expression // FunctionCall or MethodCall
}

func (GoStatement) Line

func (t GoStatement) Line() int

func (GoStatement) Statement

func (t GoStatement) Statement()

type IfStatement

type IfStatement struct {
	LineNumber int
	Column     int
	Condition  Expression
	Body       []Statement
	Elifs      []ElseifClause
	Else       ElseClause
}

func (IfStatement) Line

func (t IfStatement) Line() int

func (IfStatement) Statement

func (t IfStatement) Statement()

type ImportDefinition

type ImportDefinition struct {
	LineNumber int
	Column     int
	Path       string
	Names      []string
	Aliases    []string
	Pkg        *Package
}

func (ImportDefinition) Definition

func (t ImportDefinition) Definition()

func (ImportDefinition) Line

func (t ImportDefinition) Line() int

type InterfaceDefinition

type InterfaceDefinition struct {
	LineNumber int
	Column     int
	Name       string
	Methods    []Signature
	Pkg        *Package
}

func (InterfaceDefinition) DataType

func (t InterfaceDefinition) DataType()

func (InterfaceDefinition) Definition

func (t InterfaceDefinition) Definition()

func (InterfaceDefinition) Line

func (t InterfaceDefinition) Line() int

type LocalFuncStatement

type LocalFuncStatement struct {
	LineNumber  int
	Column      int
	Name        string
	Parameters  []Variable
	ReturnTypes []ParsedDataType
	Body        []Statement
}

func (LocalFuncStatement) Line

func (t LocalFuncStatement) Line() int

func (LocalFuncStatement) Statement

func (t LocalFuncStatement) Statement()

type LocalsStatement

type LocalsStatement struct {
	LineNumber int
	Column     int
	Vars       []Variable
}

func (LocalsStatement) Line

func (t LocalsStatement) Line() int

func (LocalsStatement) Statement

func (t LocalsStatement) Statement()

type MethodCall

type MethodCall struct {
	LineNumber int
	Column     int
	MethodName string // either an identifier or another function/operator call
	Receiver   Expression
	Arguments  []Expression
}

func (MethodCall) Expression

func (t MethodCall) Expression()

func (MethodCall) Line

func (t MethodCall) Line() int

func (MethodCall) Statement

func (t MethodCall) Statement()

type MethodDefinition

type MethodDefinition struct {
	LineNumber  int
	Column      int
	Name        string
	Receiver    Variable
	Parameters  []Variable
	ReturnTypes []ParsedDataType
	Body        []Statement
	Pkg         *Package
}

func (MethodDefinition) Definition

func (t MethodDefinition) Definition()

func (MethodDefinition) Line

func (t MethodDefinition) Line() int

type NativeImportDefinition

type NativeImportDefinition struct {
	LineNumber int
	Column     int
	Path       string
	Alias      string
	Pkg        *Package
}

func (NativeImportDefinition) Definition

func (t NativeImportDefinition) Definition()

func (NativeImportDefinition) Line

func (t NativeImportDefinition) Line() int

type Operation

type Operation struct {
	LineNumber int
	Column     int
	Operator   string
	MakeType   ParsedDataType // nil for all ops except a 'make' op
	Operands   []Expression
}

func (Operation) Expression

func (t Operation) Expression()

func (Operation) Line

func (t Operation) Line() int

func (Operation) Statement

func (t Operation) Statement()

type Package

type Package struct {
	Globals          map[string]GlobalDefinition
	Types            map[string]DataType // all types of current package and those brought into current namespace
	ImportedTypes    map[DataType]bool   // all types of imported packages (directly and indirectly)
	ValidBreakpoints map[string]bool
	StructDefs       map[string]StructDefinition // parsed form of struct
	Structs          map[string]Struct           // processed form of struct
	Funcs            map[string]FunctionDefinition
	Methods          map[string]map[string]MethodDefinition // method name:, struct name:, def
	Interfaces       map[string]InterfaceDefinition
	FullPath         string
	Prefix           string
	ImportDefs       map[string]ImportDefinition
	ImportedPackages map[string]*Package
	Code             string
	NativeImports    map[string]string
}

func Compile

func Compile(filename string, outputDir string) (*Package, error)

type ParsedDataType

type ParsedDataType struct {
	LineNumber  int
	Column      int
	Type        string
	Params      []ParsedDataType
	ReturnTypes []ParsedDataType // non-nil only for functions with return types
}

func (ParsedDataType) Expression

func (t ParsedDataType) Expression()

func (ParsedDataType) Line

func (t ParsedDataType) Line() int

type ReturnStatement

type ReturnStatement struct {
	LineNumber int
	Column     int
	Values     []Expression
}

func (ReturnStatement) Line

func (t ReturnStatement) Line() int

func (ReturnStatement) Statement

func (t ReturnStatement) Statement()

type SelectClause

type SelectClause interface {
	SelectClause()
}

type SelectDefaultClause

type SelectDefaultClause struct {
	LineNumber int
	Column     int
	Body       []Statement
}

type SelectRcvClause

type SelectRcvClause struct {
	LineNumber int
	Column     int
	Target     Variable
	Channel    Expression
	Body       []Statement
}

func (SelectRcvClause) SelectClause

func (s SelectRcvClause) SelectClause()

type SelectSendClause

type SelectSendClause struct {
	LineNumber int
	Column     int
	Channel    Expression
	Value      Expression
	Body       []Statement
}

func (SelectSendClause) SelectClause

func (s SelectSendClause) SelectClause()

type SelectStatement

type SelectStatement struct {
	LineNumber int
	Column     int
	Clauses    []SelectClause
	Default    SelectDefaultClause
}

func (SelectStatement) Line

func (t SelectStatement) Line() int

func (SelectStatement) Statement

func (t SelectStatement) Statement()

type Signature

type Signature struct {
	LineNumber  int
	Column      int
	Name        string
	ParamTypes  []ParsedDataType
	ReturnTypes []ParsedDataType
}

type Statement

type Statement interface {
	Statement()
	Line() int
}

type Struct

type Struct struct {
	LineNumber  int
	Column      int
	Name        string
	MemberNames []string
	MemberTypes []DataType
	Implements  map[string]bool // names of the interfaces this struct implements
	Methods     map[string]FunctionType
	NativeCode  string
	Pkg         *Package
}

func (Struct) DataType

func (t Struct) DataType()

type StructDefinition

type StructDefinition struct {
	LineNumber int
	Column     int
	Name       string
	Members    []Variable
	NativeCode string
	Pkg        *Package
}

func (StructDefinition) DataType

func (t StructDefinition) DataType()

func (StructDefinition) Definition

func (t StructDefinition) Definition()

func (StructDefinition) Line

func (t StructDefinition) Line() int

type Token

type Token struct {
	Type       TokenType
	Content    string // the token itself, e.g. a number 3.7 is stored here as "3.7"
	LineNumber int    // first line is line 1
	Column     int    // first character of a line is in column 1
}

func (Token) Expression

func (t Token) Expression()

func (Token) Line

func (t Token) Line() int

type TokenType

type TokenType int

we use arbitrary number values to designate each type of token. Rather than using straight ints, we create a distinct type to help avoid mistreating these values like ints.

const (
	ReservedWord TokenType = iota
	OperatorWord
	IdentifierWord
	Newline
	Indentation
	OpenParen
	CloseParen
	NumberLiteral
	StringLiteral
	MultilineStringLiteral
	BooleanLiteral
	NilLiteral
	OpenSquare
	CloseSquare
	Dot
	Space
	TypeName
	OpenAngle
	CloseAngle
	Colon
	Comma
)

type TypeExpression

type TypeExpression struct {
	LineNumber int
	Column     int
	Type       ParsedDataType
	Operands   []Expression
}

func (TypeExpression) Expression

func (t TypeExpression) Expression()

func (TypeExpression) Line

func (t TypeExpression) Line() int

type TypeswitchCase

type TypeswitchCase struct {
	LineNumber int
	Column     int
	Variable   Variable
	Body       []Statement
}

type TypeswitchStatement

type TypeswitchStatement struct {
	LineNumber      int
	Column          int
	Value           Expression
	Cases           []TypeswitchCase
	Default         []Statement
	DefaultVariable string
}

func (TypeswitchStatement) Line

func (t TypeswitchStatement) Line() int

func (TypeswitchStatement) Statement

func (t TypeswitchStatement) Statement()

type Variable

type Variable struct {
	LineNumber int
	Column     int
	Name       string
	Type       ParsedDataType
}

func (Variable) Line

func (t Variable) Line() int

type WhileStatement

type WhileStatement struct {
	LineNumber int
	Column     int
	Condition  Expression
	Body       []Statement
}

func (WhileStatement) Line

func (t WhileStatement) Line() int

func (WhileStatement) Statement

func (t WhileStatement) Statement()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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