expr

package
v0.0.0-...-d472ff9 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2018 License: BSD-2-Clause Imports: 3 Imported by: 18

Documentation

Overview

Package expr defines data structures representing Neugram expressions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayLiteral

type ArrayLiteral struct {
	Position src.Pos
	Type     *tipe.Array
	Keys     []Expr // TODO: could make this []int
	Values   []Expr
}

func (*ArrayLiteral) Pos

func (e *ArrayLiteral) Pos() src.Pos

type Bad

type Bad struct {
	Position src.Pos
	Error    error
}

func (*Bad) Pos

func (e *Bad) Pos() src.Pos

type BasicLiteral

type BasicLiteral struct {
	Position src.Pos
	Value    interface{} // string, *big.Int, *big.Float
}

func (*BasicLiteral) Pos

func (e *BasicLiteral) Pos() src.Pos

type Binary

type Binary struct {
	Position src.Pos
	Op       token.Token // Add, Sub, Mul, Div, Rem, Pow, And, Or, Equal, NotEqual, Less, Greater
	Left     Expr
	Right    Expr
}

func (*Binary) Pos

func (e *Binary) Pos() src.Pos

type Call

type Call struct {
	Position   src.Pos
	Func       Expr
	Args       []Expr
	Ellipsis   bool // last argument expands, e.g. f(x...)
	ElideError bool
}

func (*Call) Pos

func (e *Call) Pos() src.Pos

type CompLiteral

type CompLiteral struct {
	Position src.Pos
	Type     tipe.Type
	Keys     []Expr // TODO: could make this []string
	Values   []Expr
}

func (*CompLiteral) Pos

func (e *CompLiteral) Pos() src.Pos

type Expr

type Expr interface {
	Pos() src.Pos // implements syntax.Node
	// contains filtered or unexported methods
}

type FuncLiteral

type FuncLiteral struct {
	Position        src.Pos
	Name            string // may be empty
	ReceiverName    string // if non-empty, this is a method
	PointerReceiver bool
	Type            *tipe.Func
	ParamNames      []string
	ResultNames     []string
	Body            interface{} // *stmt.Block, breaking the package import cycle
}

func (*FuncLiteral) Pos

func (e *FuncLiteral) Pos() src.Pos

type Ident

type Ident struct {
	Position src.Pos
	Name     string
}

func (*Ident) Pos

func (e *Ident) Pos() src.Pos

type Index

type Index struct {
	Position src.Pos
	Left     Expr
	Indicies []Expr
}

func (*Index) Pos

func (e *Index) Pos() src.Pos

type MapLiteral

type MapLiteral struct {
	Position src.Pos
	Type     tipe.Type
	Keys     []Expr
	Values   []Expr
}

func (*MapLiteral) Pos

func (e *MapLiteral) Pos() src.Pos

type Range

type Range struct {
	Position src.Pos
	Start    Expr
	End      Expr
	Exact    Expr
}

func (*Range) Pos

func (e *Range) Pos() src.Pos

type Selector

type Selector struct {
	Position src.Pos
	Left     Expr
	Right    *Ident
}

func (*Selector) Pos

func (e *Selector) Pos() src.Pos

type Shell

type Shell struct {
	Position   src.Pos
	Cmds       []*ShellList
	TrapOut    bool // override os.Stdout, outer language collect it
	DropOut    bool // send stdout to /dev/null (just an optimization)
	ElideError bool

	// FreeVars is a list of $-parameters referred to in this
	// shell expression that are declared statically in the
	// scope of the expression. Not all parameters have to be
	// declared statically in the scope, as they may be
	// referring to run time environment variables.
	FreeVars []string
}

func (*Shell) Pos

func (e *Shell) Pos() src.Pos

type ShellAndOr

type ShellAndOr struct {
	Position   src.Pos
	Pipeline   []*ShellPipeline
	Sep        []token.Token // '&&' or '||'. len(Sep) == len(Pipeline)-1
	Background bool
}

func (*ShellAndOr) Pos

func (e *ShellAndOr) Pos() src.Pos

type ShellAssign

type ShellAssign struct {
	Position src.Pos
	Key      string
	Value    string
}

func (ShellAssign) Pos

func (e ShellAssign) Pos() src.Pos

type ShellCmd

type ShellCmd struct {
	Position  src.Pos
	SimpleCmd *ShellSimpleCmd // or:
	Subshell  *ShellList
}

func (*ShellCmd) Pos

func (e *ShellCmd) Pos() src.Pos

type ShellList

type ShellList struct {
	Position src.Pos
	AndOr    []*ShellAndOr
}

func (*ShellList) Pos

func (e *ShellList) Pos() src.Pos

type ShellPipeline

type ShellPipeline struct {
	Position src.Pos
	Bang     bool
	Cmd      []*ShellCmd // Cmd[0] | Cmd[1] | ...
}

func (*ShellPipeline) Pos

func (e *ShellPipeline) Pos() src.Pos

type ShellRedirect

type ShellRedirect struct {
	Position src.Pos
	Number   *int
	Token    token.Token // '<', '<&', '>', '>&', '>>'
	Filename string
}

func (*ShellRedirect) Pos

func (e *ShellRedirect) Pos() src.Pos

type ShellSimpleCmd

type ShellSimpleCmd struct {
	Position src.Pos
	Redirect []*ShellRedirect
	Assign   []ShellAssign
	Args     []string
}

func (*ShellSimpleCmd) Pos

func (e *ShellSimpleCmd) Pos() src.Pos

type Slice

type Slice struct {
	Position src.Pos
	Low      Expr
	High     Expr
	Max      Expr
}

func (*Slice) Pos

func (e *Slice) Pos() src.Pos

type SliceLiteral

type SliceLiteral struct {
	Position src.Pos
	Type     *tipe.Slice
	Keys     []Expr // TODO: could make this []int
	Values   []Expr
}

func (*SliceLiteral) Pos

func (e *SliceLiteral) Pos() src.Pos

type TableLiteral

type TableLiteral struct {
	Position src.Pos
	Type     *tipe.Table
	ColNames []Expr
	Rows     [][]Expr
}

func (*TableLiteral) Pos

func (e *TableLiteral) Pos() src.Pos

type Type

type Type struct {
	Position src.Pos
	Type     tipe.Type
}

Type is not a typical Neugram expression. It is used only for when types are passed as arguments to the builtin functions new and make.

func (*Type) Pos

func (e *Type) Pos() src.Pos

type TypeAssert

type TypeAssert struct {
	Position src.Pos
	Left     Expr
	Type     tipe.Type // asserted type; nil means type switch X.(type)
}

func (*TypeAssert) Pos

func (e *TypeAssert) Pos() src.Pos

type Unary

type Unary struct {
	Position src.Pos
	Op       token.Token // Not, Mul (deref), Ref, LeftParen, Range
	Expr     Expr
}

func (*Unary) Pos

func (e *Unary) Pos() src.Pos

Jump to

Keyboard shortcuts

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