ast

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KInvalid = Kind(iota)

	KArg
	KAssert
	KAssign
	KConst
	KExpr
	KField
	KFile
	KFunc
	KIOBind
	KIf
	KIterate
	KJump
	KRet
	KStatus
	KStruct
	KTypeExpr
	KUse
	KVar
	KWhile
)
View Source
const (
	FlagsPublic           = Flags(0x00000100)
	FlagsHasBreak         = Flags(0x00000200)
	FlagsHasContinue      = Flags(0x00000400)
	FlagsGlobalIdent      = Flags(0x00000800)
	FlagsClassy           = Flags(0x00001000)
	FlagsSubExprHasEffect = Flags(0x00002000)
	FlagsRetsError        = Flags(0x00004000)
	FlagsPrivateData      = Flags(0x00008000)
)
View Source
const (
	EffectPure            = Effect(0)
	EffectImpure          = Effect(effectBitImpure)
	EffectImpureCoroutine = Effect(effectBitImpure | effectBitCoroutine)
)
View Source
const MaxBodyDepth = 255

MaxBodyDepth is an advisory limit for a function body's recursion depth.

View Source
const MaxExprDepth = 255

MaxExprDepth is an advisory limit for an Expr's recursion depth.

View Source
const MaxTypeExprDepth = 63

MaxTypeExprDepth is an advisory limit for a TypeExpr's recursion depth.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg Node

Arg is "name:value".

  • ID2: <ident> name
  • RHS: <Expr> value

func NewArg

func NewArg(name t.ID, value *Expr) *Arg

func (*Arg) AsNode added in v0.2.0

func (n *Arg) AsNode() *Node

func (*Arg) Name

func (n *Arg) Name() t.ID

func (*Arg) Value

func (n *Arg) Value() *Expr

type Assert

type Assert Node

Assert is "assert RHS via ID2(args)", "pre etc", "inv etc" or "post etc":

  • ID0: <IDAssert|IDPre|IDInv|IDPost>
  • ID2: <string literal> reason
  • RHS: <Expr>
  • List0: <Arg> reason arguments

func NewAssert

func NewAssert(keyword t.ID, condition *Expr, reason t.ID, args []*Node) *Assert

func (*Assert) Args

func (n *Assert) Args() []*Node

func (*Assert) AsNode added in v0.2.0

func (n *Assert) AsNode() *Node

func (*Assert) Condition

func (n *Assert) Condition() *Expr

func (*Assert) Keyword

func (n *Assert) Keyword() t.ID

func (*Assert) Reason

func (n *Assert) Reason() t.ID

type Assign

type Assign Node

Assign is "LHS = RHS" or "LHS op= RHS" or "RHS":

  • ID0: operator
  • LHS: <nil|Expr>
  • RHS: <Expr>

func NewAssign

func NewAssign(operator t.ID, lhs *Expr, rhs *Expr) *Assign

func (*Assign) AsNode added in v0.2.0

func (n *Assign) AsNode() *Node

func (*Assign) LHS

func (n *Assign) LHS() *Expr

func (*Assign) Operator

func (n *Assign) Operator() t.ID

func (*Assign) RHS

func (n *Assign) RHS() *Expr

type Const

type Const Node

Const is "const ID2 LHS = RHS":

  • FlagsPublic is "pub" vs "pri"
  • ID1: <0|pkg> (set by calling SetPackage)
  • ID2: name
  • LHS: <TypeExpr>
  • RHS: <Expr>

func NewConst

func NewConst(flags Flags, filename string, line uint32, name t.ID, xType *TypeExpr, value *Expr) *Const

func (*Const) AsNode added in v0.2.0

func (n *Const) AsNode() *Node

func (*Const) Filename

func (n *Const) Filename() string

func (*Const) Line

func (n *Const) Line() uint32

func (*Const) Public

func (n *Const) Public() bool

func (*Const) QID added in v0.2.0

func (n *Const) QID() t.QID

func (*Const) Value

func (n *Const) Value() *Expr

func (*Const) XType

func (n *Const) XType() *TypeExpr

