ast

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ast implements functions to abstract syntax tree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array struct {
	Token token.Token
	List  *ExpressionList
}

func (*Array) Check

func (a *Array) Check() string

func (*Array) Expression

func (a *Array) Expression()

func (*Array) TokenLiteral

func (a *Array) TokenLiteral() string

func (*Array) TokenPosition

func (a *Array) TokenPosition() token.Position

type As

type As struct {
	Token token.Token
	Left  Expression
	Right *Identifier
}

func (*As) Check

func (a *As) Check() string

func (*As) Expression

func (a *As) Expression()

func (*As) TokenLiteral

func (a *As) TokenLiteral() string

func (*As) TokenPosition

func (a *As) TokenPosition() token.Position

type Assign

type Assign struct {
	Token    token.Token
	Operator string
	Name     Expression
	Right    Expression
}

func (*Assign) Check

func (a *Assign) Check() string

func (*Assign) Expression

func (a *Assign) Expression()

func (*Assign) TokenLiteral

func (a *Assign) TokenLiteral() string

func (*Assign) TokenPosition

func (a *Assign) TokenPosition() token.Position

type BlockStatement

type BlockStatement struct {
	Token      token.Token
	Statements []Statement
}

func (*BlockStatement) Check

func (a *BlockStatement) Check() string

func (*BlockStatement) Statement

func (a *BlockStatement) Statement()

func (*BlockStatement) TokenLiteral

func (a *BlockStatement) TokenLiteral() string

func (*BlockStatement) TokenPosition

func (a *BlockStatement) TokenPosition() token.Position

type Boolean

type Boolean struct {
	Token token.Token
	Value bool
}

func (*Boolean) Check

func (a *Boolean) Check() string

func (*Boolean) Expression

func (a *Boolean) Expression()

func (*Boolean) TokenLiteral

func (a *Boolean) TokenLiteral() string

func (*Boolean) TokenPosition

func (a *Boolean) TokenPosition() token.Position

type Break

type Break struct {
	Token token.Token
}

func (*Break) Check

func (a *Break) Check() string

func (*Break) Statement

func (a *Break) Statement()

func (*Break) TokenLiteral

func (a *Break) TokenLiteral() string

func (*Break) TokenPosition

func (a *Break) TokenPosition() token.Position

type Continue

type Continue struct {
	Token token.Token
}

func (*Continue) Check

func (a *Continue) Check() string

func (*Continue) Statement

func (a *Continue) Statement()

func (*Continue) TokenLiteral

func (a *Continue) TokenLiteral() string

func (*Continue) TokenPosition

func (a *Continue) TokenPosition() token.Position

type Dictionary

type Dictionary struct {
	Token token.Token
	Pairs map[Expression]Expression
}

func (*Dictionary) Check

func (a *Dictionary) Check() string

func (*Dictionary) Expression

func (a *Dictionary) Expression()

func (*Dictionary) TokenLiteral

func (a *Dictionary) TokenLiteral() string

func (*Dictionary) TokenPosition

func (a *Dictionary) TokenPosition() token.Position

type Expression

type Expression interface {
	Node
	Expression()
}

type ExpressionList

type ExpressionList struct {
	Token    token.Token
	Elements []Expression
}

func (*ExpressionList) Check

func (a *ExpressionList) Check() string

func (*ExpressionList) Expression

func (a *ExpressionList) Expression()

func (*ExpressionList) TokenLiteral

func (a *ExpressionList) TokenLiteral() string

func (*ExpressionList) TokenPosition

func (a *ExpressionList) TokenPosition() token.Position

type ExpressionStatement

type ExpressionStatement struct {
	Token      token.Token
	Expression Expression
}

func (*ExpressionStatement) Check

func (a *ExpressionStatement) Check() string

func (*ExpressionStatement) Statement

func (a *ExpressionStatement) Statement()

func (*ExpressionStatement) TokenLiteral

func (a *ExpressionStatement) TokenLiteral() string

func (*ExpressionStatement) TokenPosition

func (a *ExpressionStatement) TokenPosition() token.Position

type Float

type Float struct {
	Token token.Token
	Value float64
}

func (*Float) Check

func (a *Float) Check() string

func (*Float) Expression

func (a *Float) Expression()

func (*Float) TokenLiteral

func (a *Float) TokenLiteral() string

func (*Float) TokenPosition

func (a *Float) TokenPosition() token.Position

type Function

type Function struct {
	Token      token.Token
	Parameters []*FunctionParameter
	Body       *BlockStatement
	ReturnType *Identifier
	Variadic   bool
}

func (*Function) Check

func (a *Function) Check() string

func (*Function) Expression

func (a *Function) Expression()

func (*Function) TokenLiteral

func (a *Function) TokenLiteral() string

func (*Function) TokenPosition

func (a *Function) TokenPosition() token.Position

type FunctionCall

type FunctionCall struct {
	Token     token.Token
	Function  Expression
	Arguments *ExpressionList
}

func (*FunctionCall) Check

func (a *FunctionCall) Check() string

func (*FunctionCall) Expression

