gen

package
v0.0.0-...-27647ab Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(w *iou.IndentWriter, n Node)

func RenderString

func RenderString(n Node) string

Types

type Addr

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

type Array

type Array struct {
	Len  bt.Optional[int]
	Elem Type
	// contains filtered or unexported fields
}

type Assign

type Assign struct {
	Var   Expr
	Value Expr
	// contains filtered or unexported fields
}

func AssignOf

func AssignOf(var_, value any) Assign

type Binary

type Binary struct {
	Op   BinaryOp
	Args []Expr
	// contains filtered or unexported fields
}

func BinaryOf

func BinaryOf(op BinaryOp, args ...Expr) Binary

type BinaryOp

type BinaryOp int8
const (
	InvalidBinaryOp BinaryOp = iota

	AddOp
	SubOp
	MulOp
	DivOp
	ModOp

	LtOp
	LteOp
	EqOp
	NeOp
	GtOp
	GteOp

	BitAndOp
	BitOrOp
	BitXorOp

	AndOp
	OrOp
)

func BinaryOpFromToken

func BinaryOpFromToken(tok token.Token) BinaryOp

func (BinaryOp) IsBit

func (o BinaryOp) IsBit() bool

func (BinaryOp) IsBoolean

func (o BinaryOp) IsBoolean() bool

func (BinaryOp) String

func (o BinaryOp) String() string

type Blank

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

type Block

type Block struct {
	Body []Stmt
	// contains filtered or unexported fields
}

func NewBlock

func NewBlock(body ...any) *Block

func (Block) Empty

func (b Block) Empty() bool

type Call

type Call struct {
	Func Expr
	Args []Expr
	// contains filtered or unexported fields
}

func CallOf

func CallOf(func_ any, args ...any) Call

type Const

type Const struct {
	Name  Ident
	Value Expr
	// contains filtered or unexported fields
}

func ConstOf

func ConstOf(name, value any) Const

type Consts

type Consts struct {
	Consts []Const
	// contains filtered or unexported fields
}

func ConstsOf

func ConstsOf(consts []Const) Consts

type Decl

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

func DeclOf

func DeclOf(o any) Decl

type Decls

type Decls []Decl

func (*Decls) Append

func (s *Decls) Append(os ...any)

type Deref

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

type Expr

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

func Add

func Add(args ...Expr) Expr

func And

func And(args ...Expr) Expr

func BitAnd

func BitAnd(args ...Expr) Expr

func BitOr

func BitOr(args ...Expr) Expr

func BitXor

func BitXor(args ...Expr) Expr

func Dec

func Dec(arg Expr) Expr

func Div

func Div(args ...Expr) Expr

func Eq

func Eq(args ...Expr) Expr

func ExprOf

func ExprOf(o any) Expr

func Gt

func Gt(args ...Expr) Expr

func Gte

func Gte(args ...Expr) Expr

func Inc

func Inc(arg Expr) Expr

func Inv

func Inv(arg Expr) Expr

func Lt

func Lt(args ...Expr) Expr

func Lte

func Lte(args ...Expr) Expr

func Mod

func Mod(args ...Expr) Expr

func Mul

func Mul(args ...Expr) Expr

func Ne

func Ne(args ...Expr) Expr

func Neg

func Neg(arg Expr) Expr

func Not

func Not(arg Expr) Expr

func Or

func Or(args ...Expr) Expr

func Sub

func Sub(args ...Expr) Expr

type ExprStmt

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

func ExprStmtOf

func ExprStmtOf(expr any) ExprStmt

type Exprs

type Exprs []Expr

func (*Exprs) Append

func (s *Exprs) Append(os ...any)

type Func

type Func struct {
	Receiver *Param
	Name     *Ident
	Params   []Param
	Type     Type
	Body     *Block
	// contains filtered or unexported fields
}

type FuncExpr

type FuncExpr struct {
	Func Func
	// contains filtered or unexported fields
}

func FuncExprOf

func FuncExprOf(func_ Func) FuncExpr

type FuncType

type FuncType struct {
	Func Func
	// contains filtered or unexported fields
}

func FuncTypeOf

func FuncTypeOf(func_ Func) FuncType

type Goto

type Goto struct {
	Name Ident
	// contains filtered or unexported fields
}

