ast

package
v0.0.0-...-50a66e4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

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
}

Array literal.

func (*Array) Inspect

func (e *Array) Inspect() string

func (*Array) TokenLexeme

func (e *Array) TokenLexeme() string

func (*Array) TokenLocation

func (e *Array) TokenLocation() token.Location

type As

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

As infix expression.

func (*As) Inspect

func (e *As) Inspect() string

func (*As) TokenLexeme

func (e *As) TokenLexeme() string

func (*As) TokenLocation

func (e *As) TokenLocation() token.Location

type Assign

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

Subscript for arrays and dictionaries.

func (*Assign) Inspect

func (e *Assign) Inspect() string

func (*Assign) TokenLexeme

func (e *Assign) TokenLexeme() string

func (*Assign) TokenLocation

func (e *Assign) TokenLocation() token.Location

type Atom

type Atom struct {
	Token token.Token
	Value string
}

Atom literal.

func (*Atom) Inspect

func (e *Atom) Inspect() string

func (*Atom) TokenLexeme

func (e *Atom) TokenLexeme() string

func (*Atom) TokenLocation

func (e *Atom) TokenLocation() token.Location

type BlockStatement

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

BlockStatement that holds several statements.

func (*BlockStatement) Inspect

func (e *BlockStatement) Inspect() string

func (*BlockStatement) TokenLexeme

func (e *BlockStatement) TokenLexeme() string

func (*BlockStatement) TokenLocation

func (e *BlockStatement) TokenLocation() token.Location

type Boolean

type Boolean struct {
	Token token.Token
	Value bool
}

Boolean literal.

func (*Boolean) Inspect

func (e *Boolean) Inspect() string

func (*Boolean) TokenLexeme

func (e *Boolean) TokenLexeme() string

func (*Boolean) TokenLocation

func (e *Boolean) TokenLocation() token.Location

type Break

type Break struct {
	Token token.Token
}

Break statement.

func (*Break) Inspect

func (e *Break) Inspect() string

func (*Break) TokenLexeme

func (e *Break) TokenLexeme() string

func (*Break) TokenLocation

func (e *Break) TokenLocation() token.Location

type Continue

type Continue struct {
	Token token.Token
}

Continue statement.

func (*Continue) Inspect

func (e *Continue) Inspect() string

func (*Continue) TokenLexeme

func (e *Continue) TokenLexeme() string

func (*Continue) TokenLocation

func (e *Continue) TokenLocation() token.Location

type Dictionary

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

Dictionary literal.

func (*Dictionary) Inspect

func (e *Dictionary) Inspect() string

func (*Dictionary) TokenLexeme

func (e *Dictionary) TokenLexeme() string

func (*Dictionary) TokenLocation

func (e *Dictionary) TokenLocation() token.Location

type Expression

type Expression interface {
	Node
	// contains filtered or unexported methods
}

An Expression of code.

type ExpressionList

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

ExpressionList holds a list of expressions.

func (*ExpressionList) Inspect

func (e *ExpressionList) Inspect() string

func (*ExpressionList) TokenLexeme

func (e *ExpressionList) TokenLexeme() string

func (*ExpressionList) TokenLocation

func (e *ExpressionList) TokenLocation() token.Location

type ExpressionStatement

type ExpressionStatement struct {
	Token      token.Token
	Expression Expression
}

ExpressionStatement as a statement that holds expressions.

func (*ExpressionStatement) Inspect

func (e *ExpressionStatement) Inspect() string

func (*ExpressionStatement) TokenLexeme

func (e *ExpressionStatement) TokenLexeme() string

func (*ExpressionStatement) TokenLocation

func (e *ExpressionStatement) TokenLocation() token.Location

type Float

type Float struct {
	Token token.Token
	Value float64
}

Float as a floating point literal.

func (*Float) Inspect

func (e *Float) Inspect() string

func (*Float) TokenLexeme

func (e *Float) TokenLexeme() string

func (*Float) TokenLocation

func (e *Float) TokenLocation() token.Location