type Effect added in v0.2.0

type Effect uint8

func (Effect) AsFlags added in v0.2.0

func (e Effect) AsFlags() Flags

func (Effect) Coroutine added in v0.2.0

func (e Effect) Coroutine() bool

func (Effect) Impure added in v0.2.0

func (e Effect) Impure() bool

func (Effect) Pure added in v0.2.0

func (e Effect) Pure() bool

func (Effect) String added in v0.2.0

func (e Effect) String() string

func (Effect) WeakerThan added in v0.2.0

func (e Effect) WeakerThan(o Effect) bool

type Expr

type Expr Node

Expr is an expression, such as "i", "+j" or "k + l[m(n, o)].p":

  • ID0: <0|operator|IDOpenParen|IDOpenBracket|IDDotDot|IDDot>
  • ID1: <0|pkg> (for statuses)
  • ID2: <0|literal|ident>
  • LHS: <nil|Expr>
  • MHS: <nil|Expr>
  • RHS: <nil|Expr|TypeExpr>
  • List0: <Arg|Expr> function call args, assoc. op args or list members.

A zero ID0 means an identifier or literal in ID2, like `foo`, `42` or a status literal like `"#foo"` or `pkg."$bar"`. For status literals, ID1 is the package.

For unary operators, ID0 is the operator and RHS is the operand.

For binary operators, ID0 is the operator and LHS and RHS are the operands.

For associative operators, ID0 is the operator and List0 holds the operands.

The ID0 operator is in disambiguous form. For example, IDXUnaryPlus, IDXBinaryPlus or IDXAssociativePlus, not a bare IDPlus.

For function calls, like "LHS(List0)", ID0 is IDOpenParen.

For indexes, like "LHS[RHS]", ID0 is IDOpenBracket.

For slices, like "LHS[MHS .. RHS]", ID0 is IDDotDot.

For selectors, like "LHS.ID2", ID0 is IDDot.

For lists, like "[0, 1, 2]", ID0 is IDComma.

func NewExpr

func NewExpr(flags Flags, operator t.ID, statusPkg t.ID, ident t.ID, lhs *Node, mhs *Node, rhs *Node, args []*Node) *Expr

func (*Expr) Args

func (n *Expr) Args() []*Node

func (*Expr) AsNode added in v0.2.0

func (n *Expr) AsNode() *Node

func (*Expr) ConstValue

func (n *Expr) ConstValue() *big.Int

func (*Expr) Effect added in v0.2.0

func (n *Expr) Effect() Effect

func (*Expr) Eq

func (n *Expr) Eq(o *Expr) bool

Eq returns whether n and o are equal.

It may return false negatives. In general, it will not report that "x + y" equals "y + x". However, if both are constant expressions (i.e. each Expr node, including the sum nodes, has a ConstValue), both sums will have the same value and will compare equal.

func (*Expr) GlobalIdent

func (n *Expr) GlobalIdent() bool

func (*Expr) Ident added in v0.2.0

func (n *Expr) Ident() t.ID

func (*Expr) LHS

func (n *Expr) LHS() *Node

func (*Expr) MBounds added in v0.2.0

func (n *Expr) MBounds() interval.IntRange

func (*Expr) MHS

func (n *Expr) MHS() *Node

func (*Expr) MType

func (n *Expr) MType() *TypeExpr

func (*Expr) Mentions

func (n *Expr) Mentions(o *Expr) bool

func (*Expr) Operator added in v0.2.0

func (n *Expr) Operator() t.ID

func (*Expr) RHS

func (n *Expr) RHS() *Node

func (*Expr) SetConstValue

func (n *Expr) SetConstValue(x *big.Int)

func (*Expr) SetGlobalIdent

func (n *Expr) SetGlobalIdent()

func (*Expr) SetMBounds added in v0.2.0

func (n *Expr) SetMBounds(x interval.IntRange)

func (*Expr) SetMType

func (n *Expr) SetMType(x *TypeExpr)

func (*Expr) StatusQID added in v0.2.0

func (n *Expr) StatusQID() t.QID

func (*Expr) Str added in v0.2.0