func (a *FunctionCall) Expression()

func (*FunctionCall) TokenLiteral

func (a *FunctionCall) TokenLiteral() string

func (*FunctionCall) TokenPosition

func (a *FunctionCall) TokenPosition() token.Position

type FunctionParameter

type FunctionParameter struct {
	Token   token.Token
	Name    *Identifier
	Type    *Identifier
	Default Expression
}

func (*FunctionParameter) Check

func (a *FunctionParameter) Check() string

func (*FunctionParameter) Expression

func (a *FunctionParameter) Expression()

func (*FunctionParameter) TokenLiteral

func (a *FunctionParameter) TokenLiteral() string

func (*FunctionParameter) TokenPosition

func (a *FunctionParameter) TokenPosition() token.Position

type Identifier

type Identifier struct {
	Token token.Token
	Value string
}

func (*Identifier) Check

func (a *Identifier) Check() string

func (*Identifier) Expression

func (a *Identifier) Expression()

func (*Identifier) TokenLiteral

func (a *Identifier) TokenLiteral() string

func (*Identifier) TokenPosition

func (a *Identifier) TokenPosition() token.Position

type IdentifierList

type IdentifierList struct {
	Token    token.Token
	Elements []*Identifier
}

func (*IdentifierList) Check

func (a *IdentifierList) Check() string

func (*IdentifierList) Statement

func (a *IdentifierList) Statement()

func (*IdentifierList) TokenLiteral

func (a *IdentifierList) TokenLiteral() string

func (*IdentifierList) TokenPosition

func (a *IdentifierList) TokenPosition() token.Position

type If

type If struct {
	Token     token.Token
	Condition Expression
	Then      *BlockStatement
	Else      *BlockStatement
}

func (*If) Check

func (a *If) Check() string

func (*If) Expression

func (a *If) Expression()

func (*If) TokenLiteral

func (a *If) TokenLiteral() string

func (*If) TokenPosition

func (a *If) TokenPosition() token.Position

type InfixExpression

type InfixExpression struct {
	Token    token.Token
	Left     Expression
	Operator string
	Right    Expression
}

func (*InfixExpression) Check

func (a *InfixExpression) Check() string

func (*InfixExpression) Expression

func (a *InfixExpression) Expression()

func (*InfixExpression) TokenLiteral

func (a *InfixExpression) TokenLiteral() string

func (*InfixExpression) TokenPosition

func (a *InfixExpression) TokenPosition() token.Position

type Integer

type Integer struct {
	Token token.Token
	Value int64
}

func (*Integer) Check

func (a *Integer) Check() string

func (*Integer) Expression

func (a *Integer) Expression()

func (*Integer) TokenLiteral

func (a *Integer) TokenLiteral() string

func (*Integer) TokenPosition

func (a *Integer) TokenPosition() token.Position

type Is

type Is struct {
	Token token.Token
	Left  Expression
	Right *Identifier
}

func (*Is) Check

func (a *Is) Check() string

func (*Is) Expression

func (a *Is) Expression()

func (*Is) TokenLiteral

func (a *Is) TokenLiteral() string

func (*Is) TokenPosition

func (a *Is) TokenPosition() token.Position

type Match

type Match struct {
	Token   token.Token
	Control Expression
	Whens   []*MatchWhen
	Else    *BlockStatement
}

func (*Match) Check

func (a *Match) Check() string

func (*Match) Expression

func (a *Match) Expression()

func (*Match) TokenLiteral

func (a *Match) TokenLiteral() string

func (*Match) TokenPosition

func (a *Match) TokenPosition() token.Position

type MatchWhen

type MatchWhen struct {
	Token  token.Token
	Values *ExpressionList
	Body   *BlockStatement
}

func (*MatchWhen) Check

func (a *MatchWhen) Check() string

func (*MatchWhen) Expression

func (a *MatchWhen) Expression()

func (*MatchWhen) TokenLiteral

func (a *MatchWhen) TokenLiteral() string

func (*MatchWhen) TokenPosition

func (a *MatchWhen) TokenPosition() token.Position

type Module

type Module struct {
	Token token.Token
	Name  *Identifier
	Body  *BlockStatement
}

func (*Module) Check

func (a *Module) Check() string

func (*Module) Expression

func (a *Module) Expression()

func (*Module) TokenLiteral

func (a *Module) TokenLiteral() string

func (*Module) TokenPosition

func (a *Module) TokenPosition() token.Position

type ModuleAccess

type ModuleAccess struct {
	Token     token.Token
	Object    *Identifier
	Parameter *Identifier
}

func (*ModuleAccess) Check

func (a *ModuleAccess) Check() string

func (*ModuleAccess) Expression

func (a *ModuleAccess) Expression()

func (*ModuleAccess) TokenLiteral

func (a *ModuleAccess) TokenLiteral() string

func (*ModuleAccess) TokenPosition

func (a *ModuleAccess) TokenPosition() token.Position

type Nil

type Nil struct {
	Token token.Token
}

func (*Nil) Check

func (a *Nil) Check() string

