ast

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ast implements abstruct-syntax-tree for anko.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrExpr

type AddrExpr struct {
	ExprImpl
	Expr Expr
}

AddrExpr provide referencing address expression.

type AnonCallExpr

type AnonCallExpr struct {
	ExprImpl
	Expr     Expr
	SubExprs []Expr
	VarArg   bool
	Go       bool
}

AnonCallExpr provide anonymous calling expression. ex: func(){}().

type ArrayCount

type ArrayCount struct {
	Count int
}

ArrayCount is used in MakeExpr to provide Dimensions

type ArrayExpr

type ArrayExpr struct {
	ExprImpl
	Exprs []Expr
}

ArrayExpr provide Array expression.

type AssocExpr

type AssocExpr struct {
	ExprImpl
	Lhs      Expr
	Operator string
	Rhs      Expr
}

AssocExpr provide expression to assoc operation.

type BinOpExpr

type BinOpExpr struct {
	ExprImpl
	Lhs      Expr
	Operator string
	Rhs      Expr
}

BinOpExpr provide binary operator expression.

type BreakStmt

type BreakStmt struct {
	StmtImpl
}

BreakStmt provide "break" expression statement.

type CForStmt

type CForStmt struct {
	StmtImpl
	Stmt1 Stmt
	Expr2 Expr
	Expr3 Expr
	Stmts []Stmt
}

CForStmt provide C-style "for (;;)" expression statement.

type CallExpr

type CallExpr struct {
	ExprImpl
	Func     reflect.Value
	Name     string
	SubExprs []Expr
	VarArg   bool
	Go       bool
}

CallExpr provide calling expression.

type ChanExpr

type ChanExpr struct {
	ExprImpl
	Lhs Expr
	Rhs Expr
}

ChanExpr provide chan expression.

type ConstExpr

type ConstExpr struct {
	ExprImpl
	Value string
}

ConstExpr provide expression for constant variable.

type ContinueStmt

type ContinueStmt struct {
	StmtImpl
}

ContinueStmt provide "continue" expression statement.

type DeleteExpr added in v0.0.2

type DeleteExpr struct {
	ExprImpl
	WhatExpr Expr
	KeyExpr  Expr
}

DeleteExpr provide delete expression

type DerefExpr

type DerefExpr struct {
	ExprImpl
	Expr Expr
}

DerefExpr provide dereferencing address expression.

type Expr

type Expr interface {
	Pos
	// contains filtered or unexported methods
}

Expr provides all of interfaces for expression.

type ExprImpl

type ExprImpl struct {
	PosImpl // ExprImpl provide Pos() function.
}

ExprImpl provide commonly implementations for Expr.

type ExprStmt

type ExprStmt struct {
	StmtImpl
	Expr Expr
}

ExprStmt provide expression statement.

type ForStmt

type ForStmt struct {
	StmtImpl
	Vars  []string
	Value Expr
	Stmts []Stmt
}

ForStmt provide "for in" expression statement.

type FuncExpr

type FuncExpr struct {
	ExprImpl
	Name   string
	Stmts  []Stmt
	Params []string
	VarArg bool
}

FuncExpr provide function expression.

type GoroutineStmt added in v0.0.4

type GoroutineStmt struct {
	StmtImpl
	Expr Expr
}

GoroutineStmt provide statement of groutine.

type IdentExpr

type IdentExpr struct {
	ExprImpl
	Lit string
}

IdentExpr provide identity expression.

type IfStmt

type IfStmt struct {
	StmtImpl
	If     Expr
	Then   []Stmt
	ElseIf []Stmt // This is array of IfStmt
	Else   []Stmt
}

IfStmt provide "if/else" statement.

type IncludeExpr added in v0.0.3

type IncludeExpr struct {
	ExprImpl
	ItemExpr Expr
	ListExpr Expr
}

IncludeExpr provide in expression

type ItemExpr

type ItemExpr struct {
	ExprImpl
	Value Expr
	Index Expr
}

ItemExpr provide expression to refer Map/Array item.

type LenExpr

type LenExpr struct {
	ExprImpl
	Expr Expr
}

LenExpr provide expression to get length of array, map, etc.

type LetMapItemStmt added in v0.0.3

type LetMapItemStmt struct {
	StmtImpl
	Lhss []Expr
	Rhs  Expr
}

LetMapItemStmt provide statement of let for map item.

type LetsExpr

type LetsExpr struct {
	ExprImpl
	Lhss     []Expr
	Operator string
	Rhss     []Expr
}

LetsExpr provide multiple expression of let.

type LetsStmt

type LetsStmt struct {
	StmtImpl
	Lhss     []Expr
	Operator string
	Rhss     []Expr
}

LetsStmt provide multiple statement of let.

type LoopStmt