func (n *Expr) Str(tm *t.Map) string

Str returns a string form of n.

func (*Expr) SubExprHasEffect added in v0.2.0

func (n *Expr) SubExprHasEffect() bool

type Field

type Field Node

Field is a "name : type" struct field:

  • FlagsPrivateData is the initializer need not explicitly memset to zero.
  • ID2: name
  • LHS: <TypeExpr>

func NewField

func NewField(flags Flags, name t.ID, xType *TypeExpr) *Field

func (*Field) AsNode added in v0.2.0

func (n *Field) AsNode() *Node

func (*Field) Name

func (n *Field) Name() t.ID

func (*Field) PrivateData added in v0.2.0

func (n *Field) PrivateData() bool

func (*Field) XType

func (n *Field) XType() *TypeExpr

type File

type File Node

File is a file of source code:

  • List0: <Const|Func|Status|Struct|Use> top-level declarations

func NewFile

func NewFile(filename string, topLevelDecls []*Node) *File

func (*File) AsNode added in v0.2.0

func (n *File) AsNode() *Node

func (*File) Filename

func (n *File) Filename() string

func (*File) TopLevelDecls

func (n *File) TopLevelDecls() []*Node

type Flags

type Flags uint32

func (Flags) AsEffect added in v0.2.0

func (f Flags) AsEffect() Effect

type Func

type Func Node

Func is "func ID2.ID0(LHS)(RHS) { List2 }":

  • FlagsPublic is "pub" vs "pri"
  • ID0: funcName
  • ID1: <0|receiverPkg> (set by calling SetPackage)
  • ID2: <0|receiverName>
  • LHS: <Struct> in-parameters
  • RHS: <Struct> out-parameters
  • List1: <Assert> asserts
  • List2: <Statement> body

Statement means one of:

  • Assert
  • Assign
  • IOBind
  • If
  • Iterate
  • Jump
  • Ret
  • Var
  • While

func NewFunc

func NewFunc(flags Flags, filename string, line uint32, receiverName t.ID, funcName t.ID, in *Struct, out *TypeExpr, asserts []*Node, body []*Node) *Func

func (*Func) AsNode added in v0.2.0

func (n *Func) AsNode() *Node

func (*Func) Asserts

func (n *Func) Asserts() []*Node

func (*Func) Body

func (n *Func) Body() []*Node

func (*Func) Effect added in v0.2.0

func (n *Func) Effect() Effect

func (*Func) Filename

func (n *Func) Filename() string

func (*Func) FuncName added in v0.2.0

func (n *Func) FuncName() t.ID

func (*Func) In

func (n *Func) In() *Struct

func (*Func) Line

func (n *Func) Line() uint32

func (*Func) Out

func (n *Func) Out() *TypeExpr

func (*Func) Public

func (n *Func) Public() bool

func (*Func) QQID added in v0.2.0

func (n *Func) QQID() t.QQID

func (*Func) Receiver

func (n *Func) Receiver() t.QID

type IOBind added in v0.2.0

type IOBind Node

IOBind is "io_bind (io:LHS, data:MHS) { List2 }" or "io_limit (io:LHS, limit:MHS) { List2 }":

  • ID0: <IDIOBind|IDIOLimit>
  • LHS: <Expr>
  • MHS: <Expr>
  • List2: <Statement> body

func NewIOBind added in v0.2.0

func NewIOBind(keyword t.ID, io *Expr, arg1 *Expr, body []*Node) *IOBind

func (*IOBind) Arg1 added in v0.2.0

func (n *IOBind) Arg1() *Expr

func (*IOBind) AsNode added in v0.2.0

func (n *IOBind) AsNode() *Node

func (*IOBind) Body added in v0.2.0

func (n *IOBind) Body() []*Node

func (*IOBind) IO added in v0.2.0

func (n *IOBind) IO() *Expr

func (*IOBind) Keyword added in v0.2.0

func (n *IOBind) Keyword() t.ID

type If

type If Node

