base

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSExprInt64

func FormatSExprInt64(buf *bytes.Buffer, x int64)

Types

type All

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

All is the type of a reference to an immutable record.

func (All) A

func (x All) A() AllOrExpr

A returns the A field.

func (All) AllOrExpr

func (x All) AllOrExpr() AllOrExpr

AllOrExpr performs an upcast.

func (All) BE

func (x All) BE() BinExpr

BE returns the BE field.

func (All) BO

func (x All) BO() BinOp

BO returns the BO field.

func (All) CE

func (x All) CE() ConstExpr

CE returns the CE field.

func (All) E

func (x All) E() Expr

E returns the E field.

func (All) FormatSExpr

func (x All) FormatSExpr(buf *bytes.Buffer)

func (All) V

func (x All) V() AllValue

V unpacks a reference into a value.

type AllOrExpr

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

AllOrExpr is the type of a tagged union of records.

func (AllOrExpr) All

func (x AllOrExpr) All() (All, bool)

All performs a downcast. If the downcast fails, return false.

func (AllOrExpr) BinExpr

func (x AllOrExpr) BinExpr() (BinExpr, bool)

BinExpr performs a downcast. If the downcast fails, return false.

func (AllOrExpr) FormatSExpr

func (x AllOrExpr) FormatSExpr(buf *bytes.Buffer)

func (AllOrExpr) MustBeAll

func (x AllOrExpr) MustBeAll() All

MustBeAll performs a downcast. If the downcast fails, panic.

func (AllOrExpr) MustBeBinExpr

func (x AllOrExpr) MustBeBinExpr() BinExpr

MustBeBinExpr performs a downcast. If the downcast fails, panic.

func (AllOrExpr) Tag

func (x AllOrExpr) Tag() AllOrExprTag

Tag returns the tag.

type AllOrExprTag

type AllOrExprTag enum

AllOrExprTag is the tag type.

const (
	AllOrExprAll     AllOrExprTag = 1
	AllOrExprBinExpr AllOrExprTag = 2
)

AllOrExprTag constants.

func (AllOrExprTag) String

func (x AllOrExprTag) String() string

type AllValue

type AllValue struct {
	E  Expr      // 1
	CE ConstExpr // 2
	BE BinExpr   // 3
	BO BinOp     // 4
	A  AllOrExpr // 5
}

AllValue is the logical type of a record. Immutable records are stored in nodes.

func (AllValue) R

func (x AllValue) R(a Allocator) All

R constructs a reference to an immutable record.

func (AllValue) WithA

func (x AllValue) WithA(y AllOrExpr) AllValue

WithA constructs a new value where the value of A has been replaced by the argument.

func (AllValue) WithBE

func (x AllValue) WithBE(y BinExpr) AllValue

WithBE constructs a new value where the value of BE has been replaced by the argument.

func (AllValue) WithBO

func (x AllValue) WithBO(y BinOp) AllValue

WithBO constructs a new value where the value of BO has been replaced by the argument.

func (AllValue) WithCE

func (x AllValue) WithCE(y ConstExpr) AllValue

WithCE constructs a new value where the value of CE has been replaced by the argument.

func (AllValue) WithE

func (x AllValue) WithE(y Expr) AllValue

WithE constructs a new value where the value of E has been replaced by the argument.

type Allocator

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

Allocator allocates nodes in batches. Construct Allocators with NewAllocator and pass them by value.

func NewAllocator

func NewAllocator() Allocator

NewAllocator constructs a new Allocator.

type BinExpr

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

BinExpr is the type of a reference to an immutable record.

func (BinExpr) AllOrExpr

func (x BinExpr) AllOrExpr() AllOrExpr

AllOrExpr performs an upcast.

func (BinExpr) Expr

func (x BinExpr) Expr() Expr

Expr performs an upcast.

func (BinExpr) FormatSExpr

func (x BinExpr) FormatSExpr(buf *bytes.Buffer)

func (BinExpr) Left

func (x BinExpr) Left() Expr

Left returns the Left field.

func (BinExpr) Op

func (x BinExpr) Op() BinOp

Op returns the Op field.

func (BinExpr) Right

func (x BinExpr) Right() Expr

Right returns the Right field.

func (BinExpr) V

func (x BinExpr) V() BinExprValue

V unpacks a reference into a value.

type BinExprValue

type BinExprValue struct {
	Left  Expr  // 1
	Op    BinOp // 2
	Right Expr  // 3
}

BinExprValue is the logical type of a record. Immutable records are stored in nodes.

func (BinExprValue) R

R constructs a reference to an immutable record.

func (BinExprValue) WithLeft

func (x BinExprValue) WithLeft(y Expr) BinExprValue

WithLeft constructs a new value where the value of Left has been replaced by the argument.

func (BinExprValue) WithOp

func (x BinExprValue) WithOp(y BinOp) BinExprValue

WithOp constructs a new value where the value of Op has been replaced by the argument.

func (BinExprValue) WithRight

func (x BinExprValue) WithRight(y Expr) BinExprValue

WithRight constructs a new value where the value of Right has been replaced by the argument.

type BinOp

type BinOp enum

BinOp is an enumeration type.

const (
	BinOpAdd BinOp = 1
	BinOpMul BinOp = 2
)

BinOp constants.

func (BinOp) FormatSExpr

func (x BinOp) FormatSExpr(buf *bytes.Buffer)

func (BinOp) String

func (x BinOp) String() string

type ConstExpr

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

ConstExpr is the type of a reference to an immutable record.

func (ConstExpr) Datum

func (x ConstExpr) Datum() int64

Datum returns the Datum field.

func (ConstExpr) Expr

func (x ConstExpr) Expr() Expr

Expr performs an upcast.

func (ConstExpr) FormatSExpr

func (x ConstExpr) FormatSExpr(buf *bytes.Buffer)

func (ConstExpr) V

func (x ConstExpr) V() ConstExprValue

V unpacks a reference into a value.

type ConstExprValue

type ConstExprValue struct {
	Datum int64 // 1
}

ConstExprValue is the logical type of a record. Immutable records are stored in nodes.

func (ConstExprValue) R

R constructs a reference to an immutable record.

func (ConstExprValue) WithDatum

func (x ConstExprValue) WithDatum(y int64) ConstExprValue

WithDatum constructs a new value where the value of Datum has been replaced by the argument.

type Expr

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

Expr is the type of a tagged union of records.

func (Expr) BinExpr

func (x Expr) BinExpr() (BinExpr, bool)

BinExpr performs a downcast. If the downcast fails, return false.

func (Expr) ConstExpr

func (x Expr) ConstExpr() (ConstExpr, bool)

ConstExpr performs a downcast. If the downcast fails, return false.

func (Expr) FormatSExpr

func (x Expr) FormatSExpr(buf *bytes.Buffer)

func (Expr) MustBeBinExpr

func (x Expr) MustBeBinExpr() BinExpr

MustBeBinExpr performs a downcast. If the downcast fails, panic.

func (Expr) MustBeConstExpr

func (x Expr) MustBeConstExpr() ConstExpr

MustBeConstExpr performs a downcast. If the downcast fails, panic.

func (Expr) Tag

func (x Expr) Tag() ExprTag

Tag returns the tag.

type ExprTag

type ExprTag enum

ExprTag is the tag type.

const (
	ExprConstExpr ExprTag = 1
	ExprBinExpr   ExprTag = 2
)

ExprTag constants.

func (ExprTag) String

func (x ExprTag) String() string

type SexprFormatter

type SexprFormatter interface {
	FormatSExpr(buf *bytes.Buffer)
}

Jump to

Keyboard shortcuts

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