func (*Nil) Expression

func (a *Nil) Expression()

func (*Nil) TokenLiteral

func (a *Nil) TokenLiteral() string

func (*Nil) TokenPosition

func (a *Nil) TokenPosition() token.Position

type Node

type Node interface {
	TokenLiteral() string
	TokenPosition() token.Position
	Check() string
}

type Pipe

type Pipe struct {
	Token token.Token
	Left  Expression
	Right Expression
}

func (*Pipe) Check

func (a *Pipe) Check() string

func (*Pipe) Expression

func (a *Pipe) Expression()

func (*Pipe) TokenLiteral

func (a *Pipe) TokenLiteral() string

func (*Pipe) TokenPosition

func (a *Pipe) TokenPosition() token.Position

type PlaceHolder

type PlaceHolder struct {
	Token token.Token
}

func (*PlaceHolder) Check

func (a *PlaceHolder) Check() string

func (*PlaceHolder) Expression

func (a *PlaceHolder) Expression()

func (*PlaceHolder) TokenLiteral

func (a *PlaceHolder) TokenLiteral() string

func (*PlaceHolder) TokenPosition

func (a *PlaceHolder) TokenPosition() token.Position

type PrefixExpression

type PrefixExpression struct {
	Token    token.Token
	Operator string
	Right    Expression
}

func (*PrefixExpression) Check

func (a *PrefixExpression) Check() string

func (*PrefixExpression) Expression

func (a *PrefixExpression) Expression()

func (*PrefixExpression) TokenLiteral

func (a *PrefixExpression) TokenLiteral() string

func (*PrefixExpression) TokenPosition

func (a *PrefixExpression) TokenPosition() token.Position

type Program

type Program struct {
	Statements []Statement
}

func (*Program) Check

func (a *Program) Check() string

func (*Program) TokenLiteral

func (a *Program) TokenLiteral() string

func (*Program) TokenPosition

func (a *Program) TokenPosition() token.Position

type Repeat

type Repeat struct {
	Token      token.Token
	Arguments  *IdentifierList
	Enumerable Expression
	Body       *BlockStatement
}

func (*Repeat) Check

func (a *Repeat) Check() string

func (*Repeat) Expression

func (a *Repeat) Expression()

func (*Repeat) TokenLiteral

func (a *Repeat) TokenLiteral() string

func (*Repeat) TokenPosition

func (a *Repeat) TokenPosition() token.Position

type Return

type Return struct {
	Token token.Token
	Value Expression
}

func (*Return) Check

func (a *Return) Check() string

func (*Return) Statement

func (a *Return) Statement()

func (*Return) TokenLiteral

func (a *Return) TokenLiteral() string

func (*Return) TokenPosition

func (a *Return) TokenPosition() token.Position

type Statement

type Statement interface {
	Node
	Statement()
}

type String

type String struct {
	Token        token.Token
	Value        string
	Interpolated map[string]Expression
}

func (*String) Check

func (a *String) Check() string

func (*String) Expression

func (a *String) Expression()

func (*String) TokenLiteral

func (a *String) TokenLiteral() string

func (*String) TokenPosition

func (a *String) TokenPosition() token.Position

type Subscript

type Subscript struct {
	Token token.Token
	Left  Expression
	Index Expression
}

func (*Subscript) Check

func (a *Subscript) Check() string

func (*Subscript) Expression

func (a *Subscript) Expression()

func (*Subscript) TokenLiteral

func (a *Subscript) TokenLiteral() string

func (*Subscript) TokenPosition

func (a *Subscript) TokenPosition() token.Position

type Symbol

type Symbol struct {
	Token token.Token
	Value string
}

func (*Symbol) Check

func (a *Symbol) Check() string

func (*Symbol) Expression

func (a *Symbol) Expression()

func (*Symbol) TokenLiteral

func (a *Symbol) TokenLiteral() string

func (*Symbol) TokenPosition

func (a *Symbol) TokenPosition() token.Position

type Use

type Use struct {
	Token token.Token
	File  *String
}

func (*Use) Check

func (a *Use) Check() string

func (*Use) Expression

func (a *Use) Expression()

func (*Use) TokenLiteral

func (a *Use) TokenLiteral() string

func (*Use) TokenPosition

func (a *Use) TokenPosition() token.Position

type Val

type Val struct {
	Token token.Token
	Name  *Identifier
	Value Expression
}

func (*Val) Check

func (a *Val) Check() string

func (*Val) Expression

func (a *Val) Expression()

func (*Val) TokenLiteral

func (a *Val) TokenLiteral() string

func (*Val) TokenPosition

func (a *Val) TokenPosition() token.Position

type Var

type Var struct {
	Token token.Token
	Name  *Identifier
	Value Expression
}

func (*Var) Check

func (a *Var) Check() string

func (*Var) Expression

func (a *Var) Expression()

func (*Var) TokenLiteral

func (a *Var) TokenLiteral() string

func (*Var) TokenPosition

func (a *Var) TokenPosition() token.Position

Jump to

Keyboard shortcuts

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