If is "if MHS { List2 } else RHS" or "if MHS { List2 } else { List1 }":

  • MHS: <Expr>
  • RHS: <nil|If>
  • List1: <Statement> if-false body
  • List2: <Statement> if-true body

func NewIf

func NewIf(condition *Expr, bodyIfTrue []*Node, bodyIfFalse []*Node, elseIf *If) *If

func (*If) AsNode added in v0.2.0

func (n *If) AsNode() *Node

func (*If) BodyIfFalse

func (n *If) BodyIfFalse() []*Node

func (*If) BodyIfTrue

func (n *If) BodyIfTrue() []*Node

func (*If) Condition

func (n *If) Condition() *Expr

func (*If) ElseIf

func (n *If) ElseIf() *If

type Iterate

type Iterate Node

Iterate is "iterate.ID1 (assigns)(length:ID2, unroll:ID0), List1 { List2 } else RHS":

  • FlagsHasBreak is the iterate has an explicit break
  • FlagsHasContinue is the iterate has an explicit continue
  • ID0: unroll
  • ID1: <0|label>
  • ID2: length
  • RHS: <nil|Iterate>
  • List0: <Assign> assigns
  • List1: <Assert> asserts
  • List2: <Statement> body

func NewIterate

func NewIterate(label t.ID, assigns []*Node, length t.ID, unroll t.ID, asserts []*Node, body []*Node, elseIterate *Iterate) *Iterate

func (*Iterate) AsNode added in v0.2.0

func (n *Iterate) AsNode() *Node

func (*Iterate) Asserts

func (n *Iterate) Asserts() []*Node

func (*Iterate) Assigns added in v0.2.0

func (n *Iterate) Assigns() []*Node

func (*Iterate) Body

func (n *Iterate) Body() []*Node

func (*Iterate) ElseIterate added in v0.2.0

func (n *Iterate) ElseIterate() *Iterate

func (*Iterate) HasBreak

func (n *Iterate) HasBreak() bool

func (*Iterate) HasContinue

func (n *Iterate) HasContinue() bool

func (*Iterate) Label

func (n *Iterate) Label() t.ID

func (*Iterate) Length added in v0.2.0

func (n *Iterate) Length() t.ID

func (*Iterate) SetHasBreak

func (n *Iterate) SetHasBreak()

func (*Iterate) SetHasContinue

func (n *Iterate) SetHasContinue()

func (*Iterate) Unroll added in v0.2.0

func (n *Iterate) Unroll() t.ID

type Jump

type Jump Node

Jump is "break" or "continue", with an optional label, "break.label":

  • ID0: <IDBreak|IDContinue>
  • ID1: <0|label>

func NewJump

func NewJump(keyword t.ID, label t.ID) *Jump

func (*Jump) AsNode added in v0.2.0

func (n *Jump) AsNode() *Node

func (*Jump) JumpTarget

func (n *Jump) JumpTarget() Loop

func (*Jump) Keyword

func (n *Jump) Keyword() t.ID

func (*Jump) Label

func (n *Jump) Label() t.ID

func (*Jump) SetJumpTarget

func (n *Jump) SetJumpTarget(o Loop)

type Kind

type Kind uint32

Kind is what kind of node it is. For example, a top-level func or a numeric constant. Kind is different from Type; the latter is used for type-checking in the programming language sense.

func (Kind) String

func (k Kind) String() string

type Loop

type Loop interface {
	AsNode() *Node
	HasBreak() bool
	HasContinue() bool
	Label() t.ID
	Asserts() []*Node
	Body() []*Node
	SetHasBreak()
	SetHasContinue()
}

type Node

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

func (*Node) AsArg added in v0.2.0

func (n *Node) AsArg() *Arg

func (*Node) AsAssert added in v0.2.0

func (n *Node) AsAssert() *Assert

func (*Node) AsAssign added in v0.2.0

func (n *Node) AsAssign() *Assign

func (*Node) AsConst added in v0.2.0

func (n *Node) AsConst() *Const

func (*Node) AsExpr added in v0.2.0

func (n *Node) AsExpr() *Expr

func (*Node) AsField added in v0.2.0

func (n *Node) AsField() *Field