type LoopStmt struct {
	StmtImpl
	Expr  Expr
	Stmts []Stmt
}

LoopStmt provide "for expr" expression statement.

type MakeChanExpr

type MakeChanExpr struct {
	ExprImpl
	Type     string
	SizeExpr Expr
}

MakeChanExpr provide expression to make chan instance.

type MakeExpr

type MakeExpr struct {
	ExprImpl
	Dimensions int
	Type       string
	LenExpr    Expr
	CapExpr    Expr
}

MakeExpr provide expression to make instance.

type MakeTypeExpr

type MakeTypeExpr struct {
	ExprImpl
	Name string
	Type Expr
}

MakeTypeExpr provide expression to make type.

type MapExpr

type MapExpr struct {
	ExprImpl
	MapExpr map[Expr]Expr
}

MapExpr provide Map expression.

type MemberExpr

type MemberExpr struct {
	ExprImpl
	Expr Expr
	Name string
}

MemberExpr provide expression to refer member.

type ModuleStmt

type ModuleStmt struct {
	StmtImpl
	Name  string
	Stmts []Stmt
}

ModuleStmt provide "module" expression statement.

type NewExpr

type NewExpr struct {
	ExprImpl
	Type string
}

NewExpr provide expression to make new instance.

type NilCoalescingOpExpr added in v0.0.5

type NilCoalescingOpExpr struct {
	ExprImpl
	Lhs Expr
	Rhs Expr
}

NilCoalescingOpExpr provide if invalid operator expression.

type NumberExpr

type NumberExpr struct {
	ExprImpl
	Lit string
}

NumberExpr provide Number expression.

type ParenExpr

type ParenExpr struct {
	ExprImpl
	SubExpr Expr
}

ParenExpr provide parent block expression.

type Pos

type Pos interface {
	Position() Position
	SetPosition(Position)
}

Pos interface provides two functions to get/set the position for expression or statement.

type PosImpl

type PosImpl struct {
	// contains filtered or unexported fields
}

PosImpl provides commonly implementations for Pos.

func (*PosImpl) Position

func (x *PosImpl) Position() Position

Position return the position of the expression or statement.

func (*PosImpl) SetPosition

func (x *PosImpl) SetPosition(pos Position)

SetPosition is a function to specify position of the expression or statement.

type Position

type Position struct {
	Line   int
	Column int
}

Position provides interface to store code locations.

type ReturnStmt

type ReturnStmt struct {
	StmtImpl
	Exprs []Expr
}

ReturnStmt provide "return" expression statement.

type SliceExpr

type SliceExpr struct {
	ExprImpl
	Value Expr
	Begin Expr
	End   Expr
}

SliceExpr provide expression to refer slice of Array.

type Stmt

type Stmt interface {
	Pos
	// contains filtered or unexported methods
}

Stmt provides all of interfaces for statement.

type StmtImpl

type StmtImpl struct {
	PosImpl // StmtImpl provide Pos() function.
}

StmtImpl provide commonly implementations for Stmt..

type StringExpr

type StringExpr struct {
	ExprImpl
	Lit string
}

StringExpr provide String expression.

type SwitchBodyStmt added in v0.0.7

type SwitchBodyStmt struct {
	StmtImpl
	Cases   []Stmt
	Default []Stmt
}

SwitchBodyStmt provide switch case statements and default statement.

type SwitchCaseStmt added in v0.0.7

type SwitchCaseStmt struct {
	StmtImpl
	Exprs []Expr
	Stmts []Stmt
}

SwitchCaseStmt provide switch case statement.

type SwitchStmt

type SwitchStmt struct {
	StmtImpl
	Expr Expr
	Body Stmt
}

SwitchStmt provide switch statement.

type TernaryOpExpr

type TernaryOpExpr struct {
	ExprImpl
	Expr Expr
	Lhs  Expr
	Rhs  Expr
}

TernaryOpExpr provide ternary operator expression.

type ThrowStmt

type ThrowStmt struct {
	StmtImpl
	Expr Expr
}

ThrowStmt provide "throw" expression statement.

type Token

type Token struct {
	PosImpl // PosImpl provides get/set the position function.
	Tok     int
	Lit     string
}

Token is used in the lexer to split characters into a string called a token

type TryStmt

type TryStmt struct {
	StmtImpl
	Try     []Stmt
	Var     string
	Catch   []Stmt
	Finally []Stmt
}

TryStmt provide "try/catch/finally" statement.

type UnaryExpr

type UnaryExpr struct {
	ExprImpl
	Operator string
	Expr     Expr
}

UnaryExpr provide unary minus expression. ex: -1, ^1, ~1.

type VarStmt

type VarStmt struct {
	StmtImpl
	Names []string
	Exprs []Expr
}

VarStmt provide statement to let variables in current scope.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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