type For

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

For iterator.

func (*For) Inspect

func (e *For) Inspect() string

func (*For) TokenLexeme

func (e *For) TokenLexeme() string

func (*For) TokenLocation

func (e *For) TokenLocation() token.Location

type Function

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

Function expression.

func (*Function) Inspect

func (e *Function) Inspect() string

func (*Function) TokenLexeme

func (e *Function) TokenLexeme() string

func (*Function) TokenLocation

func (e *Function) TokenLocation() token.Location

type FunctionCall

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

FunctionCall calls a function.

func (*FunctionCall) Inspect

func (e *FunctionCall) Inspect() string

func (*FunctionCall) TokenLexeme

func (e *FunctionCall) TokenLexeme() string

func (*FunctionCall) TokenLocation

func (e *FunctionCall) TokenLocation() token.Location

type FunctionParameter

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

Function parameters.

func (*FunctionParameter) Inspect

func (e *FunctionParameter) Inspect() string

func (*FunctionParameter) TokenLexeme

func (e *FunctionParameter) TokenLexeme() string

func (*FunctionParameter) TokenLocation

func (e *FunctionParameter) TokenLocation() token.Location

type Identifier

type Identifier struct {
	Token token.Token
	Value string
}

Identifier (variable).

func (*Identifier) Inspect

func (e *Identifier) Inspect() string

func (*Identifier) TokenLexeme

func (e *Identifier) TokenLexeme() string

func (*Identifier) TokenLocation

func (e *Identifier) TokenLocation() token.Location

type IdentifierList

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

IdentifierList holds a list of identifiers.

func (*IdentifierList) Inspect

func (e *IdentifierList) Inspect() string

func (*IdentifierList) TokenLexeme

func (e *IdentifierList) TokenLexeme() string

func (*IdentifierList) TokenLocation

func (e *IdentifierList) TokenLocation() token.Location

type If

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

If conditional.

func (*If) Inspect

func (e *If) Inspect() string

func (*If) TokenLexeme

func (e *If) TokenLexeme() string

func (*If) TokenLocation

func (e *If) TokenLocation() token.Location

type Import

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

Import a file.

func (*Import) Inspect

func (e *Import) Inspect() string

func (*Import) TokenLexeme

func (e *Import) TokenLexeme() string

func (*Import) TokenLocation

func (e *Import) TokenLocation() token.Location

type InfixExpression

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

InfixExpression with two expressions on the left and right, combined by an operator.

func (*InfixExpression) Inspect

func (e *InfixExpression) Inspect() string

func (*InfixExpression) TokenLexeme

func (e *InfixExpression) TokenLexeme() string

func (*InfixExpression) TokenLocation

func (e *InfixExpression) TokenLocation() token.Location

type Integer

type Integer struct {
	Token token.Token
	Value int64
}

Integer numeric literal.

func (*Integer) Inspect

func (e *Integer) Inspect() string

func (*Integer) TokenLexeme

func (e *Integer) TokenLexeme() string

func (*Integer) TokenLocation

func (e *Integer) TokenLocation() token.Location

type Is

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

Is infix expression.

func (*Is) Inspect

func (e *Is) Inspect() string

func (*Is) TokenLexeme

func (e *Is) TokenLexeme() string

func (*Is) TokenLocation

func (e *Is) TokenLocation() token.Location

type Let

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

Let statement.

func (*Let) Inspect

func (e *Let) Inspect() string

func (*Let) TokenLexeme

func (e *Let) TokenLexeme() string

func (*Let) TokenLocation

func (e *Let) TokenLocation() token.Location

type Module

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

Module block.

func (*Module) Inspect

func (e *Module) Inspect() string

func (*Module) TokenLexeme

func (e *Module) TokenLexeme() string

func (*Module) TokenLocation

func (e *Module) TokenLocation() token.Location

type ModuleAccess

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

ModuleAccess to access module properties and methods.

func (*ModuleAccess) Inspect

func (e *ModuleAccess) Inspect() string