func (*Node) AsFile added in v0.2.0

func (n *Node) AsFile() *File

func (*Node) AsFunc added in v0.2.0

func (n *Node) AsFunc() *Func

func (*Node) AsIOBind added in v0.2.0

func (n *Node) AsIOBind() *IOBind

func (*Node) AsIf added in v0.2.0

func (n *Node) AsIf() *If

func (*Node) AsIterate added in v0.2.0

func (n *Node) AsIterate() *Iterate

func (*Node) AsJump added in v0.2.0

func (n *Node) AsJump() *Jump

func (*Node) AsRaw added in v0.2.0

func (n *Node) AsRaw() *Raw

func (*Node) AsRet added in v0.2.0

func (n *Node) AsRet() *Ret

func (*Node) AsStatus added in v0.2.0

func (n *Node) AsStatus() *Status

func (*Node) AsStruct added in v0.2.0

func (n *Node) AsStruct() *Struct

func (*Node) AsTypeExpr added in v0.2.0

func (n *Node) AsTypeExpr() *TypeExpr

func (*Node) AsUse added in v0.2.0

func (n *Node) AsUse() *Use

func (*Node) AsVar added in v0.2.0

func (n *Node) AsVar() *Var

func (*Node) AsWhile added in v0.2.0

func (n *Node) AsWhile() *While

func (*Node) Kind

func (n *Node) Kind() Kind

func (*Node) MBounds added in v0.2.0

func (n *Node) MBounds() interval.IntRange

func (*Node) MType added in v0.2.0

func (n *Node) MType() *TypeExpr

func (*Node) SetMBounds added in v0.2.0

func (n *Node) SetMBounds(x interval.IntRange)

func (*Node) SetMType added in v0.2.0

func (n *Node) SetMType(x *TypeExpr)

func (*Node) Walk

func (n *Node) Walk(f func(*Node) error) error

type Raw

type Raw Node

func (*Raw) AsNode added in v0.2.0

func (n *Raw) AsNode() *Node

func (*Raw) FilenameLine

func (n *Raw) FilenameLine() (string, uint32)

func (*Raw) Flags

func (n *Raw) Flags() Flags

func (*Raw) SetFilenameLine

func (n *Raw) SetFilenameLine(f string, l uint32)

func (*Raw) SetPackage added in v0.2.0

func (n *Raw) SetPackage(tm *t.Map, pkg t.ID) error

func (*Raw) SubLists

func (n *Raw) SubLists() [3][]*Node

func (*Raw) SubNodes

func (n *Raw) SubNodes() [3]*Node

type Ret added in v0.2.0

type Ret Node

Ret is "return LHS" or "yield LHS":

  • FlagsReturnsError LHS is an error status
  • ID0: <IDReturn|IDYield>
  • LHS: <Expr>

func NewRet added in v0.2.0

func NewRet(keyword t.ID, value *Expr) *Ret

func (*Ret) AsNode added in v0.2.0

func (n *Ret) AsNode() *Node

func (*Ret) Keyword added in v0.2.0

func (n *Ret) Keyword() t.ID

func (*Ret) RetsError added in v0.2.0

func (n *Ret) RetsError() bool

func (*Ret) SetRetsError added in v0.2.0

func (n *Ret) SetRetsError()

func (*Ret) Value added in v0.2.0

func (n *Ret) Value() *Expr

type Status

type Status Node

Status is "error (RHS) ID2" or "suspension (RHS) ID2":

  • FlagsPublic is "pub" vs "pri"
  • ID1: <0|pkg> (set by calling SetPackage)
  • ID2: message

func NewStatus

func NewStatus(flags Flags, filename string, line uint32, message t.ID) *Status

func (*Status) AsNode added in v0.2.0

func (n *Status) AsNode() *Node

func (*Status) Filename

func (n *Status) Filename() string

func (*Status) Line

func (n *Status) Line() uint32

func (*Status) Public

func (n *Status) Public() bool

func (*Status) QID added in v0.2.0

func (n *Status) QID() t.QID

type Struct

type Struct Node