type Ident

type Ident struct {
	Name string
	// contains filtered or unexported fields
}

func IdentOf

func IdentOf(o any) Ident

func NewIdent

func NewIdent(name string) *Ident

type If

type If struct {
	Cond Expr
	Then Block
	Else Block
	// contains filtered or unexported fields
}

func IfElseOf

func IfElseOf(cond Expr, then, else_ Block) If

func IfOf

func IfOf(cond Expr, then Block) If

type Import

type Import struct {
	Spec  string
	Alias *Ident
	// contains filtered or unexported fields
}

type Imports

type Imports struct {
	Imports []Import
	// contains filtered or unexported fields
}

type Index

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

func IndexOf

func IndexOf(value, index any) Index

type Label

type Label struct {
	Name Ident
	// contains filtered or unexported fields
}

type Lit

type Lit struct {
	String string
	// contains filtered or unexported fields
}

func LitOf

func LitOf(s string) Lit

type Map

type Map struct {
	Key   Type
	Value Type
	// contains filtered or unexported fields
}

func MapOf

func MapOf(key, value any) Map

type NameType

type NameType struct {
	Name Ident
	// contains filtered or unexported fields
}

func NameTypeOf

func NameTypeOf(name any) NameType

type Node

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

type Package

type Package struct {
	Name Ident
	// contains filtered or unexported fields
}

type Param

type Param struct {
	Name *Ident
	Type Type
	// contains filtered or unexported fields
}

type Paren

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

func ParenOf

func ParenOf(value any) Paren

type Ptr

type Ptr struct {
	Elem Type
	// contains filtered or unexported fields
}

func PtrOf

func PtrOf(elem any) Ptr

type Raw

type Raw struct {
	Raw string
	// contains filtered or unexported fields
}

type Return

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

type Select

type Select struct {
	Value Expr
	Names []Ident
	// contains filtered or unexported fields
}

func SelectOf

func SelectOf(value any, names ...any) Select

type ShortVar

type ShortVar struct {
	Name  Ident
	Value Expr
	// contains filtered or unexported fields
}

func ShortVarOf

func ShortVarOf(name, value any) ShortVar

type Slice

type Slice struct {
	Elem Type
	// contains filtered or unexported fields
}

func SliceOf

func SliceOf(elem any) Slice

type Stmt

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

func StmtOf

func StmtOf(o any) Stmt

type StmtDecl

type StmtDecl struct {
	Stmt Stmt
	// contains filtered or unexported fields
}

func StmtDeclOf

func StmtDeclOf(stmt Stmt) StmtDecl

type Stmts

type Stmts []Stmt

func (*Stmts) Append

func (s *Stmts) Append(os ...any)

type Struct

type Struct struct {
	Name   Ident
	Fields []StructField
	// contains filtered or unexported fields
}

type StructField

type StructField struct {
	Name Ident
	Type Type
	// contains filtered or unexported fields
}

type Type

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

func TypeOf

func TypeOf(o any) Type

type TypeAssert

type TypeAssert struct {
	Value Expr
	Type  Type
	// contains filtered or unexported fields
}

func TypeAssertOf

func TypeAssertOf(value, type_ any) TypeAssert

type Unary

type Unary struct {
	Op  UnaryOp
	Arg Expr
	// contains filtered or unexported fields
}

func UnaryOf

func UnaryOf(op UnaryOp, arg any) Unary

type UnaryOp

type UnaryOp int8
const (
	InvalidUnaryOp UnaryOp = iota

	NotOp
	NegOp
	InvOp

	IncOp
	DecOp
)

func UnaryOpFromToken

func UnaryOpFromToken(tok token.Token) UnaryOp

func (UnaryOp) IsPrefix

func (o UnaryOp) IsPrefix() bool

func (UnaryOp) String

func (o UnaryOp) String() string

type Var

type Var struct {
	Name  Ident
	Type  Type
	Value Expr
	// contains filtered or unexported fields
}

func VarOf

func VarOf(name any, args ...any) Var

type Vars

type Vars struct {
	Vars []Var
	// contains filtered or unexported fields
}

func VarsOf

func VarsOf(vars ...Var) Vars

Jump to

Keyboard shortcuts

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