anko: github.com/mattn/anko/ast Index | Files | Directories

package ast

import "github.com/mattn/anko/ast"

Package ast implements abstruct-syntax-tree for anko.

Index

Package Files

ast.go doc.go expr.go operator.go pos.go stmt.go

type AddOperator Uses

type AddOperator struct {
    OperatorImpl
    LHS      Expr
    Operator string
    RHS      Expr
}

AddOperator provides add operation.

type AddrExpr Uses

type AddrExpr struct {
    ExprImpl
    Expr Expr
}

AddrExpr provide referencing address expression.

type AnonCallExpr Uses

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

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

type ArrayExpr Uses

type ArrayExpr struct {
    ExprImpl
    Exprs    []Expr
    TypeData *TypeStruct
}

ArrayExpr provide Array expression.

type BinaryOperator Uses

type BinaryOperator struct {
    OperatorImpl
    LHS      Expr
    Operator string
    RHS      Expr
}

BinaryOperator provides binary operation.

type BreakStmt Uses

type BreakStmt struct {
    StmtImpl
}

BreakStmt provide "break" expression statement.

type CForStmt Uses

type CForStmt struct {
    StmtImpl
    Stmt1 Stmt
    Expr2 Expr
    Expr3 Expr
    Stmt  Stmt
}

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

type CallExpr Uses

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

CallExpr provide calling expression.

type ChanExpr Uses

type ChanExpr struct {
    ExprImpl
    LHS Expr
    RHS Expr
}

ChanExpr provide chan expression.

type ChanStmt Uses

type ChanStmt struct {
    ExprImpl
    LHS    Expr
    OkExpr Expr
    RHS    Expr
}

ChanStmt provide chan lets statement.

type CloseStmt Uses

type CloseStmt struct {
    StmtImpl
    Expr Expr
}

CloseStmt provides statement of close.

type ComparisonOperator Uses

type ComparisonOperator struct {
    OperatorImpl
    LHS      Expr
    Operator string
    RHS      Expr
}

ComparisonOperator provides comparison operation.

type ContinueStmt Uses

type ContinueStmt struct {
    StmtImpl
}

ContinueStmt provide "continue" expression statement.

type DeleteStmt Uses

type DeleteStmt struct {
    ExprImpl
    Item Expr
    Key  Expr
}

DeleteStmt provides statement of delete.

type DerefExpr Uses

type DerefExpr struct {
    ExprImpl
    Expr Expr
}

DerefExpr provide dereferencing address expression.

type Expr Uses

type Expr interface {
    Pos
}

Expr provides all of interfaces for expression.

type ExprImpl Uses

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

ExprImpl provide commonly implementations for Expr.

type ExprStmt Uses

type ExprStmt struct {
    StmtImpl
    Expr Expr
}

ExprStmt provide expression statement.

type ForStmt Uses

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

ForStmt provide "for in" expression statement.

type FuncExpr Uses

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

FuncExpr provide function expression.

type GoroutineStmt Uses

type GoroutineStmt struct {
    StmtImpl
    Expr Expr
}

GoroutineStmt provide statement of groutine.

type IdentExpr Uses

type IdentExpr struct {
    ExprImpl
    Lit string
}

IdentExpr provide identity expression.

type IfStmt Uses

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

IfStmt provide "if/else" statement.

type ImportExpr Uses

type ImportExpr struct {
    ExprImpl
    Name Expr
}

ImportExpr provide expression to import packages.

type IncludeExpr Uses

type IncludeExpr struct {
    ExprImpl
    ItemExpr Expr
    ListExpr Expr
}

IncludeExpr provide in expression

type ItemExpr Uses

type ItemExpr struct {
    ExprImpl
    Item  Expr
    Index Expr
}

ItemExpr provide expression to refer Map/Array item.

type LenExpr Uses

type LenExpr struct {
    ExprImpl
    Expr Expr
}

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

type LetMapItemStmt Uses

type LetMapItemStmt struct {
    StmtImpl
    LHSS []Expr
    RHS  Expr
}

LetMapItemStmt provide statement of let for map item.

type LetsExpr Uses

type LetsExpr struct {
    ExprImpl
    LHSS []Expr
    RHSS []Expr
}

LetsExpr provide multiple expression of let.

type LetsStmt Uses

type LetsStmt struct {
    StmtImpl
    LHSS []Expr
    RHSS []Expr
}

LetsStmt provide multiple statement of let.

type LiteralExpr Uses

type LiteralExpr struct {
    ExprImpl
    Literal reflect.Value
}

LiteralExpr provide literal expression.

type LoopStmt Uses

type LoopStmt struct {
    StmtImpl
    Expr Expr
    Stmt Stmt
}

LoopStmt provide "for expr" expression statement.

type MakeExpr Uses