Struct is "struct ID2(List0)" or "struct ID2?(List0)":

  • FlagsPublic is "pub" vs "pri"
  • FlagsClassy is "ID2" vs "ID2?"
  • ID1: <0|pkg> (set by calling SetPackage)
  • ID2: name
  • List0: <Field> fields

The question mark indicates a classy struct - one that supports methods, especially coroutines.

func NewStruct

func NewStruct(flags Flags, filename string, line uint32, name t.ID, fields []*Node) *Struct

func TopologicalSortStructs

func TopologicalSortStructs(ns []*Struct) (sorted []*Struct, ok bool)

func (*Struct) AsNode added in v0.2.0

func (n *Struct) AsNode() *Node

func (*Struct) Classy added in v0.2.0

func (n *Struct) Classy() bool

func (*Struct) Fields

func (n *Struct) Fields() []*Node

func (*Struct) Filename

func (n *Struct) Filename() string

func (*Struct) Line

func (n *Struct) Line() uint32

func (*Struct) Public

func (n *Struct) Public() bool

func (*Struct) QID added in v0.2.0

func (n *Struct) QID() t.QID

type TypeExpr

type TypeExpr Node

TypeExpr is a type expression, such as "base.u32", "base.u32[..= 8]", "foo", "pkg.bar", "ptr T", "array[8] T", "slice T" or "table T":

  • ID0: <0|IDArray|IDFunc|IDNptr|IDPtr|IDSlice|IDTable>
  • ID1: <0|pkg>
  • ID2: <0|type name>
  • LHS: <nil|Expr>
  • MHS: <nil|Expr>
  • RHS: <nil|TypeExpr>

An IDNptr or IDPtr ID0 means "nptr RHS" or "ptr RHS". RHS is the inner type.

An IDArray ID0 means "array[LHS] RHS". RHS is the inner type.

An IDSlice ID0 means "slice RHS". RHS is the inner type.

An IDTable ID0 means "table RHS". RHS is the inner type.

An IDFunc ID0 means "func ID2" or "func (LHS).ID2", a function or method type. LHS is the receiver type, which may be nil. If non-nil, it will be a pointee type: "T" instead of "ptr T", "ptr ptr T", etc.

TODO: method effects: "foo" vs "foo!" vs "foo?".

A zero ID0 means a (possibly package-qualified) type like "pkg.foo" or "foo". ID1 is the "pkg" or zero, ID2 is the "foo".

Numeric types can be refined as "foo[LHS ..= MHS]". LHS and MHS are Expr's, possibly nil. For example, the LHS for "base.u32[..= 4095]" is nil.

TODO: struct types, list types, nptr vs ptr.

func NewTypeExpr

func NewTypeExpr(decorator t.ID, pkg t.ID, name t.ID, alenRecvMin *Node, max *Expr, inner *TypeExpr) *TypeExpr

func (*TypeExpr) ArrayLength

func (n *TypeExpr) ArrayLength() *Expr

func (*TypeExpr) AsNode added in v0.2.0

func (n *TypeExpr) AsNode() *Node

func (*TypeExpr) Bounds

func (n *TypeExpr) Bounds() [2]*Expr

func (*TypeExpr) Decorator

func (n *TypeExpr) Decorator() t.ID

func (*TypeExpr) Eq

func (n *TypeExpr) Eq(o *TypeExpr) bool

Eq returns whether n and o are equal.

func (*TypeExpr) EqIgnoringRefinements

func (n *TypeExpr) EqIgnoringRefinements(o *TypeExpr) bool

EqIgnoringRefinements returns whether n and o are equal, ignoring the "[i:j]" in "base.u32[i:j]".

func (*TypeExpr) FuncName added in v0.2.0

func (n *TypeExpr) FuncName() t.ID

func (*TypeExpr) HasPointers

func (n *TypeExpr) HasPointers() bool

func (*TypeExpr) Inner

func (n *TypeExpr) Inner() *TypeExpr

func (*TypeExpr) Innermost

func (n *TypeExpr) Innermost() *TypeExpr