func (*ModuleAccess) TokenLexeme

func (e *ModuleAccess) TokenLexeme() string

func (*ModuleAccess) TokenLocation

func (e *ModuleAccess) TokenLocation() token.Location

type Nil

type Nil struct {
	Token token.Token
}

Nil type.

func (*Nil) Inspect

func (e *Nil) Inspect() string

func (*Nil) TokenLexeme

func (e *Nil) TokenLexeme() string

func (*Nil) TokenLocation

func (e *Nil) TokenLocation() token.Location

type Node

type Node interface {
	TokenLexeme() string
	TokenLocation() token.Location
	Inspect() string
}

A Node on the AST.

type Pipe

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

Pipe operator.

func (*Pipe) Inspect

func (e *Pipe) Inspect() string

func (*Pipe) TokenLexeme

func (e *Pipe) TokenLexeme() string

func (*Pipe) TokenLocation

func (e *Pipe) TokenLocation() token.Location

type Placeholder

type Placeholder struct {
	Token token.Token
}

Placeholder.

func (*Placeholder) Inspect

func (e *Placeholder) Inspect() string

func (*Placeholder) TokenLexeme

func (e *Placeholder) TokenLexeme() string

func (*Placeholder) TokenLocation

func (e *Placeholder) TokenLocation() token.Location

type PrefixExpression

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

PrefixExpression as an expression with a prefix operator.

func (*PrefixExpression) Inspect

func (e *PrefixExpression) Inspect() string

func (*PrefixExpression) TokenLexeme

func (e *PrefixExpression) TokenLexeme() string

func (*PrefixExpression) TokenLocation

func (e *PrefixExpression) TokenLocation() token.Location

type Program

type Program struct {
	Statements []Statement
}

Program as the root node.

func (*Program) Inspect

func (e *Program) Inspect() string

func (*Program) TokenLexeme

func (e *Program) TokenLexeme() string

func (*Program) TokenLocation

func (e *Program) TokenLocation() token.Location

type Return

type Return struct {
	Token token.Token
	Value Expression
}

Return statement.

func (*Return) Inspect

func (e *Return) Inspect() string

func (*Return) TokenLexeme

func (e *Return) TokenLexeme() string

func (*Return) TokenLocation

func (e *Return) TokenLocation() token.Location

type Statement

type Statement interface {
	Node
	// contains filtered or unexported methods
}

A Statement of code.

type String

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

String literal.

func (*String) Inspect

func (e *String) Inspect() string

func (*String) TokenLexeme

func (e *String) TokenLexeme() string

func (*String) TokenLocation

func (e *String) TokenLocation() token.Location

type Subscript

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

Subscript for arrays and dictionaries.

func (*Subscript) Inspect

func (e *Subscript) Inspect() string

func (*Subscript) TokenLexeme

func (e *Subscript) TokenLexeme() string

func (*Subscript) TokenLocation

func (e *Subscript) TokenLocation() token.Location

type Switch

type Switch struct {
	Token   token.Token
	Control Expression
	Cases   []*SwitchCase
	Default *BlockStatement
}

Switch conditional.

func (*Switch) Inspect

func (e *Switch) Inspect() string

func (*Switch) TokenLexeme

func (e *Switch) TokenLexeme() string

func (*Switch) TokenLocation

func (e *Switch) TokenLocation() token.Location

type SwitchCase

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

A SwitchCase on a switch.

func (*SwitchCase) Inspect

func (e *SwitchCase) Inspect() string

func (*SwitchCase) TokenLexeme

func (e *SwitchCase) TokenLexeme() string

func (*SwitchCase) TokenLocation

func (e *SwitchCase) TokenLocation() token.Location

type Var

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

Var statement.

func (*Var) Inspect

func (e *Var) Inspect() string

func (*Var) TokenLexeme

func (e *Var) TokenLexeme() string

func (*Var) TokenLocation

func (e *Var) TokenLocation() token.Location

Jump to

Keyboard shortcuts

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