type MakeExpr struct {
    ExprImpl
    TypeData *TypeStruct
    LenExpr  Expr
    CapExpr  Expr
}

MakeExpr provide expression to make instance.

type MakeTypeExpr Uses

type MakeTypeExpr struct {
    ExprImpl
    Name string
    Type Expr
}

MakeTypeExpr provide expression to make type.

type MapExpr Uses

type MapExpr struct {
    ExprImpl
    Keys     []Expr
    Values   []Expr
    TypeData *TypeStruct
}

MapExpr provide Map expression.

type MemberExpr Uses

type MemberExpr struct {
    ExprImpl
    Expr Expr
    Name string
}

MemberExpr provide expression to refer member.

type ModuleStmt Uses

type ModuleStmt struct {
    StmtImpl
    Name string
    Stmt Stmt
}

ModuleStmt provide "module" expression statement.

type MultiplyOperator Uses

type MultiplyOperator struct {
    OperatorImpl
    LHS      Expr
    Operator string
    RHS      Expr
}

MultiplyOperator provides multiply operation.

type NilCoalescingOpExpr Uses

type NilCoalescingOpExpr struct {
    ExprImpl
    LHS Expr
    RHS Expr
}

NilCoalescingOpExpr provide if invalid operator expression.

type OpExpr Uses

type OpExpr struct {
    ExprImpl
    Op  Operator
}

OpExpr provide operator expression.

type Operator Uses

type Operator interface {
    Pos
}

Operator provides interfaces for operators.

type OperatorImpl Uses

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

OperatorImpl provides common implementations for Operator.

type ParenExpr Uses

type ParenExpr struct {
    ExprImpl
    SubExpr Expr
}

ParenExpr provide parent block expression.

type Pos Uses

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

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

type PosImpl Uses

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

PosImpl provides commonly implementations for Pos.

func (*PosImpl) Position Uses

func (x *PosImpl) Position() Position

Position return the position of the expression or statement.

func (*PosImpl) SetPosition Uses

func (x *PosImpl) SetPosition(pos Position)

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

type Position Uses

type Position struct {
    Line   int
    Column int
}

Position provides interface to store code locations.

type ReturnStmt Uses

type ReturnStmt struct {
    StmtImpl
    Exprs []Expr
}

ReturnStmt provide "return" expression statement.

type SliceExpr Uses

type SliceExpr struct {
    ExprImpl
    Item  Expr
    Begin Expr
    End   Expr
    Cap   Expr
}

SliceExpr provide expression to refer slice of Array.

type Stmt Uses

type Stmt interface {
    Pos
}

Stmt provides all of interfaces for statement.

type StmtImpl Uses

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

StmtImpl provide commonly implementations for Stmt..

type StmtsStmt Uses

type StmtsStmt struct {
    StmtImpl
    Stmts []Stmt
}

StmtsStmt provides statements.

type SwitchCaseStmt Uses

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

SwitchCaseStmt provide switch case statement.

type SwitchStmt Uses

type SwitchStmt struct {
    StmtImpl
    Expr    Expr
    Cases   []Stmt
    Default Stmt
}

SwitchStmt provide switch statement.

type TernaryOpExpr Uses

type TernaryOpExpr struct {
    ExprImpl
    Expr Expr
    LHS  Expr
    RHS  Expr
}

TernaryOpExpr provide ternary operator expression.

type ThrowStmt Uses

type ThrowStmt struct {
    StmtImpl
    Expr Expr
}

ThrowStmt provide "throw" expression statement.

type Token Uses

type Token struct {
    PosImpl
    Tok int
    Lit string
}

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

type TryStmt Uses

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

TryStmt provide "try/catch/finally" statement.

type TypeKind Uses

type TypeKind int

TypeKind is the kinds of types

const (
    // TypeDefault default type
    TypeDefault TypeKind = iota
    // TypePtr ptr type
    TypePtr
    // TypeSlice slice type
    TypeSlice
    // TypeMap map type
    TypeMap
    // TypeChan chan type
    TypeChan
    // TypeStructType struct type
    TypeStructType
)

type TypeStruct Uses

type TypeStruct struct {
    Kind        TypeKind
    Env         []string
    Name        string
    Dimensions  int
    SubType     *TypeStruct
    Key         *TypeStruct
    StructNames []string
    StructTypes []*TypeStruct
}

TypeStruct is the type and sub-types

type UnaryExpr Uses

type UnaryExpr struct {
    ExprImpl
    Operator string
    Expr     Expr
}

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

type VarStmt Uses

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

VarStmt provide statement to let variables in current scope.

Directories

PathSynopsis
astutil

Package ast imports 1 packages (graph) and is imported by 21 packages. Updated 2020-03-26. Refresh now. Tools for package owners.