ast

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LocalDeclarationError = errors.New("local declaration error")

Functions

func ParseInt

func ParseInt(b []byte) (int64, error)

Types

type AssignmentStatement

type AssignmentStatement struct {
	Identifier Attribute `json:"identifier"`
	Expression Attribute `json:"expression"`
}

func NewAssignmentStatement

func NewAssignmentStatement(identifier, expression Attribute) (AssignmentStatement, error)

type Attribute

type Attribute interface{}

func Add

func Add(val1, val2 Attribute) (Attribute, error)

func Div

func Div(val1, val2 Attribute) (Attribute, error)

func Mul

func Mul(val1, val2 Attribute) (Attribute, error)

func NewScopeIn

func NewScopeIn(context, declarationList Attribute) (Attribute, error)

func NewScopeOut

func NewScopeOut(context, declarationList Attribute) (Attribute, error)

func Sub

func Sub(val1, val2 Attribute) (Attribute, error)

type Connection

type Connection struct {
	OutJunction Junction `json:"outId"`
	InJunction  Junction `json:"inId"`
}

func NewConnection

func NewConnection(out, in Attribute) (Connection, error)

type ConnectionList

type ConnectionList []Connection

func AppendConnection

func AppendConnection(connectionList, connection Attribute) (ConnectionList, error)

func NewConnectionList

func NewConnectionList() (ConnectionList, error)

type Declaration

type Declaration struct {
	Type       string    `json:"type"`
	AssigneeId Attribute `json:"assigneeId"`
	Expression Attribute `json:"expression"`
}

func NewDeclaration

func NewDeclaration(context, varType, varId, expression Attribute) (Declaration, error)

type DeclarationList

type DeclarationList []Declaration

func AppendDeclaration

func AppendDeclaration(declarationList, declaration Attribute) (DeclarationList, error)

func NewDeclarationList

func NewDeclarationList() (DeclarationList, error)

type Expression

type Expression struct {
	FirstOperand  Attribute `json:"firstOperand"`
	SecondOperand Attribute `json:"secondOperand"`
	Operator      Attribute `json:"operator"`
}

func NewExpression

func NewExpression(firstOperand, operator, secondOperand Attribute) (Expression, error)

type IfStatement

type IfStatement struct {
	Expression     Expression    `json:"expression"`
	BodyStatements StatementList `json:"bodyStatements"`
	ElseStatements StatementList `json:"elseStatements"`
}

func NewIfStatement

func NewIfStatement(condition, bodyBlock, elseBlock Attribute) (*IfStatement, error)

type Junction

type Junction struct {
	NodeId string `json:"nodeId"`
	VarId  string `json:"varId"`
}

func NewJunction

func NewJunction(nodeId, varId Attribute) (Junction, error)

type LocalVar

type LocalVar struct {
	Id string `json:"id"`
}

func NewLocalVar

func NewLocalVar(id Attribute) (*LocalVar, error)

type Node

type Node struct {
	Id              string          `json:"id"`
	TemplateId      string          `json:"templateId"`
	InDeclarations  DeclarationList `json:"inDeclarations"`
	OutDeclarations DeclarationList `json:"outDeclarations"`
	ProcStatements  StatementList   `json:"procStatements"`
}

func NewNode

func NewNode(context, node, in, out, process Attribute, isTemplate bool) (Node, error)

func UseTemplate

func UseTemplate(nodeId, templateId Attribute) (Node, error)

type NodeContext

type NodeContext struct {
	InVariables   symbolTable
	OutVariables  symbolTable
	ProcVariables symbolTable
}

type NodeList

type NodeList []Node

func AppendNode

func AppendNode(nodeList, node Attribute) (NodeList, error)

func NewNodeList

func NewNodeList(node Attribute) (NodeList, error)

type NodeVar

type NodeVar struct {
	Id           string `json:"id"`
	JunctionType string `json:"junctionType'"`
}

func NewNodeVar

func NewNodeVar(ioType, varId Attribute) (NodeVar, error)

type ParseContext

type ParseContext struct {
	Templates    map[string]*Node
	Nodes        map[nodeKey]*NodeContext
	CurrentNode  *NodeContext
	CurrentScope symbolTable
}

func NewParseContext

func NewParseContext() ParseContext

func (*ParseContext) AddNodeContext

func (ctx *ParseContext) AddNodeContext(nodeName nodeKey, nodeContext *NodeContext)

func (*ParseContext) BabushkaPopScopeIn

func (ctx *ParseContext) BabushkaPopScopeIn()

func (*ParseContext) BabushkaPopScopeNode

func (ctx *ParseContext) BabushkaPopScopeNode(nodeId string)

func (*ParseContext) BabushkaPopScopeOut

func (ctx *ParseContext) BabushkaPopScopeOut()

func (*ParseContext) BabushkaPopScopeProc

func (ctx *ParseContext) BabushkaPopScopeProc()

func (*ParseContext) GetNodeContext added in v1.2.0

func (ctx *ParseContext) GetNodeContext(id string) *NodeContext

func (*ParseContext) NewNodeScope

func (ctx *ParseContext) NewNodeScope()

func (*ParseContext) NewScope

func (ctx *ParseContext) NewScope()

type Program

type Program struct {
	Nodes       NodeList       `json:"nodes"`
	Connections ConnectionList `json:"connections"`
}

func NewProgram

func NewProgram(nodes, connections Attribute) (Program, error)

type Statement

type Statement Attribute

type StatementList

type StatementList []Statement

func AppendStatement

func AppendStatement(statementList, statement Attribute) (StatementList, error)

func NewScopeProc

func NewScopeProc(context, statementList Attribute) (StatementList, error)

func NewStatementList

func NewStatementList(statement Attribute) (StatementList, error)

type Template

type Template struct {
	Node
}

type TemplateUse

type TemplateUse struct {
	TemplateId string `json:"templateId"`
	NodeId     string `json:"nodeId"`
}

type Variable

type Variable struct {
	Type string
}

type WhileStatement

type WhileStatement struct {
	Condition      Expression    `json:"condition"`
	BodyStatements StatementList `json:"bodyStatements"`
}

Jump to

Keyboard shortcuts

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