func (*TypeExpr) IsArrayType added in v0.2.0

func (n *TypeExpr) IsArrayType() bool

func (*TypeExpr) IsBool

func (n *TypeExpr) IsBool() bool

func (*TypeExpr) IsIOType added in v0.2.0

func (n *TypeExpr) IsIOType() bool

func (*TypeExpr) IsIdeal

func (n *TypeExpr) IsIdeal() bool

func (*TypeExpr) IsNullptr added in v0.2.0

func (n *TypeExpr) IsNullptr() bool

func (*TypeExpr) IsNumType

func (n *TypeExpr) IsNumType() bool

func (*TypeExpr) IsNumTypeOrIdeal

func (n *TypeExpr) IsNumTypeOrIdeal() bool

func (*TypeExpr) IsPointerType added in v0.2.0

func (n *TypeExpr) IsPointerType() bool

func (*TypeExpr) IsRefined

func (n *TypeExpr) IsRefined() bool

func (*TypeExpr) IsSliceType added in v0.2.0

func (n *TypeExpr) IsSliceType() bool

func (*TypeExpr) IsStatus added in v0.2.0

func (n *TypeExpr) IsStatus() bool

func (*TypeExpr) IsTableType added in v0.2.0

func (n *TypeExpr) IsTableType() bool

func (*TypeExpr) IsUnsignedInteger

func (n *TypeExpr) IsUnsignedInteger() bool

func (*TypeExpr) Max

func (n *TypeExpr) Max() *Expr

func (*TypeExpr) Min

func (n *TypeExpr) Min() *Expr

func (*TypeExpr) Pointee added in v0.2.0

func (n *TypeExpr) Pointee() *TypeExpr

func (*TypeExpr) QID added in v0.2.0

func (n *TypeExpr) QID() t.QID

func (*TypeExpr) Receiver added in v0.2.0

func (n *TypeExpr) Receiver() *TypeExpr

func (*TypeExpr) Str added in v0.2.0

func (n *TypeExpr) Str(tm *t.Map) string

Str returns a string form of n.

func (*TypeExpr) Unrefined

func (n *TypeExpr) Unrefined() *TypeExpr

type Use

type Use Node

Use is "use ID2":

  • ID2: <string literal> package path

func NewUse

func NewUse(filename string, line uint32, path t.ID) *Use

func (*Use) AsNode added in v0.2.0

func (n *Use) AsNode() *Node

func (*Use) Filename

func (n *Use) Filename() string

func (*Use) Line

func (n *Use) Line() uint32

func (*Use) Path

func (n *Use) Path() t.ID

type Var

type Var Node

Var is "var ID2 LHS":

  • ID2: name
  • LHS: <TypeExpr>

func NewVar

func NewVar(name t.ID, xType *TypeExpr) *Var

func (*Var) AsNode added in v0.2.0

func (n *Var) AsNode() *Node

func (*Var) Name

func (n *Var) Name() t.ID

func (*Var) XType

func (n *Var) XType() *TypeExpr

type While

type While Node

While is "while.ID1 MHS, List1 { List2 }":

  • FlagsHasBreak is the while has an explicit break
  • FlagsHasContinue is the while has an explicit continue
  • ID1: <0|label>
  • MHS: <Expr>
  • List1: <Assert> asserts
  • List2: <Statement> body

TODO: should we be able to unroll while loops too?

func NewWhile

func NewWhile(label t.ID, condition *Expr, asserts []*Node, body []*Node) *While

func (*While) AsNode added in v0.2.0

func (n *While) AsNode() *Node

func (*While) Asserts

func (n *While) Asserts() []*Node

func (*While) Body

func (n *While) Body() []*Node

func (*While) Condition

func (n *While) Condition() *Expr

func (*While) HasBreak

func (n *While) HasBreak() bool

func (*While) HasContinue

func (n *While) HasContinue() bool

func (*While) Label

func (n *While) Label() t.ID

func (*While) SetHasBreak

func (n *While) SetHasBreak()

func (*While) SetHasContinue

func (n *While) SetHasContinue()

Jump to

Keyboard shortcuts

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