ast

package
v0.0.0-...-1e04c87 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 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 ArrayLiteral

type ArrayLiteral struct {
	Token    token.Token // the '[' token
	Elements []Expression
}

func (*ArrayLiteral) String

func (al *ArrayLiteral) String() string

func (*ArrayLiteral) TokenLiteral

func (al *ArrayLiteral) TokenLiteral() string

type AssignStatement

type AssignStatement struct {
	Token token.Token // the token.VAR token
	Name  *Identifier
	Value Expression
}

Statements

func (*AssignStatement) String

func (ls *AssignStatement) String() string

func (*AssignStatement) TokenLiteral

func (ls *AssignStatement) TokenLiteral() string

type BacktickLiteral

type BacktickLiteral struct {
	Token token.Token
	Value string
}

func (*BacktickLiteral) String

func (sl *BacktickLiteral) String() string

func (*BacktickLiteral) TokenLiteral

func (sl *BacktickLiteral) TokenLiteral() string

type BlockStatement

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

func (*BlockStatement) String

func (bs *BlockStatement) String() string

func (*BlockStatement) TokenLiteral

func (bs *BlockStatement) TokenLiteral() string

type Boolean

type Boolean struct {
	Token token.Token
	Value bool
}

func (*Boolean) String

func (b *Boolean) String() string

func (*Boolean) TokenLiteral

func (b *Boolean) TokenLiteral() string

type CallExpression

type CallExpression struct {
	Token     token.Token // The '(' token
	Function  Expression  // Identifier or FunctionLiteral
	Arguments []Expression
	Out       *Pipes
	In        *Pipes
}

func (*CallExpression) String

func (ce *CallExpression) String() string

func (*CallExpression) TokenLiteral

func (ce *CallExpression) TokenLiteral() string

type CommentLiteral

type CommentLiteral struct {
	Token token.Token
	Value string
}

func (*CommentLiteral) String

func (sl *CommentLiteral) String() string

func (*CommentLiteral) TokenLiteral

func (sl *CommentLiteral) TokenLiteral() string

type Expression

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

All expression nodes implement this

type ExpressionStatement

type ExpressionStatement struct {
	Token      token.Token // the first token of the expression
	Expression Expression
}

func (*ExpressionStatement) String

func (es *ExpressionStatement) String() string

func (*ExpressionStatement) TokenLiteral

func (es *ExpressionStatement) TokenLiteral() string

type ForExpression

type ForExpression struct {
	Token       token.Token
	Init        Statement
	Condition   Expression
	After       Statement
	Body        *BlockStatement
	Indentation int
}

func (*ForExpression) String

func (ie *ForExpression) String() string

func (*ForExpression) TokenLiteral

func (ie *ForExpression) TokenLiteral() string

type FunctionLiteral

type FunctionLiteral struct {
	Token      token.Token // The 'fn' token
	Parameters []*Identifier
	Body       *BlockStatement
}

func (*FunctionLiteral) String

func (fl *FunctionLiteral) String() string

func (*FunctionLiteral) TokenLiteral

func (fl *FunctionLiteral) TokenLiteral() string

type HashLiteral

type HashLiteral struct {
	Token token.Token // the '{' token
	Pairs map[Expression]Expression
}

func (*HashLiteral) String

func (hl *HashLiteral) String() string

func (*HashLiteral) TokenLiteral

func (hl *HashLiteral) TokenLiteral() string

type Identifier

type Identifier struct {
	Token token.Token // the token.IDENT token
	Value string
}

Expressions

func (*Identifier) String

func (i *Identifier) String() string

func (*Identifier) TokenLiteral

func (i *Identifier) TokenLiteral() string

type IfExpression

type IfExpression struct {
	Token       token.Token // The 'if' token
	Condition   Expression
	Consequence *BlockStatement
	Alternative *BlockStatement
}

func (*IfExpression) String

func (ie *IfExpression) String() string

func (*IfExpression) TokenLiteral

func (ie *IfExpression) TokenLiteral() string

type IndexExpression

type IndexExpression struct {
	Token token.Token // The [ token
	Left  Expression
	Index Expression
}

func (*IndexExpression) String

func (ie *IndexExpression) String() string

func (*IndexExpression) TokenLiteral

func (ie *IndexExpression) TokenLiteral() string

type InfixExpression

type InfixExpression struct {
	Token    token.Token // The operator token, e.g. +
	Left     Expression
	Operator string
	Right    Expression
}

func (*InfixExpression) String

func (oe *InfixExpression) String() string

func (*InfixExpression) TokenLiteral

func (oe *InfixExpression) TokenLiteral() string

type IntegerLiteral

type IntegerLiteral struct {
	Token token.Token
	Value int64
}

func (*IntegerLiteral) String

func (il *IntegerLiteral) String() string

func (*IntegerLiteral) TokenLiteral

func (il *IntegerLiteral) TokenLiteral() string

type MacroLiteral

type MacroLiteral struct {
	Token      token.Token // The 'macro' token
	Parameters []*Identifier
	Body       *BlockStatement
}

func (*MacroLiteral) String

func (ml *MacroLiteral) String() string

func (*MacroLiteral) TokenLiteral

func (ml *MacroLiteral) TokenLiteral() string

type ModifierFunc

type ModifierFunc func(Node) Node

type Node

type Node interface {
	TokenLiteral() string
	String() string
}

The base Node interface

func Modify

func Modify(node Node, modifier ModifierFunc) Node

type PipeExpression

type PipeExpression struct {
	Token       token.Token // The '|' token
	Destination *CallExpression
}

func (*PipeExpression) String

func (pe *PipeExpression) String() string

func (*PipeExpression) TokenLiteral

func (pe *PipeExpression) TokenLiteral() string

type Pipes

type Pipes struct {
	Main io.ReadCloser
	Err  io.ReadCloser
	Wait func() error // Wait should be idempotent to allow for resource cleanup
}

Pipes are the outcome of an exec'd command

func (*Pipes) WaitAndClose

func (p *Pipes) WaitAndClose() error

WaitAndClose closes pipes if open

type PrefixExpression

type PrefixExpression struct {
	Token    token.Token // The prefix token, e.g. !
	Operator string
	Right    Expression
}

func (*PrefixExpression) String

func (pe *PrefixExpression) String() string

func (*PrefixExpression) TokenLiteral

func (pe *PrefixExpression) TokenLiteral() string

type Program

type Program struct {
	Statements []Statement
}

func (*Program) String

func (p *Program) String() string

func (*Program) TokenLiteral

func (p *Program) TokenLiteral() string

type RangeExpression

type RangeExpression struct {
	Token      token.Token // The 'if' token
	Identifier Expression
	Iteree     Expression
	Iterator   Expression
	Body       *BlockStatement
}

func (*RangeExpression) String

func (ie *RangeExpression) String() string

func (*RangeExpression) TokenLiteral

func (ie *RangeExpression) TokenLiteral() string

type ReturnStatement

type ReturnStatement struct {
	Token       token.Token // the 'return' token
	ReturnValue Expression
}

func (*ReturnStatement) String

func (rs *ReturnStatement) String() string

func (*ReturnStatement) TokenLiteral

func (rs *ReturnStatement) TokenLiteral() string

type Statement

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

All statement nodes implement this

type StringLiteral

type StringLiteral struct {
	Token token.Token
	Value string
}

func (*StringLiteral) String

func (sl *StringLiteral) String() string

func (*StringLiteral) TokenLiteral

func (sl *StringLiteral) TokenLiteral() string

Jump to

Keyboard shortcuts

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