ast

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package ast defines types used by the Elk parser.

All the nodes of the Abstract Syntax Tree constructed by the Elk parser are defined in this package.

Index

Constants

View Source
const (
	METHOD_ABSTRACT_FLAG bitfield.BitFlag8 = 1 << iota
	METHOD_SEALED_FLAG
	METHOD_GENERATOR_FLAG
	METHOD_ASYNC_FLAG
	METHOD_OVERLOAD_FLAG
)

Variables

View Source
var IdentifierRegexp = regexp.MustCompile(`^\p{Ll}[\p{L}\p{N}_]*$`)
View Source
var PrefixedIdentifierRegexp = regexp.MustCompile(`^[\p{L}\p{N}_]+$`)
View Source
var PrivateConstantRegexp = regexp.MustCompile(`^_\p{Lu}[\p{L}\p{N}_]*$`)
View Source
var PrivateIdentifierRegexp = regexp.MustCompile(`^_[\p{L}\p{N}_]*$`)
View Source
var PublicConstantRegexp = regexp.MustCompile(`^\p{Lu}[\p{L}\p{N}_]*$`)

Functions

func ExpressionPrecedence

func ExpressionPrecedence(expr ExpressionNode) uint8

func IdentifierToString

func IdentifierToString(ident IdentifierNode) string

func IsComplexConstant

func IsComplexConstant(node Node) bool

Check whether the node is a complex constant.

func IsConstant

func IsConstant(node Node) bool

Check whether the node is a constant.

func IsNamedRestParam

func IsNamedRestParam(p ParameterNode) bool

checks whether the given parameter is a named rest parameter.

func IsPositionalRestParam

func IsPositionalRestParam(p ParameterNode) bool

checks whether the given parameter is a positional rest parameter.

func IsValidAssignmentTarget

func IsValidAssignmentTarget(node Node) bool

Check whether the node can be used as a left value in an assignment expression.

func IsValidDeclarationTarget

func IsValidDeclarationTarget(node Node) bool

Check whether the node can be used as a left value in a variable/constant declaration.

func IsValidPipeExpressionTarget

func IsValidPipeExpressionTarget(node Node) bool

Check whether the node is a valid right operand of the pipe operator `|>`.

func IsValidRangePatternElement

func IsValidRangePatternElement(node Node) bool

Check whether the node can be used as a range pattern element.

func Iter

func Iter(node Node) iter.Seq[Node]

func MethodNameIsSetter

func MethodNameIsSetter(methodNameNode IdentifierNode) bool

Whether the method is a setter.

func MethodNameIsSubscriptSetter

func MethodNameIsSubscriptSetter(methodNameNode IdentifierNode) bool

Whether the method is a setter.

func NewNodeIterator

func NewNodeIterator(node Node) *value.ArrayTupleIterator

func PatternDeclaresVariables

func PatternDeclaresVariables(pattern PatternNode) bool

func PatternPrecedence

func PatternPrecedence(expr PatternNode) uint8

func SpliceSlice

func SpliceSlice[N Node](slice []N, loc *position.Location, args *[]Node, unquote bool) []N

func StatementPrecedence

func StatementPrecedence(stmt StatementNode) uint8

func Traverse

func Traverse(node Node, enter func(node, parent Node) TraverseOption, leave func(node, parent Node) TraverseOption)

func TypePrecedence

func TypePrecedence(expr TypeNode) uint8

Types

type AliasDeclarationEntry

type AliasDeclarationEntry struct {
	NodeBase
	NewName IdentifierNode
	OldName IdentifierNode
}

A single alias entry eg. `new_name old_name`

func NewAliasDeclarationEntry

func NewAliasDeclarationEntry(loc *position.Location, newName, oldName IdentifierNode) *AliasDeclarationEntry

Create an alias alias entry eg. `new_name old_name`

func (*AliasDeclarationEntry) Class

func (*AliasDeclarationEntry) Class() *value.Class

func (*AliasDeclarationEntry) DirectClass

func (*AliasDeclarationEntry) DirectClass() *value.Class

func (*AliasDeclarationEntry) Equal

func (n *AliasDeclarationEntry) Equal(other value.Value) bool

func (*AliasDeclarationEntry) Error

func (n *AliasDeclarationEntry) Error() string

func (*AliasDeclarationEntry) Inspect

func (n *AliasDeclarationEntry) Inspect() string

func (*AliasDeclarationEntry) IsStatic

func (*AliasDeclarationEntry) IsStatic() bool

func (*AliasDeclarationEntry) MacroType

func (*AliasDeclarationEntry) String

func (n *AliasDeclarationEntry) String() string

type AliasDeclarationNode

type AliasDeclarationNode struct {
	TypedNodeBase
	Entries []*AliasDeclarationEntry
}

Represents a new alias declaration eg. `alias push append, add plus`

func NewAliasDeclarationNode

func NewAliasDeclarationNode(loc *position.Location, entries []*AliasDeclarationEntry) *AliasDeclarationNode

Create an alias declaration node eg. `alias push append, add plus`

func (*AliasDeclarationNode) Class

func (*AliasDeclarationNode) Class() *value.Class

func (*AliasDeclarationNode) DirectClass

func (*AliasDeclarationNode) DirectClass() *value.Class

func (*AliasDeclarationNode) Equal

func (n *AliasDeclarationNode) Equal(other value.Value) bool

func (*AliasDeclarationNode) Error

func (n *AliasDeclarationNode) Error() string

func (*AliasDeclarationNode) Inspect

func (n *AliasDeclarationNode) Inspect() string

func (*AliasDeclarationNode) IsStatic

func (*AliasDeclarationNode) IsStatic() bool

func (*AliasDeclarationNode) MacroType

func (*AliasDeclarationNode) String

func (n *AliasDeclarationNode) String() string

type AnyTypeNode

type AnyTypeNode struct {
	NodeBase
}

`any` type.

func NewAnyTypeNode

func NewAnyTypeNode(loc *position.Location) *AnyTypeNode

Create a new `any` type node.

func (*AnyTypeNode) Class

func (*AnyTypeNode) Class() *value.Class

func (*AnyTypeNode) DirectClass

func (*AnyTypeNode) DirectClass() *value.Class

func (*AnyTypeNode) Equal

func (n *AnyTypeNode) Equal(other value.Value) bool

func (*AnyTypeNode) Error

func (n *AnyTypeNode) Error() string

func (*AnyTypeNode) Inspect

func (n *AnyTypeNode) Inspect() string

func (*AnyTypeNode) IsStatic

func (*AnyTypeNode) IsStatic() bool

func (*AnyTypeNode) MacroType

func (n *AnyTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*AnyTypeNode) String

func (n *AnyTypeNode) String() string

func (*AnyTypeNode) Type

func (*AnyTypeNode) Type(globalEnv *types.GlobalEnvironment) types.Type

type ArrayListLiteralNode

type ArrayListLiteralNode struct {
	TypedNodeBase
	Elements []ExpressionNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a ArrayList literal eg. `[1, 5, -6]`

func NewArrayListLiteralNode

func NewArrayListLiteralNode(loc *position.Location, elements []ExpressionNode, capacity ExpressionNode) *ArrayListLiteralNode

Create a ArrayList literal node eg. `[1, 5, -6]`

func (*ArrayListLiteralNode) Class

func (*ArrayListLiteralNode) Class() *value.Class

func (*ArrayListLiteralNode) DirectClass

func (*ArrayListLiteralNode) DirectClass() *value.Class

func (*ArrayListLiteralNode) Equal

func (n *ArrayListLiteralNode) Equal(other value.Value) bool

func (*ArrayListLiteralNode) Error

func (n *ArrayListLiteralNode) Error() string

func (*ArrayListLiteralNode) Inspect

func (n *ArrayListLiteralNode) Inspect() string

func (*ArrayListLiteralNode) IsStatic

func (l *ArrayListLiteralNode) IsStatic() bool

func (*ArrayListLiteralNode) MacroType

func (*ArrayListLiteralNode) String

func (n *ArrayListLiteralNode) String() string

type ArrayTupleLiteralNode

type ArrayTupleLiteralNode struct {
	TypedNodeBase
	Elements []ExpressionNode
	// contains filtered or unexported fields
}

Represents a ArrayTuple literal eg. `%[1, 5, -6]`

func NewArrayTupleLiteralNode

func NewArrayTupleLiteralNode(loc *position.Location, elements []ExpressionNode) *ArrayTupleLiteralNode

Create a ArrayTuple literal node eg. `%[1, 5, -6]`

func (*ArrayTupleLiteralNode) Class

func (*ArrayTupleLiteralNode) Class() *value.Class

func (*ArrayTupleLiteralNode) DirectClass

func (*ArrayTupleLiteralNode) DirectClass() *value.Class

func (*ArrayTupleLiteralNode) Equal

func (n *ArrayTupleLiteralNode) Equal(other value.Value) bool

func (*ArrayTupleLiteralNode) Error

func (n *ArrayTupleLiteralNode) Error() string

func (*ArrayTupleLiteralNode) Inspect

func (n *ArrayTupleLiteralNode) Inspect() string

func (*ArrayTupleLiteralNode) IsStatic

func (t *ArrayTupleLiteralNode) IsStatic() bool

func (*ArrayTupleLiteralNode) MacroType

func (*ArrayTupleLiteralNode) String

func (n *ArrayTupleLiteralNode) String() string

type AsExpressionNode

type AsExpressionNode struct {
	TypedNodeBase
	Value       ExpressionNode
	RuntimeType ComplexConstantNode
}

Represents an as type downcast eg. `foo as String`

func NewAsExpressionNode

func NewAsExpressionNode(loc *position.Location, val ExpressionNode, runtimeType ComplexConstantNode) *AsExpressionNode

Create a new private constant node eg. `_Foo`.

func (*AsExpressionNode) Class

func (*AsExpressionNode) Class() *value.Class

func (*AsExpressionNode) DirectClass

func (*AsExpressionNode) DirectClass() *value.Class

func (*AsExpressionNode) Equal

func (n *AsExpressionNode) Equal(other value.Value) bool

func (*AsExpressionNode) Error

func (n *AsExpressionNode) Error() string

func (*AsExpressionNode) Inspect

func (n *AsExpressionNode) Inspect() string

func (*AsExpressionNode) IsStatic

func (*AsExpressionNode) IsStatic() bool

func (*AsExpressionNode) MacroType

func (n *AsExpressionNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*AsExpressionNode) String

func (n *AsExpressionNode) String() string

type AsPatternNode

type AsPatternNode struct {
	NodeBase
	Pattern PatternNode
	Name    IdentifierNode
}

Represents an as pattern eg. `> 5 && < 20 as foo`

func NewAsPatternNode

func NewAsPatternNode(loc *position.Location, pattern PatternNode, name IdentifierNode) *AsPatternNode

Create an Object pattern node eg. `Foo(foo: 5, bar: a, c)`

func (*AsPatternNode) Class

func (*AsPatternNode) Class() *value.Class

func (*AsPatternNode) DirectClass

func (*AsPatternNode) DirectClass() *value.Class

func (*AsPatternNode) Equal

func (n *AsPatternNode) Equal(other value.Value) bool

func (*AsPatternNode) Error

func (n *AsPatternNode) Error() string

func (*AsPatternNode) Inspect

func (n *AsPatternNode) Inspect() string

func (*AsPatternNode) IsStatic

func (*AsPatternNode) IsStatic() bool

func (*AsPatternNode) MacroType

func (n *AsPatternNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*AsPatternNode) String

func (n *AsPatternNode) String() string

type AssignmentExpressionNode

type AssignmentExpressionNode struct {
	TypedNodeBase
	Op    *token.Token   // operator
	Left  ExpressionNode // left hand side
	Right ExpressionNode // right hand side
}

Assignment with the specified operator.

func NewAssignmentExpressionNode

func NewAssignmentExpressionNode(loc *position.Location, op *token.Token, left, right ExpressionNode) *AssignmentExpressionNode

Create a new assignment expression node eg. `foo = 3`

func (*AssignmentExpressionNode) Class

func (*AssignmentExpressionNode) DirectClass

func (*AssignmentExpressionNode) DirectClass() *value.Class

func (*AssignmentExpressionNode) Equal

func (n *AssignmentExpressionNode) Equal(other value.Value) bool

func (*AssignmentExpressionNode) Error

func (p *AssignmentExpressionNode) Error() string

func (*AssignmentExpressionNode) Inspect

func (n *AssignmentExpressionNode) Inspect() string

func (*AssignmentExpressionNode) IsStatic

func (*AssignmentExpressionNode) IsStatic() bool

func (*AssignmentExpressionNode) MacroType

func (*AssignmentExpressionNode) String

func (n *AssignmentExpressionNode) String() string

type Associativity

type Associativity uint8
const (
	NON_ASSOCIATIVE Associativity = iota
	LEFT_ASSOCIATIVE
	RIGHT_ASSOCIATIVE
)

func ExpressionAssociativity

func ExpressionAssociativity(expr ExpressionNode) Associativity

func PatternAssociativity

func PatternAssociativity(expr PatternNode) Associativity

func TypeAssociativity

func TypeAssociativity(expr TypeNode) Associativity

type AttrDeclarationNode

type AttrDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Entries []ParameterNode
}

Represents a new setter declaration eg. `attr foo: String`

func NewAttrDeclarationNode

func NewAttrDeclarationNode(loc *position.Location, docComment string, entries []ParameterNode) *AttrDeclarationNode

Create an attribute declaration node eg. `attr foo: String`

func (*AttrDeclarationNode) Class

func (*AttrDeclarationNode) Class() *value.Class

func (*AttrDeclarationNode) DirectClass

func (*AttrDeclarationNode) DirectClass() *value.Class

func (*AttrDeclarationNode) Equal

func (n *AttrDeclarationNode) Equal(other value.Value) bool

func (*AttrDeclarationNode) Error

func (n *AttrDeclarationNode) Error() string

func (*AttrDeclarationNode) Inspect

func (n *AttrDeclarationNode) Inspect() string

func (*AttrDeclarationNode) IsStatic

func (*AttrDeclarationNode) IsStatic() bool

func (*AttrDeclarationNode) MacroType

func (*AttrDeclarationNode) String

func (n *AttrDeclarationNode) String() string

type AttributeAccessNode

type AttributeAccessNode struct {
	TypedNodeBase
	Receiver      ExpressionNode
	AttributeName IdentifierNode
}

Represents attribute access eg. `foo.bar`

func NewAttributeAccessNode

func NewAttributeAccessNode(loc *position.Location, recv ExpressionNode, attrName IdentifierNode) *AttributeAccessNode

Create an attribute access node eg. `foo.bar`

func (*AttributeAccessNode) Class

func (*AttributeAccessNode) Class() *value.Class

func (*AttributeAccessNode) DirectClass

func (*AttributeAccessNode) DirectClass() *value.Class

func (*AttributeAccessNode) Equal

func (n *AttributeAccessNode) Equal(other value.Value) bool

func (*AttributeAccessNode) Error

func (n *AttributeAccessNode) Error() string

func (*AttributeAccessNode) Inspect

func (n *AttributeAccessNode) Inspect() string

func (*AttributeAccessNode) IsStatic

func (*AttributeAccessNode) IsStatic() bool

func (*AttributeAccessNode) MacroType

func (*AttributeAccessNode) String

func (n *AttributeAccessNode) String() string

type AttributeParameterNode

type AttributeParameterNode struct {
	TypedNodeBase
	Name        IdentifierNode // name of the variable
	TypeNode    TypeNode       // type of the variable
	Initialiser ExpressionNode // value assigned to the variable
}

Represents an attribute declaration in getters, setters and accessors eg. `foo: String`

func NewAttributeParameterNode

func NewAttributeParameterNode(loc *position.Location, name IdentifierNode, typ TypeNode, init ExpressionNode) *AttributeParameterNode

Create a new attribute declaration in getters, setters and accessors eg. `foo: String`

func (*AttributeParameterNode) Class

func (*AttributeParameterNode) DirectClass

func (*AttributeParameterNode) DirectClass() *value.Class

func (*AttributeParameterNode) Equal

func (n *AttributeParameterNode) Equal(other value.Value) bool

func (*AttributeParameterNode) Error

func (n *AttributeParameterNode) Error() string

func (*AttributeParameterNode) Inspect

func (n *AttributeParameterNode) Inspect() string

func (*AttributeParameterNode) IsOptional

func (a *AttributeParameterNode) IsOptional() bool

func (*AttributeParameterNode) IsStatic

func (*AttributeParameterNode) IsStatic() bool

func (*AttributeParameterNode) MacroType

func (*AttributeParameterNode) String

func (n *AttributeParameterNode) String() string

type AwaitExpressionNode

type AwaitExpressionNode struct {
	TypedNodeBase
	Value ExpressionNode
	Sync  bool
}

Represents an `await` expression eg. `await foo()`

func NewAwaitExpressionNode

func NewAwaitExpressionNode(loc *position.Location, val ExpressionNode, sync bool) *AwaitExpressionNode

Create a new `await` expression node eg. `await foo()`

func (*AwaitExpressionNode) Class

func (*AwaitExpressionNode) Class() *value.Class

func (*AwaitExpressionNode) DirectClass

func (*AwaitExpressionNode) DirectClass() *value.Class

func (*AwaitExpressionNode) Equal

func (n *AwaitExpressionNode) Equal(other value.Value) bool

func (*AwaitExpressionNode) Error

func (n *AwaitExpressionNode) Error() string

func (*AwaitExpressionNode) Inspect

func (n *AwaitExpressionNode) Inspect() string

func (*AwaitExpressionNode) IsStatic

func (*AwaitExpressionNode) IsStatic() bool

func (*AwaitExpressionNode) MacroType

func (*AwaitExpressionNode) String

func (n *AwaitExpressionNode) String() string

type BigFloatLiteralNode

type BigFloatLiteralNode struct {
	TypedNodeBase
	Value string
}

BigFloat literal eg. `5.2bf`, `.5bf`, `45e20bf`

func NewBigFloatLiteralNode

func NewBigFloatLiteralNode(loc *position.Location, val string) *BigFloatLiteralNode

Create a new BigFloat literal node eg. `5.2bf`, `.5bf`, `45e20bf`

func (*BigFloatLiteralNode) Class

func (*BigFloatLiteralNode) Class() *value.Class

func (*BigFloatLiteralNode) DirectClass

func (*BigFloatLiteralNode) DirectClass() *value.Class

func (*BigFloatLiteralNode) Equal

func (n *BigFloatLiteralNode) Equal(other value.Value) bool

func (*BigFloatLiteralNode) Error

func (n *BigFloatLiteralNode) Error() string

func (*BigFloatLiteralNode) Inspect

func (n *BigFloatLiteralNode) Inspect() string

func (*BigFloatLiteralNode) IsStatic

func (*BigFloatLiteralNode) IsStatic() bool

func (*BigFloatLiteralNode) MacroType

func (*BigFloatLiteralNode) String

func (n *BigFloatLiteralNode) String() string

type BinArrayListLiteralNode

type BinArrayListLiteralNode struct {
	TypedNodeBase
	Elements []IntCollectionContentNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a bin ArrayList literal eg. `\b[11 10]`

func NewBinArrayListLiteralNode

func NewBinArrayListLiteralNode(loc *position.Location, elements []IntCollectionContentNode, capacity ExpressionNode) *BinArrayListLiteralNode

Create a bin ArrayList literal node eg. `\b[11 10]`

func (*BinArrayListLiteralNode) Class

func (*BinArrayListLiteralNode) DirectClass

func (*BinArrayListLiteralNode) DirectClass() *value.Class

func (*BinArrayListLiteralNode) Equal

func (n *BinArrayListLiteralNode) Equal(other value.Value) bool

func (*BinArrayListLiteralNode) Error

func (n *BinArrayListLiteralNode) Error() string

func (*BinArrayListLiteralNode) Inspect

func (n *BinArrayListLiteralNode) Inspect() string

func (*BinArrayListLiteralNode) IsStatic

func (b *BinArrayListLiteralNode) IsStatic() bool

func (*BinArrayListLiteralNode) MacroType

func (*BinArrayListLiteralNode) String

func (n *BinArrayListLiteralNode) String() string

type BinArrayTupleLiteralNode

type BinArrayTupleLiteralNode struct {
	TypedNodeBase
	Elements []IntCollectionContentNode
}

Represents a bin ArrayTuple literal eg. `%b[11 10]`

func NewBinArrayTupleLiteralNode

func NewBinArrayTupleLiteralNode(loc *position.Location, elements []IntCollectionContentNode) *BinArrayTupleLiteralNode

Create a bin ArrayList literal node eg. `%b[11 10]`

func (*BinArrayTupleLiteralNode) Class

func (*BinArrayTupleLiteralNode) DirectClass

func (*BinArrayTupleLiteralNode) DirectClass() *value.Class

func (*BinArrayTupleLiteralNode) Equal

func (n *BinArrayTupleLiteralNode) Equal(other value.Value) bool

func (*BinArrayTupleLiteralNode) Error

func (n *BinArrayTupleLiteralNode) Error() string

func (*BinArrayTupleLiteralNode) Inspect

func (n *BinArrayTupleLiteralNode) Inspect() string

func (*BinArrayTupleLiteralNode) IsStatic

func (*BinArrayTupleLiteralNode) IsStatic() bool

func (*BinArrayTupleLiteralNode) MacroType

func (*BinArrayTupleLiteralNode) String

func (n *BinArrayTupleLiteralNode) String() string

type BinHashSetLiteralNode

type BinHashSetLiteralNode struct {
	TypedNodeBase
	Elements []IntCollectionContentNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a bin HashSet literal eg. `^b[11 10]`

func NewBinHashSetLiteralNode

func NewBinHashSetLiteralNode(loc *position.Location, elements []IntCollectionContentNode, capacity ExpressionNode) *BinHashSetLiteralNode

Create a bin HashSet literal node eg. `^b[11 10]`

func (*BinHashSetLiteralNode) Class

func (*BinHashSetLiteralNode) Class() *value.Class

func (*BinHashSetLiteralNode) DirectClass

func (*BinHashSetLiteralNode) DirectClass() *value.Class

func (*BinHashSetLiteralNode) Equal

func (n *BinHashSetLiteralNode) Equal(other value.Value) bool

func (*BinHashSetLiteralNode) Error

func (n *BinHashSetLiteralNode) Error() string

func (*BinHashSetLiteralNode) Inspect

func (n *BinHashSetLiteralNode) Inspect() string

func (*BinHashSetLiteralNode) IsStatic

func (b *BinHashSetLiteralNode) IsStatic() bool

func (*BinHashSetLiteralNode) MacroType

func (*BinHashSetLiteralNode) String

func (n *BinHashSetLiteralNode) String() string

type BinaryExpressionNode

type BinaryExpressionNode struct {
	TypedNodeBase
	Op    *token.Token   // operator
	Left  ExpressionNode // left hand side
	Right ExpressionNode // right hand side
	// contains filtered or unexported fields
}

Expression of an operator with two operands eg. `2 + 5`, `foo > bar`

func NewBinaryExpressionNode

func NewBinaryExpressionNode(loc *position.Location, op *token.Token, left, right ExpressionNode) *BinaryExpressionNode

Create a new binary expression node.

func (*BinaryExpressionNode) Class

func (*BinaryExpressionNode) Class() *value.Class

func (*BinaryExpressionNode) DirectClass

func (*BinaryExpressionNode) DirectClass() *value.Class

func (*BinaryExpressionNode) Equal

func (n *BinaryExpressionNode) Equal(other value.Value) bool

func (*BinaryExpressionNode) Error

func (n *BinaryExpressionNode) Error() string

func (*BinaryExpressionNode) Inspect

func (n *BinaryExpressionNode) Inspect() string

func (*BinaryExpressionNode) IsStatic

func (b *BinaryExpressionNode) IsStatic() bool

func (*BinaryExpressionNode) MacroType

func (*BinaryExpressionNode) String

func (n *BinaryExpressionNode) String() string

type BinaryPatternNode

type BinaryPatternNode struct {
	TypedNodeBase
	Op    *token.Token // operator
	Left  PatternNode  // left hand side
	Right PatternNode  // right hand side
}

Pattern with two operands eg. `> 10 && < 50`

func NewBinaryPatternNode

func NewBinaryPatternNode(loc *position.Location, op *token.Token, left, right PatternNode) *BinaryPatternNode

Create a new binary pattern node eg. `> 10 && < 50`

func (*BinaryPatternNode) Class

func (*BinaryPatternNode) Class() *value.Class

func (*BinaryPatternNode) DirectClass

func (*BinaryPatternNode) DirectClass() *value.Class

func (*BinaryPatternNode) Equal

func (n *BinaryPatternNode) Equal(other value.Value) bool

func (*BinaryPatternNode) Error

func (n *BinaryPatternNode) Error() string

func (*BinaryPatternNode) Inspect

func (n *BinaryPatternNode) Inspect() string

func (*BinaryPatternNode) IsStatic

func (*BinaryPatternNode) IsStatic() bool

func (*BinaryPatternNode) MacroType

func (n *BinaryPatternNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*BinaryPatternNode) String

func (n *BinaryPatternNode) String() string

type BinaryTypeNode

type BinaryTypeNode struct {
	TypedNodeBase
	Op    *token.Token // operator
	Left  TypeNode     // left hand side
	Right TypeNode     // right hand side
}

Type expression of an operator with two operands eg. `String | Int`

func NewBinaryTypeNode

func NewBinaryTypeNode(loc *position.Location, op *token.Token, left, right TypeNode) *BinaryTypeNode

Create a new binary type expression node eg. `String | Int`

func (*BinaryTypeNode) Class

func (*BinaryTypeNode) Class() *value.Class

func (*BinaryTypeNode) DirectClass

func (*BinaryTypeNode) DirectClass() *value.Class

func (*BinaryTypeNode) Equal

func (n *BinaryTypeNode) Equal(other value.Value) bool

func (*BinaryTypeNode) Error

func (n *BinaryTypeNode) Error() string

func (*BinaryTypeNode) Inspect

func (n *BinaryTypeNode) Inspect() string

func (*BinaryTypeNode) IsStatic

func (*BinaryTypeNode) IsStatic() bool

func (*BinaryTypeNode) MacroType

func (n *BinaryTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*BinaryTypeNode) String

func (n *BinaryTypeNode) String() string

type BoolLiteralNode

type BoolLiteralNode struct {
	NodeBase
}

`bool` literal.

func NewBoolLiteralNode

func NewBoolLiteralNode(loc *position.Location) *BoolLiteralNode

Create a new `bool` literal node.

func (*BoolLiteralNode) Class

func (*BoolLiteralNode) Class() *value.Class

func (*BoolLiteralNode) DirectClass

func (*BoolLiteralNode) DirectClass() *value.Class

func (*BoolLiteralNode) Equal

func (n *BoolLiteralNode) Equal(other value.Value) bool

func (*BoolLiteralNode) Error

func (n *BoolLiteralNode) Error() string

func (*BoolLiteralNode) Inspect

func (n *BoolLiteralNode) Inspect() string

func (*BoolLiteralNode) IsStatic

func (*BoolLiteralNode) IsStatic() bool

func (*BoolLiteralNode) MacroType

func (n *BoolLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*BoolLiteralNode) String

func (n *BoolLiteralNode) String() string

func (*BoolLiteralNode) Type

func (*BoolLiteralNode) Type(globalEnv *types.GlobalEnvironment) types.Type

type BoxOfExpressionNode

type BoxOfExpressionNode struct {
	TypedNodeBase
	Expression ExpressionNode // right hand side
}

Represents a box of expression eg. `&a`

func NewBoxOfExpressionNode

func NewBoxOfExpressionNode(loc *position.Location, expr ExpressionNode) *BoxOfExpressionNode

Create a new box of expression node eg. `&a`

func (*BoxOfExpressionNode) Class

func (*BoxOfExpressionNode) Class() *value.Class

func (*BoxOfExpressionNode) DirectClass

func (*BoxOfExpressionNode) DirectClass() *value.Class

func (*BoxOfExpressionNode) Equal

func (n *BoxOfExpressionNode) Equal(other value.Value) bool

Equal checks if this node equals the other node.

func (*BoxOfExpressionNode) Error

func (n *BoxOfExpressionNode) Error() string

func (*BoxOfExpressionNode) Inspect

func (n *BoxOfExpressionNode) Inspect() string

func (*BoxOfExpressionNode) IsStatic

func (*BoxOfExpressionNode) IsStatic() bool

func (*BoxOfExpressionNode) MacroType

func (*BoxOfExpressionNode) String

func (n *BoxOfExpressionNode) String() string

String returns the string representation of this node.

type BoxTypeNode

type BoxTypeNode struct {
	TypedNodeBase
	Immutable bool
	TypeNode  TypeNode // right hand side
}

Represents a box type eg. `^Int`, `*Int`

func NewBoxTypeNode

func NewBoxTypeNode(loc *position.Location, typ TypeNode, immutable bool) *BoxTypeNode

Create a new box type node eg. `^Int`

func (*BoxTypeNode) Class

func (*BoxTypeNode) Class() *value.Class

func (*BoxTypeNode) DirectClass

func (*BoxTypeNode) DirectClass() *value.Class

func (*BoxTypeNode) Equal

func (n *BoxTypeNode) Equal(other value.Value) bool

Equal checks if this node equals the other node.

func (*BoxTypeNode) Error

func (n *BoxTypeNode) Error() string

func (*BoxTypeNode) Inspect

func (n *BoxTypeNode) Inspect() string

func (*BoxTypeNode) IsStatic

func (*BoxTypeNode) IsStatic() bool

func (*BoxTypeNode) MacroType

func (n *BoxTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*BoxTypeNode) String

func (n *BoxTypeNode) String() string

String returns the string representation of this node.

type BreakExpressionNode

type BreakExpressionNode struct {
	NodeBase
	Label IdentifierNode
	Value ExpressionNode
}

Represents a `break` expression eg. `break`, `break false`

func NewBreakExpressionNode

func NewBreakExpressionNode(loc *position.Location, label IdentifierNode, val ExpressionNode) *BreakExpressionNode

Create a new `break` expression node eg. `break`

func (*BreakExpressionNode) Class

func (*BreakExpressionNode) Class() *value.Class

func (*BreakExpressionNode) DirectClass

func (*BreakExpressionNode) DirectClass() *value.Class

func (*BreakExpressionNode) Equal

func (n *BreakExpressionNode) Equal(other value.Value) bool

func (*BreakExpressionNode) Error

func (n *BreakExpressionNode) Error() string

func (*BreakExpressionNode) Inspect

func (n *BreakExpressionNode) Inspect() string

func (*BreakExpressionNode) IsStatic

func (*BreakExpressionNode) IsStatic() bool

func (*BreakExpressionNode) MacroType

func (*BreakExpressionNode) String

func (n *BreakExpressionNode) String() string

func (*BreakExpressionNode) Type

type CallNode

type CallNode struct {
	TypedNodeBase
	Receiver            ExpressionNode
	NilSafe             bool
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
}

Represents a method call eg. `'123'.()`

func NewCallNode

func NewCallNode(loc *position.Location, recv ExpressionNode, nilSafe bool, posArgs []ExpressionNode, namedArgs []NamedArgumentNode) *CallNode

Create a method call node eg. `'123'.to_int()`

func (*CallNode) Class

func (*CallNode) Class() *value.Class

func (*CallNode) DirectClass

func (*CallNode) DirectClass() *value.Class

func (*CallNode) Equal

func (n *CallNode) Equal(other value.Value) bool

func (*CallNode) Error

func (n *CallNode) Error() string

func (*CallNode) Inspect

func (n *CallNode) Inspect() string

func (*CallNode) IsStatic

func (*CallNode) IsStatic() bool

func (*CallNode) MacroType

func (n *CallNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*CallNode) String

func (n *CallNode) String() string

type CallableTypeNode

type CallableTypeNode struct {
	TypedNodeBase
	Parameters []ParameterNode // formal parameters of the callable separated by semicolons
	ReturnType TypeNode
	ThrowType  TypeNode
	IsClosure  bool
}

Represents a callable type eg. `|i: Int|: String`

func NewCallableTypeNode

func NewCallableTypeNode(loc *position.Location, params []ParameterNode, retType TypeNode, throwType TypeNode, closure bool) *CallableTypeNode

Create a new closure type node eg. `|i: Int|: String`

func (*CallableTypeNode) Class

func (*CallableTypeNode) Class() *value.Class

func (*CallableTypeNode) DirectClass

func (*CallableTypeNode) DirectClass() *value.Class

func (*CallableTypeNode) Equal

func (n *CallableTypeNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*CallableTypeNode) Error

func (n *CallableTypeNode) Error() string

func (*CallableTypeNode) Inspect

func (n *CallableTypeNode) Inspect() string

func (*CallableTypeNode) IsStatic

func (*CallableTypeNode) IsStatic() bool

func (*CallableTypeNode) MacroType

func (n *CallableTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*CallableTypeNode) String

func (n *CallableTypeNode) String() string

Return a string representation of the node.

type CaseNode

type CaseNode struct {
	NodeBase
	Pattern PatternNode
	Body    []StatementNode
}

Represents a `case` node eg. `case 3 then println("eureka!")`

func NewCaseNode

func NewCaseNode(loc *position.Location, pattern PatternNode, body []StatementNode) *CaseNode

Create a new `case` node

func (*CaseNode) Class

func (*CaseNode) Class() *value.Class

func (*CaseNode) DirectClass

func (*CaseNode) DirectClass() *value.Class

func (*CaseNode) Equal

func (n *CaseNode) Equal(other value.Value) bool

func (*CaseNode) Error

func (n *CaseNode) Error() string

func (*CaseNode) Inspect

func (n *CaseNode) Inspect() string

func (*CaseNode) IsStatic

func (*CaseNode) IsStatic() bool

func (*CaseNode) MacroType

func (n *CaseNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*CaseNode) String

func (n *CaseNode) String() string

type CatchNode

type CatchNode struct {
	NodeBase
	Pattern       PatternNode
	StackTraceVar IdentifierNode
	Body          []StatementNode // do expression body
}

Represents a `catch` eg.

catch SomeError(message)
	print("awesome!")
end

func NewCatchNode

func NewCatchNode(loc *position.Location, pattern PatternNode, stackTraceVar IdentifierNode, body []StatementNode) *CatchNode

Create a new `catch` node eg.

catch SomeError(message)
	print("awesome!")
end

func (*CatchNode) Class

func (*CatchNode) Class() *value.Class

func (*CatchNode) DirectClass

func (*CatchNode) DirectClass() *value.Class

func (*CatchNode) Equal

func (n *CatchNode) Equal(other value.Value) bool

func (*CatchNode) Error

func (n *CatchNode) Error() string

func (*CatchNode) Inspect

func (n *CatchNode) Inspect() string

func (*CatchNode) IsStatic

func (*CatchNode) IsStatic() bool

func (*CatchNode) MacroType

func (n *CatchNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*CatchNode) String

func (n *CatchNode) String() string

type CharLiteralNode

type CharLiteralNode struct {
	TypedNodeBase
	Value rune // value of the string literal
}

Char literal eg. `a`

func NewCharLiteralNode

func NewCharLiteralNode(loc *position.Location, val rune) *CharLiteralNode

Create a new char literal node eg. `c"a"`

func (*CharLiteralNode) Class

func (*CharLiteralNode) Class() *value.Class

func (*CharLiteralNode) DirectClass

func (*CharLiteralNode) DirectClass() *value.Class

func (*CharLiteralNode) Equal

func (n *CharLiteralNode) Equal(other value.Value) bool

func (*CharLiteralNode) Error

func (n *CharLiteralNode) Error() string

func (*CharLiteralNode) Inspect

func (n *CharLiteralNode) Inspect() string

func (*CharLiteralNode) IsStatic

func (*CharLiteralNode) IsStatic() bool

func (*CharLiteralNode) MacroType

func (n *CharLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*CharLiteralNode) String

func (n *CharLiteralNode) String() string

type ClassDeclarationNode

type ClassDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Abstract       bool
	Sealed         bool
	Primitive      bool
	NoInit         bool
	Constant       ExpressionNode      // The constant that will hold the class value
	TypeParameters []TypeParameterNode // Generic type variable definitions
	Superclass     ExpressionNode      // the super/parent class of this class
	Body           []StatementNode     // body of the class
	Bytecode       value.Method
}

Represents a class declaration eg. `class Foo; end`

func NewClassDeclarationNode

func NewClassDeclarationNode(
	loc *position.Location,
	docComment string,
	abstract bool,
	sealed bool,
	primitive bool,
	noinit bool,
	constant ExpressionNode,
	typeParams []TypeParameterNode,
	superclass ExpressionNode,
	body []StatementNode,
) *ClassDeclarationNode

Create a new class declaration node eg. `class Foo; end`

func (*ClassDeclarationNode) Class

func (*ClassDeclarationNode) Class() *value.Class

func (*ClassDeclarationNode) DirectClass

func (*ClassDeclarationNode) DirectClass() *value.Class

func (*ClassDeclarationNode) Equal

func (n *ClassDeclarationNode) Equal(other value.Value) bool

func (*ClassDeclarationNode) Error

func (n *ClassDeclarationNode) Error() string

func (*ClassDeclarationNode) Inspect

func (n *ClassDeclarationNode) Inspect() string

func (*ClassDeclarationNode) IsStatic

func (*ClassDeclarationNode) IsStatic() bool

func (*ClassDeclarationNode) MacroType

func (*ClassDeclarationNode) SkipTypechecking

func (*ClassDeclarationNode) SkipTypechecking() bool

func (*ClassDeclarationNode) String

func (n *ClassDeclarationNode) String() string

type ClosureLiteralNode

type ClosureLiteralNode struct {
	TypedNodeBase
	Parameters []ParameterNode // formal parameters of the closure separated by semicolons
	ReturnType TypeNode
	ThrowType  TypeNode
	Body       []StatementNode // body of the closure
	Lambda     bool
}

Represents a closure eg. `|i| -> println(i)`, `|i| ~> println(i)`

func NewClosureLiteralNode

func NewClosureLiteralNode(loc *position.Location, params []ParameterNode, retType TypeNode, throwType TypeNode, body []StatementNode, lambda bool) *ClosureLiteralNode

Create a new closure expression node eg. `|i| -> println(i)`

func (*ClosureLiteralNode) Class

func (*ClosureLiteralNode) Class() *value.Class

func (*ClosureLiteralNode) DirectClass

func (*ClosureLiteralNode) DirectClass() *value.Class

func (*ClosureLiteralNode) Equal

func (n *ClosureLiteralNode) Equal(other value.Value) bool

func (*ClosureLiteralNode) Error

func (n *ClosureLiteralNode) Error() string

func (*ClosureLiteralNode) Inspect

func (n *ClosureLiteralNode) Inspect() string

func (*ClosureLiteralNode) IsStatic

func (*ClosureLiteralNode) IsStatic() bool

func (*ClosureLiteralNode) MacroType

func (*ClosureLiteralNode) String

func (n *ClosureLiteralNode) String() string

type ComplexConstantNode

type ComplexConstantNode interface {
	Node
	TypeNode
	ExpressionNode
	PatternNode
	LiteralPatternNode
	UsingEntryNode
	// contains filtered or unexported methods
}

All nodes that should be valid in constant lookups should implement this interface.

type ConstantAsNode

type ConstantAsNode struct {
	NodeBase
	Constant ComplexConstantNode
	AsName   string
}

Represents a constant with as in using declarations eg. `Foo::Bar as Bar`.

func NewConstantAsNode

func NewConstantAsNode(loc *position.Location, constant ComplexConstantNode, as string) *ConstantAsNode

Create a new identifier with as eg. `Foo::Bar as Bar`.

func (*ConstantAsNode) Class

func (*ConstantAsNode) Class() *value.Class

func (*ConstantAsNode) DirectClass

func (*ConstantAsNode) DirectClass() *value.Class

func (*ConstantAsNode) Equal

func (n *ConstantAsNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*ConstantAsNode) Error

func (n *ConstantAsNode) Error() string

func (*ConstantAsNode) Inspect

func (n *ConstantAsNode) Inspect() string

func (*ConstantAsNode) IsStatic

func (*ConstantAsNode) IsStatic() bool

func (*ConstantAsNode) MacroType

func (n *ConstantAsNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*ConstantAsNode) String

func (n *ConstantAsNode) String() string

Return a string representation of the node.

type ConstantDeclarationNode

type ConstantDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Constant    ExpressionNode // name of the constant
	TypeNode    TypeNode       // type of the constant
	Initialiser ExpressionNode // value assigned to the constant
}

Represents a constant declaration eg. `const Foo: ArrayList[String] = ["foo", "bar"]`

func NewConstantDeclarationNode

func NewConstantDeclarationNode(loc *position.Location, docComment string, constant ExpressionNode, typ TypeNode, init ExpressionNode) *ConstantDeclarationNode

Create a new constant declaration node eg. `const Foo: ArrayList[String] = ["foo", "bar"]`

func (*ConstantDeclarationNode) Class

func (*ConstantDeclarationNode) DirectClass

func (*ConstantDeclarationNode) DirectClass() *value.Class

func (*ConstantDeclarationNode) Equal

func (n *ConstantDeclarationNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*ConstantDeclarationNode) Error

func (n *ConstantDeclarationNode) Error() string

func (*ConstantDeclarationNode) Inspect

func (n *ConstantDeclarationNode) Inspect() string

func (*ConstantDeclarationNode) IsStatic

func (*ConstantDeclarationNode) IsStatic() bool

func (*ConstantDeclarationNode) MacroType

func (*ConstantDeclarationNode) String

func (n *ConstantDeclarationNode) String() string

Return a string representation of the node.

type ConstantLookupNode

type ConstantLookupNode struct {
	TypedNodeBase
	Left  ExpressionNode      // left hand side
	Right ComplexConstantNode // right hand side
}

Represents a constant lookup expressions eg. `Foo::Bar`

func NewConstantLookupNode

func NewConstantLookupNode(loc *position.Location, left ExpressionNode, right ComplexConstantNode) *ConstantLookupNode

Create a new constant lookup expression node eg. `Foo::Bar`

func (*ConstantLookupNode) Class

func (*ConstantLookupNode) Class() *value.Class

func (*ConstantLookupNode) DirectClass

func (*ConstantLookupNode) DirectClass() *value.Class

func (*ConstantLookupNode) Equal

func (n *ConstantLookupNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*ConstantLookupNode) Error

func (n *ConstantLookupNode) Error() string

func (*ConstantLookupNode) Inspect

func (n *ConstantLookupNode) Inspect() string

func (*ConstantLookupNode) IsStatic

func (*ConstantLookupNode) IsStatic() bool

func (*ConstantLookupNode) MacroType

func (*ConstantLookupNode) String

func (n *ConstantLookupNode) String() string

Return a string representation of the node.

type ConstantNode

type ConstantNode interface {
	Node
	TypeNode
	ExpressionNode
	UsingEntryNode
	ComplexConstantNode
	// contains filtered or unexported methods
}

All nodes that should be valid constants should implement this interface.

type ConstructorCallNode

type ConstructorCallNode struct {
	TypedNodeBase
	ClassNode           ComplexConstantNode // class that is being instantiated
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
}

Represents a constructor call eg. `String(123)`

func NewConstructorCallNode

func NewConstructorCallNode(loc *position.Location, class ComplexConstantNode, posArgs []ExpressionNode, namedArgs []NamedArgumentNode) *ConstructorCallNode

Create a constructor call node eg. `String(123)`

func (*ConstructorCallNode) Class

func (*ConstructorCallNode) Class() *value.Class

func (*ConstructorCallNode) DirectClass

func (*ConstructorCallNode) DirectClass() *value.Class

func (*ConstructorCallNode) Equal

func (n *ConstructorCallNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*ConstructorCallNode) Error

func (n *ConstructorCallNode) Error() string

func (*ConstructorCallNode) Inspect

func (n *ConstructorCallNode) Inspect() string

func (*ConstructorCallNode) IsStatic

func (*ConstructorCallNode) IsStatic() bool

func (*ConstructorCallNode) MacroType

func (*ConstructorCallNode) String

func (n *ConstructorCallNode) String() string

Return a string representation of the node.

type ContinueExpressionNode

type ContinueExpressionNode struct {
	NodeBase
	Label IdentifierNode
	Value ExpressionNode
}

Represents a `continue` expression eg. `continue`, `continue "foo"`

func NewContinueExpressionNode

func NewContinueExpressionNode(loc *position.Location, label IdentifierNode, val ExpressionNode) *ContinueExpressionNode

Create a new `continue` expression node eg. `continue`, `continue "foo"`

func (*ContinueExpressionNode) Class

func (*ContinueExpressionNode) DirectClass

func (*ContinueExpressionNode) DirectClass() *value.Class

func (*ContinueExpressionNode) Equal

func (n *ContinueExpressionNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*ContinueExpressionNode) Error

func (n *ContinueExpressionNode) Error() string

func (*ContinueExpressionNode) Inspect

func (n *ContinueExpressionNode) Inspect() string

func (*ContinueExpressionNode) IsStatic

func (*ContinueExpressionNode) IsStatic() bool

func (*ContinueExpressionNode) MacroType

func (*ContinueExpressionNode) String

func (n *ContinueExpressionNode) String() string

Return a string representation of the node.

func (*ContinueExpressionNode) Type

type DoExpressionNode

type DoExpressionNode struct {
	TypedNodeBase
	Body    []StatementNode // do expression body
	Catches []*CatchNode
	Finally []StatementNode
}

Represents a `do` expression eg.

do
	print("awesome!")
end

func NewDoExpressionNode

func NewDoExpressionNode(loc *position.Location, body []StatementNode, catches []*CatchNode, finally []StatementNode) *DoExpressionNode

Create a new `do` expression node eg.

do
	print("awesome!")
end

func (*DoExpressionNode) Class

func (*DoExpressionNode) Class() *value.Class

func (*DoExpressionNode) DirectClass

func (*DoExpressionNode) DirectClass() *value.Class

func (*DoExpressionNode) Equal

func (n *DoExpressionNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*DoExpressionNode) Error

func (n *DoExpressionNode) Error() string

func (*DoExpressionNode) HasSingleScope

func (n *DoExpressionNode) HasSingleScope() bool

func (*DoExpressionNode) HasSingleStatement

func (n *DoExpressionNode) HasSingleStatement() bool

func (*DoExpressionNode) Inspect

func (n *DoExpressionNode) Inspect() string

func (*DoExpressionNode) IsStatic

func (*DoExpressionNode) IsStatic() bool

func (*DoExpressionNode) MacroType

func (n *DoExpressionNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*DoExpressionNode) String

func (n *DoExpressionNode) String() string

Return a string representation of the node.

type DocCommentableNode

type DocCommentableNode interface {
	DocComment() string
	SetDocComment(string)
}

type DocCommentableNodeBase

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

func (*DocCommentableNodeBase) DocComment

func (d *DocCommentableNodeBase) DocComment() string

func (*DocCommentableNodeBase) SetDocComment

func (d *DocCommentableNodeBase) SetDocComment(comment string)

type DoubleQuotedStringLiteralNode

type DoubleQuotedStringLiteralNode struct {
	TypedNodeBase
	Value string
}

Represents a simple double quoted string literal eg. `"foo baz"`

func NewDoubleQuotedStringLiteralNode

func NewDoubleQuotedStringLiteralNode(loc *position.Location, val string) *DoubleQuotedStringLiteralNode

Create a new double quoted string literal node eg. `"foo baz"`

func (*DoubleQuotedStringLiteralNode) Class

func (*DoubleQuotedStringLiteralNode) DirectClass

func (*DoubleQuotedStringLiteralNode) DirectClass() *value.Class

func (*DoubleQuotedStringLiteralNode) Equal

Check if this node equals another node.

func (*DoubleQuotedStringLiteralNode) Error

func (*DoubleQuotedStringLiteralNode) Inspect

func (*DoubleQuotedStringLiteralNode) IsStatic

func (*DoubleQuotedStringLiteralNode) IsStatic() bool

func (*DoubleQuotedStringLiteralNode) MacroType

func (*DoubleQuotedStringLiteralNode) String

Return a string representation of the node.

type DoubleSplatExpressionNode

type DoubleSplatExpressionNode struct {
	TypedNodeBase
	Value ExpressionNode
}

Represents a double splat expression eg. `**foo`

func NewDoubleSplatExpressionNode

func NewDoubleSplatExpressionNode(loc *position.Location, val ExpressionNode) *DoubleSplatExpressionNode

Create a double splat expression node eg. `**foo`

func (*DoubleSplatExpressionNode) Class

func (*DoubleSplatExpressionNode) DirectClass

func (*DoubleSplatExpressionNode) DirectClass() *value.Class

func (*DoubleSplatExpressionNode) Equal

func (n *DoubleSplatExpressionNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*DoubleSplatExpressionNode) Error

func (n *DoubleSplatExpressionNode) Error() string

func (*DoubleSplatExpressionNode) Inspect

func (n *DoubleSplatExpressionNode) Inspect() string

func (*DoubleSplatExpressionNode) IsStatic

func (*DoubleSplatExpressionNode) IsStatic() bool

func (*DoubleSplatExpressionNode) MacroType

func (*DoubleSplatExpressionNode) String

func (n *DoubleSplatExpressionNode) String() string

Return a string representation of the node.

type EmptyStatementNode

type EmptyStatementNode struct {
	NodeBase
}

Represents an empty statement eg. a statement with only a semicolon or a newline.

func NewEmptyStatementNode

func NewEmptyStatementNode(loc *position.Location) *EmptyStatementNode

Create a new empty statement node.

func (*EmptyStatementNode) Class

func (e *EmptyStatementNode) Class() *value.Class

func (*EmptyStatementNode) DirectClass

func (e *EmptyStatementNode) DirectClass() *value.Class

func (*EmptyStatementNode) Equal

func (n *EmptyStatementNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*EmptyStatementNode) Error

func (e *EmptyStatementNode) Error() string

func (*EmptyStatementNode) Inspect

func (e *EmptyStatementNode) Inspect() string

func (*EmptyStatementNode) IsStatic

func (*EmptyStatementNode) IsStatic() bool

func (*EmptyStatementNode) MacroType

func (*EmptyStatementNode) String

func (n *EmptyStatementNode) String() string

Return a string representation of the node.

type ExpressionNode

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

All expression nodes implement this interface.

func NewArrayListLiteralNodeI

func NewArrayListLiteralNodeI(loc *position.Location, elements []ExpressionNode, capacity ExpressionNode) ExpressionNode

Same as NewArrayListLiteralNode but returns an interface

func NewArrayTupleLiteralNodeI

func NewArrayTupleLiteralNodeI(loc *position.Location, elements []ExpressionNode) ExpressionNode

Same as NewArrayTupleLiteralNode but returns an interface

func NewBinArrayListLiteralExpressionNode

func NewBinArrayListLiteralExpressionNode(loc *position.Location, elements []IntCollectionContentNode, capacity ExpressionNode) ExpressionNode

Same as NewBinArrayListLiteralNode but returns an interface.

func NewBinArrayTupleLiteralExpressionNode

func NewBinArrayTupleLiteralExpressionNode(loc *position.Location, elements []IntCollectionContentNode) ExpressionNode

Same as NewBinArrayTupleLiteralNode but returns an interface.

func NewBinHashSetLiteralNodeI

func NewBinHashSetLiteralNodeI(loc *position.Location, elements []IntCollectionContentNode, capacity ExpressionNode) ExpressionNode

Same as NewBinHashSetLiteralNode but returns an interface.

func NewBinaryExpressionNodeI

func NewBinaryExpressionNodeI(loc *position.Location, op *token.Token, left, right ExpressionNode) ExpressionNode

Same as NewBinaryExpressionNode but returns an interface

func NewHashMapLiteralNodeI

func NewHashMapLiteralNodeI(loc *position.Location, elements []ExpressionNode, capacity ExpressionNode) ExpressionNode

Same as NewHashMapLiteralNode but returns an interface

func NewHashRecordLiteralNodeI

func NewHashRecordLiteralNodeI(loc *position.Location, elements []ExpressionNode) ExpressionNode

Same as NewHashRecordLiteralNode but returns an interface

func NewHashSetLiteralNodeI

func NewHashSetLiteralNodeI(loc *position.Location, elements []ExpressionNode, capacity ExpressionNode) ExpressionNode

Same as NewHashSetLiteralNode but returns an interface

func NewHexArrayListLiteralExpressionNode

func NewHexArrayListLiteralExpressionNode(loc *position.Location, elements []IntCollectionContentNode, capacity ExpressionNode) ExpressionNode

Same as NewHexArrayListLiteralNode but returns an interface.

func NewHexArrayTupleLiteralExpressionNode

func NewHexArrayTupleLiteralExpressionNode(loc *position.Location, elements []IntCollectionContentNode) ExpressionNode

Same as NewHexArrayTupleLiteralNode but returns an interface.

func NewHexHashSetLiteralNodeI

func NewHexHashSetLiteralNodeI(loc *position.Location, elements []IntCollectionContentNode, capacity ExpressionNode) ExpressionNode

Same as NewHexHashSetLiteralNode but returns an interface.

func NewInvalidExpressionNode

func NewInvalidExpressionNode(loc *position.Location, tok *token.Token) ExpressionNode

func NewLogicalExpressionNodeI

func NewLogicalExpressionNodeI(loc *position.Location, op *token.Token, left, right ExpressionNode) ExpressionNode

Same as NewLogicalExpressionNode but returns an interface

func NewSymbolArrayListLiteralExpressionNode

func NewSymbolArrayListLiteralExpressionNode(loc *position.Location, elements []SymbolCollectionContentNode, capacity ExpressionNode) ExpressionNode

Same as NewSymbolArrayListLiteralNode but returns an interface.

func NewSymbolArrayTupleLiteralExpressionNode

func NewSymbolArrayTupleLiteralExpressionNode(loc *position.Location, elements []SymbolCollectionContentNode) ExpressionNode

Same as NewSymbolArrayTupleLiteralNode but returns an interface.

func NewSymbolHashSetLiteralNodeI

func NewSymbolHashSetLiteralNodeI(loc *position.Location, elements []SymbolCollectionContentNode, capacity ExpressionNode) ExpressionNode

Same as NewSymbolHashSetLiteralNode but returns an interface.

func NewWordArrayListLiteralExpressionNode

func NewWordArrayListLiteralExpressionNode(loc *position.Location, elements []WordCollectionContentNode, capacity ExpressionNode) ExpressionNode

Same as NewWordArrayListLiteralNode but returns an interface.

func NewWordArrayTupleLiteralExpressionNode

func NewWordArrayTupleLiteralExpressionNode(loc *position.Location, elements []WordCollectionContentNode) ExpressionNode

Same as NewWordArrayTupleLiteralNode but returns an interface.

func NewWordHashSetLiteralNodeI

func NewWordHashSetLiteralNodeI(loc *position.Location, elements []WordCollectionContentNode, capacity ExpressionNode) ExpressionNode

Same as NewWordHashSetLiteralNode but returns an interface.

type ExpressionStatementNode

type ExpressionStatementNode struct {
	NodeBase
	Expression ExpressionNode
}

Expression optionally terminated with a newline or a semicolon.

func NewExpressionStatementNode

func NewExpressionStatementNode(loc *position.Location, expr ExpressionNode) *ExpressionStatementNode

Create a new expression statement node eg. `5 * 2\n`

func (*ExpressionStatementNode) Class

func (e *ExpressionStatementNode) Class() *value.Class

func (*ExpressionStatementNode) DirectClass

func (e *ExpressionStatementNode) DirectClass() *value.Class

func (*ExpressionStatementNode) Equal

func (e *ExpressionStatementNode) Equal(other value.Value) bool

func (*ExpressionStatementNode) Error

func (e *ExpressionStatementNode) Error() string

func (*ExpressionStatementNode) Inspect

func (n *ExpressionStatementNode) Inspect() string

func (*ExpressionStatementNode) IsStatic

func (e *ExpressionStatementNode) IsStatic() bool

func (*ExpressionStatementNode) MacroType

func (*ExpressionStatementNode) String

func (e *ExpressionStatementNode) String() string

Return a string representation of the node.

type ExtendWhereBlockExpressionNode

type ExtendWhereBlockExpressionNode struct {
	TypedNodeBase
	Body  []StatementNode
	Where []TypeParameterNode
}

Represents an `extend where` block expression eg.

extend where T < Foo
	def hello then println("awesome!")
end

func NewExtendWhereBlockExpressionNode

func NewExtendWhereBlockExpressionNode(loc *position.Location, body []StatementNode, where []TypeParameterNode) *ExtendWhereBlockExpressionNode

Create a new `singleton` block expression node eg.

singleton
	def hello then println("awesome!")
end

func (*ExtendWhereBlockExpressionNode) Class

func (*ExtendWhereBlockExpressionNode) DirectClass

func (*ExtendWhereBlockExpressionNode) DirectClass() *value.Class

func (*ExtendWhereBlockExpressionNode) Equal

Check if this node equals another node.

func (*ExtendWhereBlockExpressionNode) Error

func (*ExtendWhereBlockExpressionNode) Inspect

func (*ExtendWhereBlockExpressionNode) IsStatic

func (*ExtendWhereBlockExpressionNode) MacroType

func (*ExtendWhereBlockExpressionNode) SkipTypechecking

func (*ExtendWhereBlockExpressionNode) SkipTypechecking() bool

func (*ExtendWhereBlockExpressionNode) String

Return a string representation of the node.

type FalseLiteralNode

type FalseLiteralNode struct {
	NodeBase
}

`false` literal.

func NewFalseLiteralNode

func NewFalseLiteralNode(loc *position.Location) *FalseLiteralNode

Create a new `false` literal node.

func (*FalseLiteralNode) Class

func (*FalseLiteralNode) Class() *value.Class

func (*FalseLiteralNode) DirectClass

func (*FalseLiteralNode) DirectClass() *value.Class

func (*FalseLiteralNode) Equal

func (n *FalseLiteralNode) Equal(other value.Value) bool

func (*FalseLiteralNode) Error

func (n *FalseLiteralNode) Error() string

func (*FalseLiteralNode) Inspect

func (n *FalseLiteralNode) Inspect() string

func (*FalseLiteralNode) IsStatic

func (*FalseLiteralNode) IsStatic() bool

func (*FalseLiteralNode) MacroType

func (n *FalseLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*FalseLiteralNode) String

func (n *FalseLiteralNode) String() string

func (*FalseLiteralNode) Type

type Float32LiteralNode

type Float32LiteralNode struct {
	TypedNodeBase
	Value string
}

Float32 literal eg. `5.2f32`, `.5f32`, `45e20f32`

func NewFloat32LiteralNode

func NewFloat32LiteralNode(loc *position.Location, val string) *Float32LiteralNode

Create a new Float32 literal node eg. `5.2f32`, `.5f32`, `45e20f32`

func (*Float32LiteralNode) Class

func (*Float32LiteralNode) Class() *value.Class

func (*Float32LiteralNode) DirectClass

func (*Float32LiteralNode) DirectClass() *value.Class

func (*Float32LiteralNode) Equal

func (n *Float32LiteralNode) Equal(other value.Value) bool

func (*Float32LiteralNode) Error

func (n *Float32LiteralNode) Error() string

func (*Float32LiteralNode) Inspect

func (n *Float32LiteralNode) Inspect() string

func (*Float32LiteralNode) IsStatic

func (*Float32LiteralNode) IsStatic() bool

func (*Float32LiteralNode) MacroType

func (*Float32LiteralNode) String

func (n *Float32LiteralNode) String() string

type Float64LiteralNode

type Float64LiteralNode struct {
	TypedNodeBase
	Value string
}

Float64 literal eg. `5.2f64`, `.5f64`, `45e20f64`

func NewFloat64LiteralNode

func NewFloat64LiteralNode(loc *position.Location, val string) *Float64LiteralNode

Create a new Float64 literal node eg. `5.2f64`, `.5f64`, `45e20f64`

func (*Float64LiteralNode) Class

func (*Float64LiteralNode) Class() *value.Class

func (*Float64LiteralNode) DirectClass

func (*Float64LiteralNode) DirectClass() *value.Class

func (*Float64LiteralNode) Equal

func (n *Float64LiteralNode) Equal(other value.Value) bool

func (*Float64LiteralNode) Error

func (n *Float64LiteralNode) Error() string

func (*Float64LiteralNode) Inspect

func (n *Float64LiteralNode) Inspect() string

func (*Float64LiteralNode) IsStatic

func (*Float64LiteralNode) IsStatic() bool

func (*Float64LiteralNode) MacroType

func (*Float64LiteralNode) String

func (n *Float64LiteralNode) String() string

type FloatLiteralNode

type FloatLiteralNode struct {
	TypedNodeBase
	Value string
}

Float literal eg. `5.2`, `.5`, `45e20`

func NewFloatLiteralNode

func NewFloatLiteralNode(loc *position.Location, val string) *FloatLiteralNode

Create a new float literal node eg. `5.2`, `.5`, `45e20`

func (*FloatLiteralNode) Class

func (*FloatLiteralNode) Class() *value.Class

func (*FloatLiteralNode) DirectClass

func (*FloatLiteralNode) DirectClass() *value.Class

func (*FloatLiteralNode) Equal

func (n *FloatLiteralNode) Equal(other value.Value) bool

func (*FloatLiteralNode) Error

func (n *FloatLiteralNode) Error() string

func (*FloatLiteralNode) Inspect

func (n *FloatLiteralNode) Inspect() string

func (*FloatLiteralNode) IsStatic

func (*FloatLiteralNode) IsStatic() bool

func (*FloatLiteralNode) MacroType

func (n *FloatLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*FloatLiteralNode) String

func (n *FloatLiteralNode) String() string

type ForInExpressionNode

type ForInExpressionNode struct {
	TypedNodeBase
	Pattern      PatternNode
	InExpression ExpressionNode  // expression that will be iterated through
	ThenBody     []StatementNode // then expression body
}

Represents a `for in` expression eg. `for i in 5..15 then println(i)`

func NewForInExpressionNode

func NewForInExpressionNode(loc *position.Location, pattern PatternNode, inExpr ExpressionNode, then []StatementNode) *ForInExpressionNode

Create a new `for in` expression node eg. `for i in 5..15 then println(i)`

func (*ForInExpressionNode) Class

func (*ForInExpressionNode) Class() *value.Class

func (*ForInExpressionNode) DirectClass

func (*ForInExpressionNode) DirectClass() *value.Class

func (*ForInExpressionNode) Equal

func (n *ForInExpressionNode) Equal(other value.Value) bool

func (*ForInExpressionNode) Error

func (n *ForInExpressionNode) Error() string

func (*ForInExpressionNode) Inspect

func (n *ForInExpressionNode) Inspect() string

func (*ForInExpressionNode) IsStatic

func (*ForInExpressionNode) IsStatic() bool

func (*ForInExpressionNode) MacroType

func (*ForInExpressionNode) String

func (n *ForInExpressionNode) String() string

type FormalParameterNode

type FormalParameterNode struct {
	TypedNodeBase
	Name        IdentifierNode // name of the variable
	TypeNode    TypeNode       // type of the variable
	Initialiser ExpressionNode // value assigned to the variable
	Kind        ParameterKind
}

Represents a formal parameter in function or struct declarations eg. `foo: String = 'bar'`

func NewFormalParameterNode

func NewFormalParameterNode(loc *position.Location, name IdentifierNode, typ TypeNode, init ExpressionNode, kind ParameterKind) *FormalParameterNode

Create a new formal parameter node eg. `foo: String = 'bar'`

func (*FormalParameterNode) Class

func (*FormalParameterNode) Class() *value.Class

func (*FormalParameterNode) DirectClass

func (*FormalParameterNode) DirectClass() *value.Class

func (*FormalParameterNode) Equal

func (n *FormalParameterNode) Equal(other value.Value) bool

Equal checks if the given FormalParameterNode is equal to another value.

func (*FormalParameterNode) Error

func (n *FormalParameterNode) Error() string

func (*FormalParameterNode) Inspect

func (n *FormalParameterNode) Inspect() string

func (*FormalParameterNode) IsOptional

func (f *FormalParameterNode) IsOptional() bool

func (*FormalParameterNode) IsStatic

func (*FormalParameterNode) IsStatic() bool

func (*FormalParameterNode) MacroType

func (*FormalParameterNode) String

func (f *FormalParameterNode) String() string

String returns a string representation of the FormalParameterNode.

type GenericConstantNode

type GenericConstantNode struct {
	TypedNodeBase
	Constant      ComplexConstantNode
	TypeArguments []TypeNode
}

Represents a generic constant in type annotations eg. `ArrayList[String]`

func NewGenericConstantNode

func NewGenericConstantNode(loc *position.Location, constant ComplexConstantNode, args []TypeNode) *GenericConstantNode

Create a generic constant node eg. `ArrayList[String]`

func (*GenericConstantNode) Class

func (*GenericConstantNode) Class() *value.Class

func (*GenericConstantNode) DirectClass

func (*GenericConstantNode) DirectClass() *value.Class

func (*GenericConstantNode) Equal

func (n *GenericConstantNode) Equal(other value.Value) bool

Equal checks if the given GenericConstantNode is equal to another value.

func (*GenericConstantNode) Error

func (n *GenericConstantNode) Error() string

func (*GenericConstantNode) Inspect

func (n *GenericConstantNode) Inspect() string

func (*GenericConstantNode) IsStatic

func (*GenericConstantNode) IsStatic() bool

func (*GenericConstantNode) MacroType

func (*GenericConstantNode) String

func (n *GenericConstantNode) String() string

String returns a string representation of the GenericConstantNode.

type GenericConstructorCallNode

type GenericConstructorCallNode struct {
	TypedNodeBase
	ClassNode           ComplexConstantNode // class that is being instantiated
	TypeArguments       []TypeNode
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
}

Represents a constructor call eg. `ArrayList::[Int](1, 2, 3)`

func NewGenericConstructorCallNode

func NewGenericConstructorCallNode(loc *position.Location, class ComplexConstantNode, typeArgs []TypeNode, posArgs []ExpressionNode, namedArgs []NamedArgumentNode) *GenericConstructorCallNode

Create a constructor call node eg. `ArrayList::[Int](1, 2, 3)`

func (*GenericConstructorCallNode) Class

func (*GenericConstructorCallNode) DirectClass

func (*GenericConstructorCallNode) DirectClass() *value.Class

func (*GenericConstructorCallNode) Equal

func (n *GenericConstructorCallNode) Equal(other value.Value) bool

Equal checks if the given GenericConstructorCallNode is equal to another value.

func (*GenericConstructorCallNode) Error

func (*GenericConstructorCallNode) Inspect

func (n *GenericConstructorCallNode) Inspect() string

func (*GenericConstructorCallNode) IsStatic

func (*GenericConstructorCallNode) IsStatic() bool

func (*GenericConstructorCallNode) MacroType

func (*GenericConstructorCallNode) String

func (n *GenericConstructorCallNode) String() string

String returns a string representation of the GenericConstructorCallNode.

type GenericMethodCallNode

type GenericMethodCallNode struct {
	TypedNodeBase
	Receiver            ExpressionNode
	Op                  *token.Token
	MethodName          IdentifierNode
	TypeArguments       []TypeNode
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
	TailCall            bool
}

Represents a method call eg. `foo.bar::[String](a)`

func NewGenericMethodCallNode

func NewGenericMethodCallNode(loc *position.Location, recv ExpressionNode, op *token.Token, methodName IdentifierNode, typeArgs []TypeNode, posArgs []ExpressionNode, namedArgs []NamedArgumentNode) *GenericMethodCallNode

Create a method call node eg. `foo.bar::[String](a)`

func (*GenericMethodCallNode) Class

func (*GenericMethodCallNode) Class() *value.Class

func (*GenericMethodCallNode) DirectClass

func (*GenericMethodCallNode) DirectClass() *value.Class

func (*GenericMethodCallNode) Equal

func (n *GenericMethodCallNode) Equal(other value.Value) bool

Equal checks if the given GenericMethodCallNode is equal to another value.

func (*GenericMethodCallNode) Error

func (n *GenericMethodCallNode) Error() string

func (*GenericMethodCallNode) Inspect

func (n *GenericMethodCallNode) Inspect() string

func (*GenericMethodCallNode) IsStatic

func (*GenericMethodCallNode) IsStatic() bool

func (*GenericMethodCallNode) MacroType

func (*GenericMethodCallNode) String

func (n *GenericMethodCallNode) String() string

String returns a string representation of the GenericMethodCallNode.

type GenericReceiverlessMethodCallNode

type GenericReceiverlessMethodCallNode struct {
	TypedNodeBase
	MethodName          IdentifierNode
	TypeArguments       []TypeNode
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
	TailCall            bool
}

Represents a generic function-like call eg. `foo::[Int](123)`

func NewGenericReceiverlessMethodCallNode

func NewGenericReceiverlessMethodCallNode(loc *position.Location, methodName IdentifierNode, typeArgs []TypeNode, posArgs []ExpressionNode, namedArgs []NamedArgumentNode) *GenericReceiverlessMethodCallNode

Create a generic function call node eg. `foo::[Int](123)`

func (*GenericReceiverlessMethodCallNode) Class

func (*GenericReceiverlessMethodCallNode) DirectClass

func (*GenericReceiverlessMethodCallNode) Equal

Equal checks if the given GenericReceiverlessMethodCallNode is equal to another value.

func (*GenericReceiverlessMethodCallNode) Error

func (*GenericReceiverlessMethodCallNode) Inspect

func (*GenericReceiverlessMethodCallNode) IsStatic

func (*GenericReceiverlessMethodCallNode) MacroType

func (*GenericReceiverlessMethodCallNode) String

String returns a string representation of the GenericReceiverlessMethodCallNode.

type GenericTypeDefinitionNode

type GenericTypeDefinitionNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	TypeParameters []TypeParameterNode // Generic type variable definitions
	Constant       ComplexConstantNode // new name of the type
	TypeNode       TypeNode            // the type
}

Represents a new generic type definition eg. `typedef Nilable[T] = T | nil`

func NewGenericTypeDefinitionNode

func NewGenericTypeDefinitionNode(loc *position.Location, docComment string, constant ComplexConstantNode, typeVars []TypeParameterNode, typ TypeNode) *GenericTypeDefinitionNode

Create a generic type definition node eg. `typedef Nilable[T] = T | nil`

func (*GenericTypeDefinitionNode) Class

func (*GenericTypeDefinitionNode) DirectClass

func (*GenericTypeDefinitionNode) DirectClass() *value.Class

func (*GenericTypeDefinitionNode) Equal

func (n *GenericTypeDefinitionNode) Equal(other value.Value) bool

Equal compares this node to another value for equality.

func (*GenericTypeDefinitionNode) Error

func (n *GenericTypeDefinitionNode) Error() string

func (*GenericTypeDefinitionNode) Inspect

func (n *GenericTypeDefinitionNode) Inspect() string

func (*GenericTypeDefinitionNode) IsStatic

func (*GenericTypeDefinitionNode) IsStatic() bool

func (*GenericTypeDefinitionNode) MacroType

func (*GenericTypeDefinitionNode) String

func (n *GenericTypeDefinitionNode) String() string

String returns a string representation of the GenericTypeDefinitionNode.

type GetterDeclarationNode

type GetterDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Entries []ParameterNode
}

Represents a new getter declaration eg. `getter foo: String`

func NewGetterDeclarationNode

func NewGetterDeclarationNode(loc *position.Location, docComment string, entries []ParameterNode) *GetterDeclarationNode

Create a getter declaration node eg. `getter foo: String`

func (*GetterDeclarationNode) Class

func (*GetterDeclarationNode) Class() *value.Class

func (*GetterDeclarationNode) DirectClass

func (*GetterDeclarationNode) DirectClass() *value.Class

func (*GetterDeclarationNode) Equal

func (n *GetterDeclarationNode) Equal(other value.Value) bool

Equal checks if this node equals the other node.

func (*GetterDeclarationNode) Error

func (n *GetterDeclarationNode) Error() string

func (*GetterDeclarationNode) Inspect

func (n *GetterDeclarationNode) Inspect() string

func (*GetterDeclarationNode) IsStatic

func (*GetterDeclarationNode) IsStatic() bool

func (*GetterDeclarationNode) MacroType

func (*GetterDeclarationNode) String

func (n *GetterDeclarationNode) String() string

String returns the string representation of this node.

type GoExpressionNode

type GoExpressionNode struct {
	TypedNodeBase
	Body []StatementNode
}

Represents a `go` expression eg. `go foo()`, `go; foo(); end`

func NewGoExpressionNode

func NewGoExpressionNode(loc *position.Location, body []StatementNode) *GoExpressionNode

Create a new `go` expression node eg. `go foo()`, `go; foo(); end`

func (*GoExpressionNode) Class

func (*GoExpressionNode) Class() *value.Class

func (*GoExpressionNode) DirectClass

func (*GoExpressionNode) DirectClass() *value.Class

func (*GoExpressionNode) Equal

func (n *GoExpressionNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*GoExpressionNode) Error

func (n *GoExpressionNode) Error() string

func (*GoExpressionNode) Inspect

func (n *GoExpressionNode) Inspect() string

func (*GoExpressionNode) IsStatic

func (*GoExpressionNode) IsStatic() bool

func (*GoExpressionNode) MacroType

func (n *GoExpressionNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*GoExpressionNode) String

func (n *GoExpressionNode) String() string

Return a string representation of the node.

type HashMapLiteralNode

type HashMapLiteralNode struct {
	TypedNodeBase
	Elements []ExpressionNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a HashMap literal eg. `{ foo: 1, 'bar' => 5, baz }`

func NewHashMapLiteralNode

func NewHashMapLiteralNode(loc *position.Location, elements []ExpressionNode, capacity ExpressionNode) *HashMapLiteralNode

Create a HashMap literal node eg. `{ foo: 1, 'bar' => 5, baz }`

func (*HashMapLiteralNode) Class

func (*HashMapLiteralNode) Class() *value.Class

func (*HashMapLiteralNode) DirectClass

func (*HashMapLiteralNode) DirectClass() *value.Class

func (*HashMapLiteralNode) Equal

func (n *HashMapLiteralNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*HashMapLiteralNode) Error

func (n *HashMapLiteralNode) Error() string

func (*HashMapLiteralNode) Inspect

func (n *HashMapLiteralNode) Inspect() string

func (*HashMapLiteralNode) IsStatic

func (m *HashMapLiteralNode) IsStatic() bool

func (*HashMapLiteralNode) MacroType

func (*HashMapLiteralNode) String

func (n *HashMapLiteralNode) String() string

Return a string representation of the node.

type HashRecordLiteralNode

type HashRecordLiteralNode struct {
	TypedNodeBase
	Elements []ExpressionNode
	// contains filtered or unexported fields
}

Represents a Record literal eg. `%{ foo: 1, 'bar' => 5, baz }`

func NewHashRecordLiteralNode

func NewHashRecordLiteralNode(loc *position.Location, elements []ExpressionNode) *HashRecordLiteralNode

Create a Record literal node eg. `%{ foo: 1, 'bar' => 5, baz }`

func (*HashRecordLiteralNode) Class

func (*HashRecordLiteralNode) Class() *value.Class

func (*HashRecordLiteralNode) DirectClass

func (*HashRecordLiteralNode) DirectClass() *value.Class

func (*HashRecordLiteralNode) Equal

func (n *HashRecordLiteralNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*HashRecordLiteralNode) Error

func (n *HashRecordLiteralNode) Error() string

func (*HashRecordLiteralNode) Inspect

func (n *HashRecordLiteralNode) Inspect() string

func (*HashRecordLiteralNode) IsStatic

func (r *HashRecordLiteralNode) IsStatic() bool

func (*HashRecordLiteralNode) MacroType

func (*HashRecordLiteralNode) String

func (n *HashRecordLiteralNode) String() string

Return a string representation of the node.

type HashSetLiteralNode

type HashSetLiteralNode struct {
	TypedNodeBase
	Elements []ExpressionNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a HashSet literal eg. `^[1, 5, -6]`

func NewHashSetLiteralNode

func NewHashSetLiteralNode(loc *position.Location, elements []ExpressionNode, capacity ExpressionNode) *HashSetLiteralNode

Create a HashSet literal node eg. `^[1, 5, -6]`

func (*HashSetLiteralNode) Class

func (*HashSetLiteralNode) Class() *value.Class

func (*HashSetLiteralNode) DirectClass

func (*HashSetLiteralNode) DirectClass() *value.Class

func (*HashSetLiteralNode) Equal

func (n *HashSetLiteralNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*HashSetLiteralNode) Error

func (n *HashSetLiteralNode) Error() string

func (*HashSetLiteralNode) Inspect

func (n *HashSetLiteralNode) Inspect() string

func (*HashSetLiteralNode) IsStatic

func (s *HashSetLiteralNode) IsStatic() bool

func (*HashSetLiteralNode) MacroType

func (*HashSetLiteralNode) String

func (n *HashSetLiteralNode) String() string

Return a string representation of the node.

type HexArrayListLiteralNode

type HexArrayListLiteralNode struct {
	TypedNodeBase
	Elements []IntCollectionContentNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a hex ArrayList literal eg. `\x[ff ee]`

func NewHexArrayListLiteralNode

func NewHexArrayListLiteralNode(loc *position.Location, elements []IntCollectionContentNode, capacity ExpressionNode) *HexArrayListLiteralNode

Create a hex ArrayList literal node eg. `\x[ff ee]`

func (*HexArrayListLiteralNode) Class

func (*HexArrayListLiteralNode) DirectClass

func (*HexArrayListLiteralNode) DirectClass() *value.Class

func (*HexArrayListLiteralNode) Equal

func (n *HexArrayListLiteralNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*HexArrayListLiteralNode) Error

func (n *HexArrayListLiteralNode) Error() string

func (*HexArrayListLiteralNode) Inspect

func (n *HexArrayListLiteralNode) Inspect() string

func (*HexArrayListLiteralNode) IsStatic

func (h *HexArrayListLiteralNode) IsStatic() bool

func (*HexArrayListLiteralNode) MacroType

func (*HexArrayListLiteralNode) String

func (n *HexArrayListLiteralNode) String() string

Return a string representation of the node.

type HexArrayTupleLiteralNode

type HexArrayTupleLiteralNode struct {
	TypedNodeBase
	Elements []IntCollectionContentNode
}

Represents a hex ArrayTuple literal eg. `%x[ff ee]`

func NewHexArrayTupleLiteralNode

func NewHexArrayTupleLiteralNode(loc *position.Location, elements []IntCollectionContentNode) *HexArrayTupleLiteralNode

Create a hex ArrayTuple literal node eg. `%x[ff ee]`

func (*HexArrayTupleLiteralNode) Class

func (*HexArrayTupleLiteralNode) DirectClass

func (*HexArrayTupleLiteralNode) DirectClass() *value.Class

func (*HexArrayTupleLiteralNode) Equal

func (n *HexArrayTupleLiteralNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*HexArrayTupleLiteralNode) Error

func (n *HexArrayTupleLiteralNode) Error() string

func (*HexArrayTupleLiteralNode) Inspect

func (n *HexArrayTupleLiteralNode) Inspect() string

func (*HexArrayTupleLiteralNode) IsStatic

func (*HexArrayTupleLiteralNode) IsStatic() bool

func (*HexArrayTupleLiteralNode) MacroType

func (*HexArrayTupleLiteralNode) String

func (n *HexArrayTupleLiteralNode) String() string

Return a string representation of the node.

type HexHashSetLiteralNode

type HexHashSetLiteralNode struct {
	TypedNodeBase
	Elements []IntCollectionContentNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a hex HashSet literal eg. `^x[ff ee]`

func NewHexHashSetLiteralNode

func NewHexHashSetLiteralNode(loc *position.Location, elements []IntCollectionContentNode, capacity ExpressionNode) *HexHashSetLiteralNode

Create a hex HashSet literal node eg. `^x[ff ee]`

func (*HexHashSetLiteralNode) Class

func (*HexHashSetLiteralNode) Class() *value.Class

func (*HexHashSetLiteralNode) DirectClass

func (*HexHashSetLiteralNode) DirectClass() *value.Class

func (*HexHashSetLiteralNode) Equal

func (n *HexHashSetLiteralNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*HexHashSetLiteralNode) Error

func (n *HexHashSetLiteralNode) Error() string

func (*HexHashSetLiteralNode) Inspect

func (n *HexHashSetLiteralNode) Inspect() string

func (*HexHashSetLiteralNode) IsStatic

func (h *HexHashSetLiteralNode) IsStatic() bool

func (*HexHashSetLiteralNode) MacroType

func (*HexHashSetLiteralNode) String

func (n *HexHashSetLiteralNode) String() string

Return a string representation of the node.

type IdentifierNode

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

All nodes that should be valid identifiers should implement this interface.

type IfExpressionNode

type IfExpressionNode struct {
	TypedNodeBase
	Condition ExpressionNode  // if condition
	ThenBody  []StatementNode // then expression body
	ElseBody  []StatementNode // else expression body
}

Represents an `if` expression eg. `if foo then println("bar")`

func NewIfExpressionNode

func NewIfExpressionNode(loc *position.Location, cond ExpressionNode, then, els []StatementNode) *IfExpressionNode

Create a new `if` expression node eg. `if foo then println("bar")`

func (*IfExpressionNode) Class

func (*IfExpressionNode) Class() *value.Class

func (*IfExpressionNode) DirectClass

func (*IfExpressionNode) DirectClass() *value.Class

func (*IfExpressionNode) Equal

func (n *IfExpressionNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*IfExpressionNode) Error

func (n *IfExpressionNode) Error() string

func (*IfExpressionNode) Inspect

func (n *IfExpressionNode) Inspect() string

func (*IfExpressionNode) IsStatic

func (*IfExpressionNode) IsStatic() bool

func (*IfExpressionNode) MacroType

func (n *IfExpressionNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*IfExpressionNode) String

func (n *IfExpressionNode) String() string

Return a string representation of the node.

type ImplementExpressionNode

type ImplementExpressionNode struct {
	TypedNodeBase
	Constants []ComplexConstantNode
}

Represents an enhance expression eg. `implement Enumerable[V]`

func NewImplementExpressionNode

func NewImplementExpressionNode(loc *position.Location, consts []ComplexConstantNode) *ImplementExpressionNode

Create an enhance expression node eg. `implement Enumerable[V]`

func (*ImplementExpressionNode) Class

func (*ImplementExpressionNode) DirectClass

func (*ImplementExpressionNode) DirectClass() *value.Class

func (*ImplementExpressionNode) Equal

func (n *ImplementExpressionNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*ImplementExpressionNode) Error

func (n *ImplementExpressionNode) Error() string

func (*ImplementExpressionNode) Inspect

func (n *ImplementExpressionNode) Inspect() string

func (*ImplementExpressionNode) IsStatic

func (*ImplementExpressionNode) IsStatic() bool

func (*ImplementExpressionNode) MacroType

func (*ImplementExpressionNode) SkipTypechecking

func (*ImplementExpressionNode) SkipTypechecking() bool

func (*ImplementExpressionNode) String

func (n *ImplementExpressionNode) String() string

Return a string representation of the node.

type ImportStatementNode

type ImportStatementNode struct {
	NodeBase
	Path    StringLiteralNode
	FsPaths []string // resolved file system paths
}

Represents an import statement eg. `import "./foo/bar.elk"`

func NewImportStatementNode

func NewImportStatementNode(loc *position.Location, path StringLiteralNode) *ImportStatementNode

Create a new import statement node eg. `import "foo"`

func (*ImportStatementNode) Class

func (e *ImportStatementNode) Class() *value.Class

func (*ImportStatementNode) DirectClass

func (e *ImportStatementNode) DirectClass() *value.Class

func (*ImportStatementNode) Equal

func (n *ImportStatementNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*ImportStatementNode) Error

func (e *ImportStatementNode) Error() string

func (*ImportStatementNode) Inspect

func (e *ImportStatementNode) Inspect() string

func (*ImportStatementNode) IsStatic

func (i *ImportStatementNode) IsStatic() bool

func (*ImportStatementNode) MacroType

func (*ImportStatementNode) String

func (n *ImportStatementNode) String() string

Return a string representation of the node.

type IncludeExpressionNode

type IncludeExpressionNode struct {
	TypedNodeBase
	Constants []ComplexConstantNode
}

Represents an include expression eg. `include Enumerable[V]`

func NewIncludeExpressionNode

func NewIncludeExpressionNode(loc *position.Location, consts []ComplexConstantNode) *IncludeExpressionNode

Create an include expression node eg. `include Enumerable[V]`

func (*IncludeExpressionNode) Class

func (*IncludeExpressionNode) Class() *value.Class

func (*IncludeExpressionNode) DirectClass

func (*IncludeExpressionNode) DirectClass() *value.Class

func (*IncludeExpressionNode) Equal

func (n *IncludeExpressionNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*IncludeExpressionNode) Error

func (n *IncludeExpressionNode) Error() string

func (*IncludeExpressionNode) Inspect

func (n *IncludeExpressionNode) Inspect() string

func (*IncludeExpressionNode) IsStatic

func (*IncludeExpressionNode) IsStatic() bool

func (*IncludeExpressionNode) MacroType

func (*IncludeExpressionNode) SkipTypechecking

func (*IncludeExpressionNode) SkipTypechecking() bool

func (*IncludeExpressionNode) String

func (n *IncludeExpressionNode) String() string

Return a string representation of the node.

type InitDefinitionNode

type InitDefinitionNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Parameters []ParameterNode // formal parameters
	ThrowType  TypeNode
	Body       []StatementNode // body of the method
}

Represents a constructor definition eg. `init then 'hello world'`

func NewInitDefinitionNode

func NewInitDefinitionNode(loc *position.Location, params []ParameterNode, throwType TypeNode, body []StatementNode) *InitDefinitionNode

Create a constructor definition node eg. `init then 'hello world'`

func (*InitDefinitionNode) Class

func (*InitDefinitionNode) Class() *value.Class

func (*InitDefinitionNode) DirectClass

func (*InitDefinitionNode) DirectClass() *value.Class

func (*InitDefinitionNode) Equal

func (n *InitDefinitionNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*InitDefinitionNode) Error

func (n *InitDefinitionNode) Error() string

func (*InitDefinitionNode) Inspect

func (n *InitDefinitionNode) Inspect() string

func (*InitDefinitionNode) IsStatic

func (*InitDefinitionNode) IsStatic() bool

func (*InitDefinitionNode) MacroType

func (*InitDefinitionNode) String

func (n *InitDefinitionNode) String() string

Return a string representation of the node.

type InstanceMethodLookupNode

type InstanceMethodLookupNode struct {
	TypedNodeBase
	Receiver ExpressionNode
	Name     IdentifierNode
}

Represents an instance method lookup expression eg. `Foo.:bar`

func NewInstanceMethodLookupNode

func NewInstanceMethodLookupNode(loc *position.Location, receiver ExpressionNode, name IdentifierNode) *InstanceMethodLookupNode

Create a new method lookup expression node eg. `Foo::bar`, `a::c`

func (*InstanceMethodLookupNode) Class

func (*InstanceMethodLookupNode) DirectClass

func (*InstanceMethodLookupNode) DirectClass() *value.Class

func (*InstanceMethodLookupNode) Equal

func (n *InstanceMethodLookupNode) Equal(other value.Value) bool

func (*InstanceMethodLookupNode) Error

func (n *InstanceMethodLookupNode) Error() string

func (*InstanceMethodLookupNode) Inspect

func (n *InstanceMethodLookupNode) Inspect() string

func (*InstanceMethodLookupNode) IsStatic

func (*InstanceMethodLookupNode) IsStatic() bool

func (*InstanceMethodLookupNode) MacroType

func (*InstanceMethodLookupNode) String

func (n *InstanceMethodLookupNode) String() string

type InstanceOfTypeNode

type InstanceOfTypeNode struct {
	TypedNodeBase
	TypeNode TypeNode // right hand side
}

Represents an instance type eg. `%self`

func NewInstanceOfTypeNode

func NewInstanceOfTypeNode(loc *position.Location, typ TypeNode) *InstanceOfTypeNode

Create a new instance of type node eg. `%self`

func (*InstanceOfTypeNode) Class

func (*InstanceOfTypeNode) Class() *value.Class

func (*InstanceOfTypeNode) DirectClass

func (*InstanceOfTypeNode) DirectClass() *value.Class

func (*InstanceOfTypeNode) Equal

func (n *InstanceOfTypeNode) Equal(other value.Value) bool

Equal checks if this node equals the other node.

func (*InstanceOfTypeNode) Error

func (n *InstanceOfTypeNode) Error() string

func (*InstanceOfTypeNode) Inspect

func (n *InstanceOfTypeNode) Inspect() string

func (*InstanceOfTypeNode) IsStatic

func (*InstanceOfTypeNode) IsStatic() bool

func (*InstanceOfTypeNode) MacroType

func (*InstanceOfTypeNode) String

func (n *InstanceOfTypeNode) String() string

String returns the string representation of this node.

type InstanceVariableDeclarationNode

type InstanceVariableDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Name     InstanceVariableNode // name of the variable
	TypeNode TypeNode             // type of the variable
}

Represents an instance variable declaration eg. `var @foo: String`

func NewInstanceVariableDeclarationNode

func NewInstanceVariableDeclarationNode(loc *position.Location, docComment string, name InstanceVariableNode, typ TypeNode) *InstanceVariableDeclarationNode

Create a new instance variable declaration node eg. `var @foo: String`

func (*InstanceVariableDeclarationNode) Class

func (*InstanceVariableDeclarationNode) DirectClass

func (*InstanceVariableDeclarationNode) Equal

func (*InstanceVariableDeclarationNode) Error

func (*InstanceVariableDeclarationNode) Inspect

func (*InstanceVariableDeclarationNode) IsStatic

func (*InstanceVariableDeclarationNode) MacroType

func (*InstanceVariableDeclarationNode) String

type InstanceVariableNode

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

All nodes that should be valid instance variables should implement this interface.

type Int8LiteralNode

type Int8LiteralNode struct {
	TypedNodeBase
	Value string
}

Int8 literal eg. `5i8`, `1_20i8`, `0xffi8`

func NewInt8LiteralNode

func NewInt8LiteralNode(loc *position.Location, val string) *Int8LiteralNode

Create a new Int8 literal node eg. `5i8`, `1_20i8`, `0xffi8`

func (*Int8LiteralNode) Class

func (*Int8LiteralNode) Class() *value.Class

func (*Int8LiteralNode) DirectClass

func (*Int8LiteralNode) DirectClass() *value.Class

func (*Int8LiteralNode) Equal

func (n *Int8LiteralNode) Equal(other value.Value) bool

func (*Int8LiteralNode) Error

func (n *Int8LiteralNode) Error() string

func (*Int8LiteralNode) Inspect

func (n *Int8LiteralNode) Inspect() string

func (*Int8LiteralNode) IsStatic

func (*Int8LiteralNode) IsStatic() bool

func (*Int8LiteralNode) MacroType

func (n *Int8LiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*Int8LiteralNode) String

func (n *Int8LiteralNode) String() string

type Int16LiteralNode

type Int16LiteralNode struct {
	TypedNodeBase
	Value string
}

Int16 literal eg. `5i16`, `1_20i16`, `0xffi16`

func NewInt16LiteralNode

func NewInt16LiteralNode(loc *position.Location, val string) *Int16LiteralNode

Create a new Int16 literal node eg. `5i16`, `1_20i16`, `0xffi16`

func (*Int16LiteralNode) Class

func (*Int16LiteralNode) Class() *value.Class

func (*Int16LiteralNode) DirectClass

func (*Int16LiteralNode) DirectClass() *value.Class

func (*Int16LiteralNode) Equal

func (n *Int16LiteralNode) Equal(other value.Value) bool

func (*Int16LiteralNode) Error

func (n *Int16LiteralNode) Error() string

func (*Int16LiteralNode) Inspect

func (n *Int16LiteralNode) Inspect() string

func (*Int16LiteralNode) IsStatic

func (*Int16LiteralNode) IsStatic() bool

func (*Int16LiteralNode) MacroType

func (n *Int16LiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*Int16LiteralNode) String

func (n *Int16LiteralNode) String() string

type Int32LiteralNode

type Int32LiteralNode struct {
	TypedNodeBase
	Value string
}

Int32 literal eg. `5i32`, `1_20i32`, `0xffi32`

func NewInt32LiteralNode

func NewInt32LiteralNode(loc *position.Location, val string) *Int32LiteralNode

Create a new Int32 literal node eg. `5i32`, `1_20i32`, `0xffi32`

func (*Int32LiteralNode) Class

func (*Int32LiteralNode) Class() *value.Class

func (*Int32LiteralNode) DirectClass

func (*Int32LiteralNode) DirectClass() *value.Class

func (*Int32LiteralNode) Equal

func (n *Int32LiteralNode) Equal(other value.Value) bool

func (*Int32LiteralNode) Error

func (n *Int32LiteralNode) Error() string

func (*Int32LiteralNode) Inspect

func (n *Int32LiteralNode) Inspect() string

func (*Int32LiteralNode) IsStatic

func (*Int32LiteralNode) IsStatic() bool

func (*Int32LiteralNode) MacroType

func (n *Int32LiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*Int32LiteralNode) String

func (n *Int32LiteralNode) String() string

type Int64LiteralNode

type Int64LiteralNode struct {
	TypedNodeBase
	Value string
}

Int64 literal eg. `5i64`, `125_355i64`, `0xffi64`

func NewInt64LiteralNode

func NewInt64LiteralNode(loc *position.Location, val string) *Int64LiteralNode

Create a new Int64 literal node eg. `5i64`, `125_355i64`, `0xffi64`

func (*Int64LiteralNode) Class

func (*Int64LiteralNode) Class() *value.Class

func (*Int64LiteralNode) DirectClass

func (*Int64LiteralNode) DirectClass() *value.Class

func (*Int64LiteralNode) Equal

func (n *Int64LiteralNode) Equal(other value.Value) bool

func (*Int64LiteralNode) Error

func (n *Int64LiteralNode) Error() string

func (*Int64LiteralNode) Inspect

func (n *Int64LiteralNode) Inspect() string

func (*Int64LiteralNode) IsStatic

func (*Int64LiteralNode) IsStatic() bool

func (*Int64LiteralNode) MacroType

func (n *Int64LiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*Int64LiteralNode) String

func (n *Int64LiteralNode) String() string

type IntCollectionContentNode

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

All nodes that should be able to appear as elements of Int collection literals should implement this interface.

type IntLiteralNode

type IntLiteralNode struct {
	TypedNodeBase
	Value string
}

Int literal eg. `5`, `125_355`, `0xff`

func NewIntLiteralNode

func NewIntLiteralNode(loc *position.Location, val string) *IntLiteralNode

Create a new int literal node eg. `5`, `125_355`, `0xff`

func (*IntLiteralNode) Class

func (*IntLiteralNode) Class() *value.Class

func (*IntLiteralNode) DirectClass

func (*IntLiteralNode) DirectClass() *value.Class

func (*IntLiteralNode) Equal

func (n *IntLiteralNode) Equal(other value.Value) bool

func (*IntLiteralNode) Error

func (n *IntLiteralNode) Error() string

func (*IntLiteralNode) Inspect

func (n *IntLiteralNode) Inspect() string

func (*IntLiteralNode) IsStatic

func (*IntLiteralNode) IsStatic() bool

func (*IntLiteralNode) MacroType

func (n *IntLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*IntLiteralNode) String

func (n *IntLiteralNode) String() string

type InterfaceDeclarationNode

type InterfaceDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Constant       ExpressionNode      // The constant that will hold the interface value
	TypeParameters []TypeParameterNode // Generic type variable definitions
	Body           []StatementNode     // body of the interface
	Implements     []*ImplementExpressionNode
	Bytecode       value.Method
}

Represents an interface declaration eg. `interface Foo; end`

func NewInterfaceDeclarationNode

func NewInterfaceDeclarationNode(
	loc *position.Location,
	docComment string,
	constant ExpressionNode,
	typeParams []TypeParameterNode,
	body []StatementNode,
) *InterfaceDeclarationNode

Create a new interface declaration node eg. `interface Foo; end`

func (*InterfaceDeclarationNode) Class

func (*InterfaceDeclarationNode) DirectClass

func (*InterfaceDeclarationNode) DirectClass() *value.Class

func (*InterfaceDeclarationNode) Equal

func (n *InterfaceDeclarationNode) Equal(other value.Value) bool

func (*InterfaceDeclarationNode) Error

func (n *InterfaceDeclarationNode) Error() string

func (*InterfaceDeclarationNode) Inspect

func (n *InterfaceDeclarationNode) Inspect() string

func (*InterfaceDeclarationNode) IsStatic

func (*InterfaceDeclarationNode) IsStatic() bool

func (*InterfaceDeclarationNode) MacroType

func (*InterfaceDeclarationNode) SkipTypechecking

func (*InterfaceDeclarationNode) SkipTypechecking() bool

func (*InterfaceDeclarationNode) String

func (n *InterfaceDeclarationNode) String() string

type InterpolatedRegexLiteralNode

type InterpolatedRegexLiteralNode struct {
	NodeBase
	Content []RegexLiteralContentNode
	Flags   bitfield.BitField8
}

Represents an Interpolated regex literal eg. `%/foo${1 + 2}bar/`

func NewInterpolatedRegexLiteralNode

func NewInterpolatedRegexLiteralNode(loc *position.Location, content []RegexLiteralContentNode, flags bitfield.BitField8) *InterpolatedRegexLiteralNode

Create a new interpolated regex literal node eg. `%/foo${1 + 3}bar/`.

func (*InterpolatedRegexLiteralNode) Class

func (*InterpolatedRegexLiteralNode) DirectClass

func (*InterpolatedRegexLiteralNode) DirectClass() *value.Class

func (*InterpolatedRegexLiteralNode) Equal

func (n *InterpolatedRegexLiteralNode) Equal(other value.Value) bool

func (*InterpolatedRegexLiteralNode) Error

func (*InterpolatedRegexLiteralNode) Inspect

func (n *InterpolatedRegexLiteralNode) Inspect() string

func (*InterpolatedRegexLiteralNode) IsASCII

func (r *InterpolatedRegexLiteralNode) IsASCII() bool

func (*InterpolatedRegexLiteralNode) IsCaseInsensitive

func (r *InterpolatedRegexLiteralNode) IsCaseInsensitive() bool

func (*InterpolatedRegexLiteralNode) IsDotAll

func (r *InterpolatedRegexLiteralNode) IsDotAll() bool

func (*InterpolatedRegexLiteralNode) IsExtended

func (r *InterpolatedRegexLiteralNode) IsExtended() bool

func (*InterpolatedRegexLiteralNode) IsMultiline

func (r *InterpolatedRegexLiteralNode) IsMultiline() bool

func (*InterpolatedRegexLiteralNode) IsStatic

func (*InterpolatedRegexLiteralNode) IsStatic() bool

func (*InterpolatedRegexLiteralNode) IsUngreedy

func (r *InterpolatedRegexLiteralNode) IsUngreedy() bool

func (*InterpolatedRegexLiteralNode) MacroType

func (*InterpolatedRegexLiteralNode) SetASCII

func (*InterpolatedRegexLiteralNode) SetCaseInsensitive

func (*InterpolatedRegexLiteralNode) SetDotAll

func (*InterpolatedRegexLiteralNode) SetExtended

func (*InterpolatedRegexLiteralNode) SetMultiline

func (*InterpolatedRegexLiteralNode) SetUngreedy

func (*InterpolatedRegexLiteralNode) String

func (*InterpolatedRegexLiteralNode) Type

type InterpolatedStringLiteralNode

type InterpolatedStringLiteralNode struct {
	NodeBase
	Content []StringLiteralContentNode
}

Represents an interpolated string literal eg. `"foo ${bar} baz"`

func NewInterpolatedStringLiteralNode

func NewInterpolatedStringLiteralNode(loc *position.Location, cont []StringLiteralContentNode) *InterpolatedStringLiteralNode

Create a new interpolated string literal node eg. `"foo ${bar} baz"`

func (*InterpolatedStringLiteralNode) Class

func (*InterpolatedStringLiteralNode) DirectClass

func (*InterpolatedStringLiteralNode) DirectClass() *value.Class

func (*InterpolatedStringLiteralNode) Equal

func (*InterpolatedStringLiteralNode) Error

func (*InterpolatedStringLiteralNode) Inspect

func (*InterpolatedStringLiteralNode) IsStatic

func (*InterpolatedStringLiteralNode) IsStatic() bool

func (*InterpolatedStringLiteralNode) MacroType

func (*InterpolatedStringLiteralNode) String

func (*InterpolatedStringLiteralNode) Type

type InterpolatedSymbolLiteralNode

type InterpolatedSymbolLiteralNode struct {
	NodeBase
	Content *InterpolatedStringLiteralNode
}

Represents an interpolated symbol eg. `:"foo ${bar + 2}"`

func NewInterpolatedSymbolLiteralNode

func NewInterpolatedSymbolLiteralNode(loc *position.Location, cont *InterpolatedStringLiteralNode) *InterpolatedSymbolLiteralNode

Create an interpolated symbol literal node eg. `:"foo ${bar + 2}"`

func (*InterpolatedSymbolLiteralNode) Class

func (*InterpolatedSymbolLiteralNode) DirectClass

func (*InterpolatedSymbolLiteralNode) DirectClass() *value.Class

func (*InterpolatedSymbolLiteralNode) Equal

func (*InterpolatedSymbolLiteralNode) Error

func (*InterpolatedSymbolLiteralNode) Inspect

func (*InterpolatedSymbolLiteralNode) IsStatic

func (*InterpolatedSymbolLiteralNode) IsStatic() bool

func (*InterpolatedSymbolLiteralNode) MacroType

func (*InterpolatedSymbolLiteralNode) String

func (*InterpolatedSymbolLiteralNode) Type

type IntersectionTypeNode

type IntersectionTypeNode struct {
	TypedNodeBase
	Elements []TypeNode
}

Union type eg. `String & Int & Float`

func NewIntersectionTypeNode

func NewIntersectionTypeNode(loc *position.Location, elements []TypeNode) *IntersectionTypeNode

Create a new binary type expression node eg. `String & Int`

func (*IntersectionTypeNode) Class

func (*IntersectionTypeNode) Class() *value.Class

func (*IntersectionTypeNode) DirectClass

func (*IntersectionTypeNode) DirectClass() *value.Class

func (*IntersectionTypeNode) Equal

func (n *IntersectionTypeNode) Equal(other value.Value) bool

func (*IntersectionTypeNode) Error

func (n *IntersectionTypeNode) Error() string

func (*IntersectionTypeNode) Inspect

func (n *IntersectionTypeNode) Inspect() string

func (*IntersectionTypeNode) IsStatic

func (*IntersectionTypeNode) IsStatic() bool

func (*IntersectionTypeNode) MacroType

func (*IntersectionTypeNode) String

func (n *IntersectionTypeNode) String() string

type InvalidNode

type InvalidNode struct {
	NodeBase
	Token *token.Token
}

Represents a syntax error.

func NewInvalidNode

func NewInvalidNode(loc *position.Location, tok *token.Token) *InvalidNode

Create a new invalid node.

func (*InvalidNode) Class

func (*InvalidNode) Class() *value.Class

func (*InvalidNode) DirectClass

func (*InvalidNode) DirectClass() *value.Class

func (*InvalidNode) Equal

func (n *InvalidNode) Equal(other value.Value) bool

func (*InvalidNode) Error

func (p *InvalidNode) Error() string

func (*InvalidNode) Inspect

func (n *InvalidNode) Inspect() string

func (*InvalidNode) IsOptional

func (*InvalidNode) IsOptional() bool

func (*InvalidNode) IsStatic

func (*InvalidNode) IsStatic() bool

func (*InvalidNode) MacroType

func (n *InvalidNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*InvalidNode) SetType

func (*InvalidNode) SetType(types.Type)

func (*InvalidNode) String

func (n *InvalidNode) String() string

type KeyValueExpressionNode

type KeyValueExpressionNode struct {
	TypedNodeBase
	Key   ExpressionNode
	Value ExpressionNode
	// contains filtered or unexported fields
}

Represents a key value expression eg. `foo => bar`

func NewKeyValueExpressionNode

func NewKeyValueExpressionNode(loc *position.Location, key, val ExpressionNode) *KeyValueExpressionNode

Create a key value expression node eg. `foo => bar`

func (*KeyValueExpressionNode) Class

func (*KeyValueExpressionNode) DirectClass

func (*KeyValueExpressionNode) DirectClass() *value.Class

func (*KeyValueExpressionNode) Equal

func (n *KeyValueExpressionNode) Equal(other value.Value) bool

func (*KeyValueExpressionNode) Error

func (n *KeyValueExpressionNode) Error() string

func (*KeyValueExpressionNode) Inspect

func (n *KeyValueExpressionNode) Inspect() string

func (*KeyValueExpressionNode) IsStatic

func (k *KeyValueExpressionNode) IsStatic() bool

func (*KeyValueExpressionNode) MacroType

func (*KeyValueExpressionNode) String

func (n *KeyValueExpressionNode) String() string

type KeyValuePatternNode

type KeyValuePatternNode struct {
	NodeBase
	Key   LiteralPatternNode
	Value PatternNode
}

Represents a key value pattern eg. `foo => bar`

func NewKeyValuePatternNode

func NewKeyValuePatternNode(loc *position.Location, key LiteralPatternNode, val PatternNode) *KeyValuePatternNode

Create a key value pattern node eg. `foo => bar`

func (*KeyValuePatternNode) Class

func (*KeyValuePatternNode) Class() *value.Class

func (*KeyValuePatternNode) DirectClass

func (*KeyValuePatternNode) DirectClass() *value.Class

func (*KeyValuePatternNode) Equal

func (n *KeyValuePatternNode) Equal(other value.Value) bool

func (*KeyValuePatternNode) Error

func (n *KeyValuePatternNode) Error() string

func (*KeyValuePatternNode) Inspect

func (n *KeyValuePatternNode) Inspect() string

func (*KeyValuePatternNode) IsStatic

func (k *KeyValuePatternNode) IsStatic() bool

func (*KeyValuePatternNode) MacroType

func (*KeyValuePatternNode) String

func (n *KeyValuePatternNode) String() string

type LabeledExpressionNode

type LabeledExpressionNode struct {
	NodeBase
	Label      string
	Expression ExpressionNode
}

Represents a labeled expression eg. `$foo: 1 + 2`

func NewLabeledExpressionNode

func NewLabeledExpressionNode(loc *position.Location, label string, expr ExpressionNode) *LabeledExpressionNode

Create a new labeled expression node eg. `$foo: 1 + 2`

func (*LabeledExpressionNode) Class

func (*LabeledExpressionNode) Class() *value.Class

func (*LabeledExpressionNode) DirectClass

func (*LabeledExpressionNode) DirectClass() *value.Class

func (*LabeledExpressionNode) Equal

func (n *LabeledExpressionNode) Equal(other value.Value) bool

func (*LabeledExpressionNode) Error

func (n *LabeledExpressionNode) Error() string

func (*LabeledExpressionNode) Inspect

func (n *LabeledExpressionNode) Inspect() string

func (*LabeledExpressionNode) IsStatic

func (l *LabeledExpressionNode) IsStatic() bool

func (*LabeledExpressionNode) MacroType

func (*LabeledExpressionNode) String

func (n *LabeledExpressionNode) String() string

func (*LabeledExpressionNode) Type

type ListPatternNode

type ListPatternNode struct {
	TypedNodeBase
	Elements []PatternNode
}

Represents a List pattern eg. `[1, a, >= 10]`

func NewListPatternNode

func NewListPatternNode(loc *position.Location, elements []PatternNode) *ListPatternNode

Create a List pattern node eg. `[1, a, >= 10]`

func (*ListPatternNode) Class

func (*ListPatternNode) Class() *value.Class

func (*ListPatternNode) DirectClass

func (*ListPatternNode) DirectClass() *value.Class

func (*ListPatternNode) Equal

func (n *ListPatternNode) Equal(other value.Value) bool

func (*ListPatternNode) Error

func (n *ListPatternNode) Error() string

func (*ListPatternNode) Inspect

func (n *ListPatternNode) Inspect() string

func (*ListPatternNode) IsStatic

func (l *ListPatternNode) IsStatic() bool

func (*ListPatternNode) MacroType

func (n *ListPatternNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*ListPatternNode) String

func (n *ListPatternNode) String() string

type LiteralPatternNode

type LiteralPatternNode interface {
	Node
	ExpressionNode
	PatternNode
}

func NewBinArrayListLiteralPatternNode

func NewBinArrayListLiteralPatternNode(loc *position.Location, elements []IntCollectionContentNode) LiteralPatternNode

Same as NewBinArrayListLiteralNode but returns an interface.

func NewBinArrayTupleLiteralPatternNode

func NewBinArrayTupleLiteralPatternNode(loc *position.Location, elements []IntCollectionContentNode) LiteralPatternNode

Same as NewBinArrayTupleLiteralNode but returns an interface.

func NewBinHashSetLiteralPatternNode

func NewBinHashSetLiteralPatternNode(loc *position.Location, elements []IntCollectionContentNode) LiteralPatternNode

Same as NewBinHashSetLiteralNode but returns an interface.

func NewHexArrayListLiteralPatternNode

func NewHexArrayListLiteralPatternNode(loc *position.Location, elements []IntCollectionContentNode) LiteralPatternNode

Same as NewHexArrayListLiteralNode but returns an interface.

func NewHexArrayTupleLiteralPatternNode

func NewHexArrayTupleLiteralPatternNode(loc *position.Location, elements []IntCollectionContentNode) LiteralPatternNode

Same as NewHexArrayTupleLiteralNode but returns an interface.

func NewHexHashSetLiteralPatternNode

func NewHexHashSetLiteralPatternNode(loc *position.Location, elements []IntCollectionContentNode) LiteralPatternNode

Same as NewHexHashSetLiteralNode but returns an interface.

func NewInvalidLiteralPatternNode

func NewInvalidLiteralPatternNode(loc *position.Location, tok *token.Token) LiteralPatternNode

func NewSymbolArrayListLiteralPatternNode

func NewSymbolArrayListLiteralPatternNode(loc *position.Location, elements []SymbolCollectionContentNode) LiteralPatternNode

Same as NewSymbolArrayListLiteralNode but returns an interface.

func NewSymbolArrayTupleLiteralPatternNode

func NewSymbolArrayTupleLiteralPatternNode(loc *position.Location, elements []SymbolCollectionContentNode) LiteralPatternNode

Same as NewSymbolArrayTupleLiteralNode but returns an interface.

func NewSymbolHashSetLiteralPatternNode

func NewSymbolHashSetLiteralPatternNode(loc *position.Location, elements []SymbolCollectionContentNode) LiteralPatternNode

Same as NewSymbolHashSetLiteralNode but returns an interface.

func NewWordArrayListLiteralPatternNode

func NewWordArrayListLiteralPatternNode(loc *position.Location, elements []WordCollectionContentNode) LiteralPatternNode

Same as NewWordArrayListLiteralNode but returns an interface.

func NewWordArrayTupleLiteralPatternNode

func NewWordArrayTupleLiteralPatternNode(loc *position.Location, elements []WordCollectionContentNode) LiteralPatternNode

Same as NewWordArrayTupleLiteralNode but returns an interface.

func NewWordHashSetLiteralPatternNode

func NewWordHashSetLiteralPatternNode(loc *position.Location, elements []WordCollectionContentNode) LiteralPatternNode

Same as NewWordHashSetLiteralNode but returns an interface.

type LogicalExpressionNode

type LogicalExpressionNode struct {
	TypedNodeBase
	Op    *token.Token   // operator
	Left  ExpressionNode // left hand side
	Right ExpressionNode // right hand side
	// contains filtered or unexported fields
}

Expression of a logical operator with two operands eg. `foo && bar`

func NewLogicalExpressionNode

func NewLogicalExpressionNode(loc *position.Location, op *token.Token, left, right ExpressionNode) *LogicalExpressionNode

Create a new logical expression node.

func (*LogicalExpressionNode) Class

func (*LogicalExpressionNode) Class() *value.Class

func (*LogicalExpressionNode) DirectClass

func (*LogicalExpressionNode) DirectClass() *value.Class

func (*LogicalExpressionNode) Equal

func (n *LogicalExpressionNode) Equal(other value.Value) bool

func (*LogicalExpressionNode) Error

func (n *LogicalExpressionNode) Error() string

func (*LogicalExpressionNode) Inspect

func (n *LogicalExpressionNode) Inspect() string

func (*LogicalExpressionNode) IsStatic

func (l *LogicalExpressionNode) IsStatic() bool

func (*LogicalExpressionNode) MacroType

func (*LogicalExpressionNode) String

func (n *LogicalExpressionNode) String() string

type LoopExpressionNode

type LoopExpressionNode struct {
	TypedNodeBase
	ThenBody []StatementNode // then expression body
}

Represents a `loop` expression.

func NewLoopExpressionNode

func NewLoopExpressionNode(loc *position.Location, then []StatementNode) *LoopExpressionNode

Create a new `loop` expression node eg. `loop println('elk is awesome')`

func (*LoopExpressionNode) Class

func (*LoopExpressionNode) Class() *value.Class

func (*LoopExpressionNode) DirectClass

func (*LoopExpressionNode) DirectClass() *value.Class

func (*LoopExpressionNode) Equal

func (n *LoopExpressionNode) Equal(other value.Value) bool

func (*LoopExpressionNode) Error

func (n *LoopExpressionNode) Error() string

func (*LoopExpressionNode) Inspect

func (n *LoopExpressionNode) Inspect() string

func (*LoopExpressionNode) IsStatic

func (*LoopExpressionNode) IsStatic() bool

func (*LoopExpressionNode) MacroType

func (*LoopExpressionNode) String

func (n *LoopExpressionNode) String() string

type MacroBoundaryNode

type MacroBoundaryNode struct {
	TypedNodeBase
	Name string
	Body []StatementNode
}

Represents a boundary for expanded macros

func NewMacroBoundaryNode

func NewMacroBoundaryNode(loc *position.Location, body []StatementNode, name string) *MacroBoundaryNode

Create a new macro boundary node eg.

do macro
	print("awesome!")
end

func (*MacroBoundaryNode) Class

func (*MacroBoundaryNode) Class() *value.Class

func (*MacroBoundaryNode) DirectClass

func (*MacroBoundaryNode) DirectClass() *value.Class

func (*MacroBoundaryNode) Equal

func (n *MacroBoundaryNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*MacroBoundaryNode) Error

func (n *MacroBoundaryNode) Error() string

func (*MacroBoundaryNode) Inspect

func (n *MacroBoundaryNode) Inspect() string

func (*MacroBoundaryNode) IsStatic

func (m *MacroBoundaryNode) IsStatic() bool

func (*MacroBoundaryNode) MacroType

func (n *MacroBoundaryNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*MacroBoundaryNode) String

func (n *MacroBoundaryNode) String() string

Return a string representation of the node.

type MacroCallNode

type MacroCallNode struct {
	TypedNodeBase
	Kind                MacroKind
	Receiver            ExpressionNode
	MacroName           IdentifierNode
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
}

Represents a method call eg. `'123'.to_int!()`

func NewMacroCallNode

func NewMacroCallNode(
	loc *position.Location,
	kind MacroKind,
	recv ExpressionNode,
	macroName IdentifierNode,
	posArgs []ExpressionNode,
	namedArgs []NamedArgumentNode,
) *MacroCallNode

Create a macro call node eg. `'123'.to_int!()`

func (*MacroCallNode) Class

func (*MacroCallNode) Class() *value.Class

func (*MacroCallNode) DirectClass

func (*MacroCallNode) DirectClass() *value.Class

func (*MacroCallNode) Equal

func (n *MacroCallNode) Equal(other value.Value) bool

func (*MacroCallNode) Error

func (n *MacroCallNode) Error() string

func (*MacroCallNode) Inspect

func (n *MacroCallNode) Inspect() string

func (*MacroCallNode) IsStatic

func (*MacroCallNode) IsStatic() bool

func (*MacroCallNode) MacroType

func (n *MacroCallNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*MacroCallNode) String

func (n *MacroCallNode) String() string

type MacroDefinitionNode

type MacroDefinitionNode struct {
	TypedNodeBase
	DocCommentableNodeBase

	ReturnType TypeNode
	Name       IdentifierNode
	Parameters []ParameterNode // formal parameters
	Body       []StatementNode // body of the method
	// contains filtered or unexported fields
}

Represents a macro definition eg. `macro foo(a: Elk::AST::StringLiteralNode); a; end`

func NewMacroDefinitionNode

func NewMacroDefinitionNode(
	loc *position.Location,
	docComment string,
	sealed bool,
	name IdentifierNode,
	params []ParameterNode,
	returnType TypeNode,
	body []StatementNode,
) *MacroDefinitionNode

Create a method definition node eg. `def foo: String then 'hello world'`

func (*MacroDefinitionNode) Class

func (*MacroDefinitionNode) Class() *value.Class

func (*MacroDefinitionNode) DirectClass

func (*MacroDefinitionNode) DirectClass() *value.Class

func (*MacroDefinitionNode) Equal

func (n *MacroDefinitionNode) Equal(other value.Value) bool

Check if this method definition is equal to another value.

func (*MacroDefinitionNode) Error

func (p *MacroDefinitionNode) Error() string

func (*MacroDefinitionNode) Inspect

func (n *MacroDefinitionNode) Inspect() string

func (*MacroDefinitionNode) IsSealed

func (m *MacroDefinitionNode) IsSealed() bool

func (*MacroDefinitionNode) IsStatic

func (*MacroDefinitionNode) IsStatic() bool

func (*MacroDefinitionNode) MacroType

func (*MacroDefinitionNode) SetSealed

func (m *MacroDefinitionNode) SetSealed()

func (*MacroDefinitionNode) String

func (n *MacroDefinitionNode) String() string

Return a string representation of this method definition.

type MacroKind

type MacroKind uint8
const (
	MACRO_EXPRESSION_KIND MacroKind = iota // Default kind of macro for expression nodes
	MACRO_PATTERN_KIND                     // Macro kind for pattern nodes
	MACRO_TYPE_KIND                        // Macro kind for type nodes
)

type MacroNameNode

type MacroNameNode struct {
	TypedNodeBase
	Value string
}

Represents a macro name eg. `foo!`.

func NewMacroNameNode

func NewMacroNameNode(loc *position.Location, val string) *MacroNameNode

Create a new macro name node eg. `foo!`.

func (*MacroNameNode) Class

func (*MacroNameNode) Class() *value.Class

func (*MacroNameNode) DirectClass

func (*MacroNameNode) DirectClass() *value.Class

func (*MacroNameNode) Equal

func (n *MacroNameNode) Equal(other value.Value) bool

func (*MacroNameNode) Error

func (n *MacroNameNode) Error() string

func (*MacroNameNode) Inspect

func (n *MacroNameNode) Inspect() string

func (*MacroNameNode) IsStatic

func (*MacroNameNode) IsStatic() bool

func (*MacroNameNode) MacroType

func (n *MacroNameNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*MacroNameNode) String

func (n *MacroNameNode) String() string

type MapPatternNode

type MapPatternNode struct {
	TypedNodeBase
	Elements []PatternNode
}

Represents a Map pattern eg. `{ foo: 5, bar: a, 5 => >= 10 }`

func NewMapPatternNode

func NewMapPatternNode(loc *position.Location, elements []PatternNode) *MapPatternNode

Create a Map pattern node eg. `{ foo: 5, bar: a, 5 => >= 10 }`

func (*MapPatternNode) Class

func (*MapPatternNode) Class() *value.Class

func (*MapPatternNode) DirectClass

func (*MapPatternNode) DirectClass() *value.Class

func (*MapPatternNode) Equal

func (n *MapPatternNode) Equal(other value.Value) bool

func (*MapPatternNode) Error

func (n *MapPatternNode) Error() string

func (*MapPatternNode) Inspect

func (n *MapPatternNode) Inspect() string

func (*MapPatternNode) IsStatic

func (m *MapPatternNode) IsStatic() bool

func (*MapPatternNode) MacroType

func (n *MapPatternNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*MapPatternNode) String

func (n *MapPatternNode) String() string

type MatchExpressionNode

type MatchExpressionNode struct {
	TypedNodeBase
	Expression ExpressionNode // left hand side
	Pattern    PatternNode    // right hand side
}

An expression that matches a value against a pattern eg. `a match Foo(a: "lol", b: > 2)`

func NewMatchExpressionNode

func NewMatchExpressionNode(loc *position.Location, expression ExpressionNode, pattern PatternNode) *MatchExpressionNode

Create a new match expression node.

func (*MatchExpressionNode) Class

func (*MatchExpressionNode) Class() *value.Class

func (*MatchExpressionNode) DirectClass

func (*MatchExpressionNode) DirectClass() *value.Class

func (*MatchExpressionNode) Equal

func (n *MatchExpressionNode) Equal(other value.Value) bool

func (*MatchExpressionNode) Error

func (n *MatchExpressionNode) Error() string

func (*MatchExpressionNode) Inspect

func (n *MatchExpressionNode) Inspect() string

func (*MatchExpressionNode) IsStatic

func (b *MatchExpressionNode) IsStatic() bool

func (*MatchExpressionNode) MacroType

func (*MatchExpressionNode) String

func (n *MatchExpressionNode) String() string

type MethodCallNode

type MethodCallNode struct {
	TypedNodeBase
	Receiver            ExpressionNode
	Op                  *token.Token
	MethodName          IdentifierNode
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
	TailCall            bool
}

Represents a method call eg. `'123'.to_int()`

func NewMethodCallNode

func NewMethodCallNode(loc *position.Location, recv ExpressionNode, op *token.Token, methodName IdentifierNode, posArgs []ExpressionNode, namedArgs []NamedArgumentNode) *MethodCallNode

Create a method call node eg. `'123'.to_int()`

func (*MethodCallNode) Class

func (*MethodCallNode) Class() *value.Class

func (*MethodCallNode) DirectClass

func (*MethodCallNode) DirectClass() *value.Class

func (*MethodCallNode) Equal

func (n *MethodCallNode) Equal(other value.Value) bool

func (*MethodCallNode) Error

func (n *MethodCallNode) Error() string

func (*MethodCallNode) Inspect

func (n *MethodCallNode) Inspect() string

func (*MethodCallNode) IsStatic

func (*MethodCallNode) IsStatic() bool

func (*MethodCallNode) MacroType

func (n *MethodCallNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*MethodCallNode) String

func (n *MethodCallNode) String() string

type MethodDefinitionNode

type MethodDefinitionNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Name           IdentifierNode
	TypeParameters []TypeParameterNode
	Parameters     []ParameterNode // formal parameters
	ReturnType     TypeNode
	ThrowType      TypeNode
	Body           []StatementNode // body of the method
	Flags          bitfield.BitField8
}

Represents a method definition eg. `def foo: String then 'hello world'`

func NewMethodDefinitionNode

func NewMethodDefinitionNode(
	loc *position.Location,
	docComment string,
	flags bitfield.BitFlag8,
	name IdentifierNode,
	typeParams []TypeParameterNode,
	params []ParameterNode,
	returnType,
	throwType TypeNode,
	body []StatementNode,
) *MethodDefinitionNode

Create a method definition node eg. `def foo: String then 'hello world'`

func (*MethodDefinitionNode) Class

func (*MethodDefinitionNode) Class() *value.Class

func (*MethodDefinitionNode) DirectClass

func (*MethodDefinitionNode) DirectClass() *value.Class

func (*MethodDefinitionNode) Equal

func (n *MethodDefinitionNode) Equal(other value.Value) bool

Check if this method definition is equal to another value.

func (*MethodDefinitionNode) Error

func (p *MethodDefinitionNode) Error() string

func (*MethodDefinitionNode) Inspect

func (n *MethodDefinitionNode) Inspect() string

func (*MethodDefinitionNode) IsAbstract

func (m *MethodDefinitionNode) IsAbstract() bool

func (*MethodDefinitionNode) IsAsync

func (m *MethodDefinitionNode) IsAsync() bool

func (*MethodDefinitionNode) IsGenerator

func (m *MethodDefinitionNode) IsGenerator() bool

func (*MethodDefinitionNode) IsOverload

func (m *MethodDefinitionNode) IsOverload() bool

func (*MethodDefinitionNode) IsSealed

func (m *MethodDefinitionNode) IsSealed() bool

func (*MethodDefinitionNode) IsSetter

func (m *MethodDefinitionNode) IsSetter() bool

Whether the method is a setter.

func (*MethodDefinitionNode) IsStatic

func (*MethodDefinitionNode) IsStatic() bool

func (*MethodDefinitionNode) MacroType

func (*MethodDefinitionNode) SetAbstract

func (m *MethodDefinitionNode) SetAbstract()

func (*MethodDefinitionNode) SetAsync

func (m *MethodDefinitionNode) SetAsync()

func (*MethodDefinitionNode) SetGenerator

func (m *MethodDefinitionNode) SetGenerator()

func (*MethodDefinitionNode) SetOverload

func (m *MethodDefinitionNode) SetOverload()

func (*MethodDefinitionNode) SetSealed

func (m *MethodDefinitionNode) SetSealed()

func (*MethodDefinitionNode) String

func (n *MethodDefinitionNode) String() string

Return a string representation of this method definition.

type MethodLookupAsNode

type MethodLookupAsNode struct {
	NodeBase
	MethodLookup *MethodLookupNode
	AsName       IdentifierNode
}

Represents a method lookup with as in using declarations eg. `Foo::bar as baz`.

func NewMethodLookupAsNode

func NewMethodLookupAsNode(loc *position.Location, methodLookup *MethodLookupNode, as IdentifierNode) *MethodLookupAsNode

Create a new identifier with as eg. `Foo::bar as Bar`.

func (*MethodLookupAsNode) Class

func (*MethodLookupAsNode) Class() *value.Class

func (*MethodLookupAsNode) DirectClass

func (*MethodLookupAsNode) DirectClass() *value.Class

func (*MethodLookupAsNode) Equal

func (n *MethodLookupAsNode) Equal(other value.Value) bool

Check if this method lookup as node is equal to another value.

func (*MethodLookupAsNode) Error

func (n *MethodLookupAsNode) Error() string

func (*MethodLookupAsNode) Inspect

func (n *MethodLookupAsNode) Inspect() string

func (*MethodLookupAsNode) IsMacro

func (n *MethodLookupAsNode) IsMacro() bool

func (*MethodLookupAsNode) IsStatic

func (*MethodLookupAsNode) IsStatic() bool

func (*MethodLookupAsNode) MacroType

func (*MethodLookupAsNode) String

func (n *MethodLookupAsNode) String() string

Return a string representation of this method lookup as node.

type MethodLookupNode

type MethodLookupNode struct {
	TypedNodeBase
	Receiver ExpressionNode
	Name     IdentifierNode
}

Represents a method lookup expression eg. `Foo::bar`, `a::c`

func NewMethodLookupNode

func NewMethodLookupNode(loc *position.Location, receiver ExpressionNode, name IdentifierNode) *MethodLookupNode

Create a new method lookup expression node eg. `Foo::bar`, `a::c`

func (*MethodLookupNode) Class

func (*MethodLookupNode) Class() *value.Class

func (*MethodLookupNode) DirectClass

func (*MethodLookupNode) DirectClass() *value.Class

func (*MethodLookupNode) Equal

func (n *MethodLookupNode) Equal(other value.Value) bool

func (*MethodLookupNode) Error

func (n *MethodLookupNode) Error() string

func (*MethodLookupNode) Inspect

func (n *MethodLookupNode) Inspect() string

func (*MethodLookupNode) IsMacro

func (n *MethodLookupNode) IsMacro() bool

func (*MethodLookupNode) IsStatic

func (*MethodLookupNode) IsStatic() bool

func (*MethodLookupNode) MacroType

func (n *MethodLookupNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*MethodLookupNode) String

func (n *MethodLookupNode) String() string

type MethodParameterNode

type MethodParameterNode struct {
	TypedNodeBase
	Name                IdentifierNode // name of the variable
	TypeNode            TypeNode       // type of the variable
	Initialiser         ExpressionNode // value assigned to the variable
	SetInstanceVariable bool           // whether an instance variable with this name gets automatically assigned
	Kind                ParameterKind
}

Represents a formal parameter in method declarations eg. `foo: String = 'bar'`

func NewMethodParameterNode

func NewMethodParameterNode(loc *position.Location, name IdentifierNode, setIvar bool, typ TypeNode, init ExpressionNode, kind ParameterKind) *MethodParameterNode

Create a new formal parameter node eg. `foo: String = 'bar'`

func (*MethodParameterNode) Class

func (*MethodParameterNode) Class() *value.Class

func (*MethodParameterNode) DirectClass

func (*MethodParameterNode) DirectClass() *value.Class

func (*MethodParameterNode) Equal

func (n *MethodParameterNode) Equal(other value.Value) bool

func (*MethodParameterNode) Error

func (n *MethodParameterNode) Error() string

func (*MethodParameterNode) Inspect

func (n *MethodParameterNode) Inspect() string

func (*MethodParameterNode) IsOptional

func (f *MethodParameterNode) IsOptional() bool

func (*MethodParameterNode) IsStatic

func (*MethodParameterNode) IsStatic() bool

func (*MethodParameterNode) MacroType

func (*MethodParameterNode) String

func (n *MethodParameterNode) String() string

type MethodSignatureDefinitionNode

type MethodSignatureDefinitionNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Name           IdentifierNode
	TypeParameters []TypeParameterNode
	Parameters     []ParameterNode // formal parameters
	ReturnType     TypeNode
	ThrowType      TypeNode
}

Represents a method signature definition eg. `sig to_string(val: Int): String`

func NewMethodSignatureDefinitionNode

func NewMethodSignatureDefinitionNode(loc *position.Location, docComment string, name IdentifierNode, typeParams []TypeParameterNode, params []ParameterNode, returnType, throwType TypeNode) *MethodSignatureDefinitionNode

Create a method signature node eg. `sig to_string(val: Int): String`

func (*MethodSignatureDefinitionNode) Class

func (*MethodSignatureDefinitionNode) DirectClass

func (*MethodSignatureDefinitionNode) DirectClass() *value.Class

func (*MethodSignatureDefinitionNode) Equal

func (*MethodSignatureDefinitionNode) Error

func (*MethodSignatureDefinitionNode) Inspect

func (*MethodSignatureDefinitionNode) IsStatic

func (*MethodSignatureDefinitionNode) IsStatic() bool

func (*MethodSignatureDefinitionNode) MacroType

func (*MethodSignatureDefinitionNode) String

type MixinDeclarationNode

type MixinDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Abstract              bool
	Constant              ExpressionNode      // The constant that will hold the mixin value
	TypeParameters        []TypeParameterNode // Generic type variable definitions
	Body                  []StatementNode     // body of the mixin
	IncludesAndImplements []ExpressionNode
	Bytecode              value.Method
}

Represents a mixin declaration eg. `mixin Foo; end`

func NewMixinDeclarationNode

func NewMixinDeclarationNode(
	loc *position.Location,
	docComment string,
	abstract bool,
	constant ExpressionNode,
	typeParams []TypeParameterNode,
	body []StatementNode,
) *MixinDeclarationNode

Create a new mixin declaration node eg. `mixin Foo; end`

func (*MixinDeclarationNode) Class

func (*MixinDeclarationNode) Class() *value.Class

func (*MixinDeclarationNode) DirectClass

func (*MixinDeclarationNode) DirectClass() *value.Class

func (*MixinDeclarationNode) Equal

func (n *MixinDeclarationNode) Equal(other value.Value) bool

func (*MixinDeclarationNode) Error

func (n *MixinDeclarationNode) Error() string

func (*MixinDeclarationNode) Inspect

func (n *MixinDeclarationNode) Inspect() string

func (*MixinDeclarationNode) IsStatic

func (*MixinDeclarationNode) IsStatic() bool

func (*MixinDeclarationNode) MacroType

func (*MixinDeclarationNode) SkipTypechecking

func (*MixinDeclarationNode) SkipTypechecking() bool

func (*MixinDeclarationNode) String

func (n *MixinDeclarationNode) String() string

type ModifierForInNode

type ModifierForInNode struct {
	TypedNodeBase
	ThenExpression ExpressionNode // then expression body
	Pattern        PatternNode
	InExpression   ExpressionNode // expression that will be iterated through
}

Represents an `for .. in` modifier expression eg. `println(i) for i in 10..30`

func NewModifierForInNode

func NewModifierForInNode(loc *position.Location, then ExpressionNode, pattern PatternNode, in ExpressionNode) *ModifierForInNode

Create a new modifier `for` .. `in` node eg. `println(i) for i in 10..30`

func (*ModifierForInNode) Class

func (*ModifierForInNode) Class() *value.Class

func (*ModifierForInNode) DirectClass

func (*ModifierForInNode) DirectClass() *value.Class

func (*ModifierForInNode) Equal

func (n *ModifierForInNode) Equal(other value.Value) bool

func (*ModifierForInNode) Error

func (m *ModifierForInNode) Error() string

func (*ModifierForInNode) Inspect

func (n *ModifierForInNode) Inspect() string

func (*ModifierForInNode) IsStatic

func (*ModifierForInNode) IsStatic() bool

func (*ModifierForInNode) MacroType

func (n *ModifierForInNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*ModifierForInNode) String

func (n *ModifierForInNode) String() string

type ModifierIfElseNode

type ModifierIfElseNode struct {
	TypedNodeBase
	ThenExpression ExpressionNode // then expression body
	Condition      ExpressionNode // if condition
	ElseExpression ExpressionNode // else expression body
}

Represents an `if .. else` modifier expression eg. `foo = 1 if bar else foo = 2`

func NewModifierIfElseNode

func NewModifierIfElseNode(loc *position.Location, then, cond, els ExpressionNode) *ModifierIfElseNode

Create a new modifier `if` .. `else` node eg. `foo = 1 if bar else foo = 2“.

func (*ModifierIfElseNode) Class

func (*ModifierIfElseNode) Class() *value.Class

func (*ModifierIfElseNode) DirectClass

func (*ModifierIfElseNode) DirectClass() *value.Class

func (*ModifierIfElseNode) Equal

func (n *ModifierIfElseNode) Equal(other value.Value) bool

func (*ModifierIfElseNode) Error

func (m *ModifierIfElseNode) Error() string

func (*ModifierIfElseNode) Inspect

func (n *ModifierIfElseNode) Inspect() string

func (*ModifierIfElseNode) IsStatic

func (*ModifierIfElseNode) IsStatic() bool

func (*ModifierIfElseNode) MacroType

func (*ModifierIfElseNode) String

func (n *ModifierIfElseNode) String() string

type ModifierNode

type ModifierNode struct {
	TypedNodeBase
	Modifier *token.Token   // modifier token
	Left     ExpressionNode // left hand side
	Right    ExpressionNode // right hand side
}

Represents an `if`, `unless`, `while` or `until` modifier expression eg. `return true if foo`.

func NewModifierNode

func NewModifierNode(loc *position.Location, mod *token.Token, left, right ExpressionNode) *ModifierNode

Create a new modifier node eg. `return true if foo`.

func (*ModifierNode) Class

func (*ModifierNode) Class() *value.Class

func (*ModifierNode) DirectClass

func (*ModifierNode) DirectClass() *value.Class

func (*ModifierNode) Equal

func (n *ModifierNode) Equal(other value.Value) bool

func (*ModifierNode) Error

func (m *ModifierNode) Error() string

func (*ModifierNode) Inspect

func (n *ModifierNode) Inspect() string

func (*ModifierNode) IsStatic

func (*ModifierNode) IsStatic() bool

func (*ModifierNode) MacroType

func (n *ModifierNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*ModifierNode) String

func (n *ModifierNode) String() string

type ModuleDeclarationNode

type ModuleDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Constant ExpressionNode  // The constant that will hold the module value
	Body     []StatementNode // body of the module
	Bytecode value.Method
}

Represents a module declaration eg. `module Foo; end`

func NewModuleDeclarationNode

func NewModuleDeclarationNode(
	loc *position.Location,
	docComment string,
	constant ExpressionNode,
	body []StatementNode,
) *ModuleDeclarationNode

Create a new module declaration node eg. `module Foo; end`

func (*ModuleDeclarationNode) Class

func (*ModuleDeclarationNode) Class() *value.Class

func (*ModuleDeclarationNode) DirectClass

func (*ModuleDeclarationNode) DirectClass() *value.Class

func (*ModuleDeclarationNode) Equal

func (n *ModuleDeclarationNode) Equal(other value.Value) bool

func (*ModuleDeclarationNode) Error

func (n *ModuleDeclarationNode) Error() string

func (*ModuleDeclarationNode) Inspect

func (n *ModuleDeclarationNode) Inspect() string

func (*ModuleDeclarationNode) IsStatic

func (*ModuleDeclarationNode) IsStatic() bool

func (*ModuleDeclarationNode) MacroType

func (*ModuleDeclarationNode) SkipTypechecking

func (*ModuleDeclarationNode) SkipTypechecking() bool

func (*ModuleDeclarationNode) String

func (n *ModuleDeclarationNode) String() string

type MustExpressionNode

type MustExpressionNode struct {
	TypedNodeBase
	Value ExpressionNode
}

Represents a `must` expression eg. `must foo()`

func NewMustExpressionNode

func NewMustExpressionNode(loc *position.Location, val ExpressionNode) *MustExpressionNode

Create a new `must` expression node eg. `must foo()`

func (*MustExpressionNode) Class

func (*MustExpressionNode) Class() *value.Class

func (*MustExpressionNode) DirectClass

func (*MustExpressionNode) DirectClass() *value.Class

func (*MustExpressionNode) Equal

func (n *MustExpressionNode) Equal(other value.Value) bool

func (*MustExpressionNode) Error

func (n *MustExpressionNode) Error() string

func (*MustExpressionNode) Inspect

func (n *MustExpressionNode) Inspect() string

func (*MustExpressionNode) IsStatic

func (*MustExpressionNode) IsStatic() bool

func (*MustExpressionNode) MacroType

func (*MustExpressionNode) String

func (n *MustExpressionNode) String() string

type NamedArgumentNode

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

Nodes that implement this interface represent named arguments in method calls.

type NamedCallArgumentNode

type NamedCallArgumentNode struct {
	NodeBase
	Name  IdentifierNode
	Value ExpressionNode
}

Represents a named argument in a function call eg. `foo: 123`

func NewNamedCallArgumentNode

func NewNamedCallArgumentNode(loc *position.Location, name IdentifierNode, val ExpressionNode) *NamedCallArgumentNode

Create a named argument node eg. `foo: 123`

func (*NamedCallArgumentNode) Class

func (*NamedCallArgumentNode) Class() *value.Class

func (*NamedCallArgumentNode) DirectClass

func (*NamedCallArgumentNode) DirectClass() *value.Class

func (*NamedCallArgumentNode) Equal

func (n *NamedCallArgumentNode) Equal(other value.Value) bool

func (*NamedCallArgumentNode) Error

func (n *NamedCallArgumentNode) Error() string

func (*NamedCallArgumentNode) Inspect

func (n *NamedCallArgumentNode) Inspect() string

func (*NamedCallArgumentNode) IsStatic

func (*NamedCallArgumentNode) IsStatic() bool

func (*NamedCallArgumentNode) MacroType

func (*NamedCallArgumentNode) String

func (n *NamedCallArgumentNode) String() string

type NeverTypeNode

type NeverTypeNode struct {
	NodeBase
}

`never` type.

func NewNeverTypeNode

func NewNeverTypeNode(loc *position.Location) *NeverTypeNode

Create a new `never` type node.

func (*NeverTypeNode) Class

func (*NeverTypeNode) Class() *value.Class

func (*NeverTypeNode) DirectClass

func (*NeverTypeNode) DirectClass() *value.Class

func (*NeverTypeNode) Equal

func (n *NeverTypeNode) Equal(other value.Value) bool

func (*NeverTypeNode) Error

func (n *NeverTypeNode) Error() string

func (*NeverTypeNode) Inspect

func (n *NeverTypeNode) Inspect() string

func (*NeverTypeNode) IsStatic

func (*NeverTypeNode) IsStatic() bool

func (*NeverTypeNode) MacroType

func (n *NeverTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*NeverTypeNode) String

func (n *NeverTypeNode) String() string

func (*NeverTypeNode) Type

func (*NeverTypeNode) Type(globalEnv *types.GlobalEnvironment) types.Type

type NewExpressionNode

type NewExpressionNode struct {
	TypedNodeBase
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
}

Represents a new expression eg. `new(123)`

func NewNewExpressionNode

func NewNewExpressionNode(loc *position.Location, posArgs []ExpressionNode, namedArgs []NamedArgumentNode) *NewExpressionNode

Create a new expression node eg. `new(123)`

func (*NewExpressionNode) Class

func (*NewExpressionNode) Class() *value.Class

func (*NewExpressionNode) DirectClass

func (*NewExpressionNode) DirectClass() *value.Class

func (*NewExpressionNode) Equal

func (n *NewExpressionNode) Equal(other value.Value) bool

func (*NewExpressionNode) Error

func (n *NewExpressionNode) Error() string

func (*NewExpressionNode) Inspect

func (n *NewExpressionNode) Inspect() string

func (*NewExpressionNode) IsStatic

func (*NewExpressionNode) IsStatic() bool

func (*NewExpressionNode) MacroType

func (n *NewExpressionNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*NewExpressionNode) String

func (n *NewExpressionNode) String() string

type NilLiteralNode

type NilLiteralNode struct {
	NodeBase
}

`nil` literal.

func NewNilLiteralNode

func NewNilLiteralNode(loc *position.Location) *NilLiteralNode

Create a new `nil` literal node.

func (*NilLiteralNode) Class

func (*NilLiteralNode) Class() *value.Class

func (*NilLiteralNode) DirectClass

func (*NilLiteralNode) DirectClass() *value.Class

func (*NilLiteralNode) Equal

func (n *NilLiteralNode) Equal(other value.Value) bool

func (*NilLiteralNode) Error

func (n *NilLiteralNode) Error() string

func (*NilLiteralNode) Inspect

func (n *NilLiteralNode) Inspect() string

func (*NilLiteralNode) IsStatic

func (*NilLiteralNode) IsStatic() bool

func (*NilLiteralNode) MacroType

func (n *NilLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*NilLiteralNode) SetType

func (*NilLiteralNode) SetType(types.Type)

func (*NilLiteralNode) String

func (n *NilLiteralNode) String() string

func (*NilLiteralNode) Type

func (*NilLiteralNode) Type(globalEnv *types.GlobalEnvironment) types.Type

type NilSafeSubscriptExpressionNode

type NilSafeSubscriptExpressionNode struct {
	TypedNodeBase
	Receiver ExpressionNode
	Key      ExpressionNode
	// contains filtered or unexported fields
}

Represents nil-safe subscript access eg. `arr?[5]`

func NewNilSafeSubscriptExpressionNode

func NewNilSafeSubscriptExpressionNode(loc *position.Location, recv, key ExpressionNode) *NilSafeSubscriptExpressionNode

Create a nil-safe subscript expression node eg. `arr?[5]`

func (*NilSafeSubscriptExpressionNode) Class

func (*NilSafeSubscriptExpressionNode) DirectClass

func (*NilSafeSubscriptExpressionNode) DirectClass() *value.Class

func (*NilSafeSubscriptExpressionNode) Equal

func (*NilSafeSubscriptExpressionNode) Error

func (*NilSafeSubscriptExpressionNode) Inspect

func (*NilSafeSubscriptExpressionNode) IsStatic

func (s *NilSafeSubscriptExpressionNode) IsStatic() bool

func (*NilSafeSubscriptExpressionNode) MacroType

func (*NilSafeSubscriptExpressionNode) String

type NilableTypeNode

type NilableTypeNode struct {
	TypedNodeBase
	TypeNode TypeNode // right hand side
}

Represents an optional or nilable type eg. `String?`

func NewNilableTypeNode

func NewNilableTypeNode(loc *position.Location, typ TypeNode) *NilableTypeNode

Create a new nilable type node eg. `String?`

func (*NilableTypeNode) Class

func (*NilableTypeNode) Class() *value.Class

func (*NilableTypeNode) DirectClass

func (*NilableTypeNode) DirectClass() *value.Class

func (*NilableTypeNode) Equal

func (n *NilableTypeNode) Equal(other value.Value) bool

func (*NilableTypeNode) Error

func (n *NilableTypeNode) Error() string

func (*NilableTypeNode) Inspect

func (n *NilableTypeNode) Inspect() string

func (*NilableTypeNode) IsStatic

func (*NilableTypeNode) IsStatic() bool

func (*NilableTypeNode) MacroType

func (n *NilableTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*NilableTypeNode) String

func (n *NilableTypeNode) String() string

type Node

type Node interface {
	position.LocationInterface
	value.Reference
	IsStatic() bool // Value is known at compile-time
	// Return the static type of the value represented
	// by the AST node
	Type(*types.GlobalEnvironment) types.Type
	SetType(types.Type)
	SkipTypechecking() bool
	Equal(value.Value) bool
	String() string
	// Return the type of the AST node object
	// for use in macros
	MacroType(*types.GlobalEnvironment) types.Type
	// contains filtered or unexported methods
}

Every node type implements this interface.

func DeepCopy

func DeepCopy(node Node) Node

Create a deep copy of the AST node

func Splice

func Splice(node Node, loc *position.Location, args *[]Node) Node

Create a copy of AST replacing consecutive unquote nodes with the given arguments

type NodeBase

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

Base AST node.

func (*NodeBase) Class

func (n *NodeBase) Class() *value.Class

func (*NodeBase) Copy

func (n *NodeBase) Copy() value.Reference

func (*NodeBase) DirectClass

func (n *NodeBase) DirectClass() *value.Class

func (*NodeBase) Error

func (n *NodeBase) Error() string

func (*NodeBase) Inspect

func (n *NodeBase) Inspect() string

func (*NodeBase) InstanceVariables

func (n *NodeBase) InstanceVariables() *value.InstanceVariables

func (*NodeBase) Location

func (n *NodeBase) Location() *position.Location

func (*NodeBase) SetLocation

func (n *NodeBase) SetLocation(loc *position.Location)

func (*NodeBase) SetSpan

func (t *NodeBase) SetSpan(span *position.Span)

func (*NodeBase) SetType

func (*NodeBase) SetType(types.Type)

func (*NodeBase) SingletonClass

func (n *NodeBase) SingletonClass() *value.Class

func (*NodeBase) SkipTypechecking

func (t *NodeBase) SkipTypechecking() bool

func (*NodeBase) Span

func (t *NodeBase) Span() *position.Span

func (*NodeBase) Type

func (*NodeBase) Type(globalEnv *types.GlobalEnvironment) types.Type

type NotTypeNode

type NotTypeNode struct {
	TypedNodeBase
	TypeNode TypeNode // right hand side
}

Represents a not type eg. `~String`

func NewNotTypeNode

func NewNotTypeNode(loc *position.Location, typ TypeNode) *NotTypeNode

Create a new not type node eg. `~String`

func (*NotTypeNode) Class

func (*NotTypeNode) Class() *value.Class

func (*NotTypeNode) DirectClass

func (*NotTypeNode) DirectClass() *value.Class

func (*NotTypeNode) Equal

func (n *NotTypeNode) Equal(other value.Value) bool

func (*NotTypeNode) Error

func (n *NotTypeNode) Error() string

func (*NotTypeNode) Inspect

func (n *NotTypeNode) Inspect() string

func (*NotTypeNode) IsStatic

func (*NotTypeNode) IsStatic() bool

func (*NotTypeNode) MacroType

func (n *NotTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*NotTypeNode) String

func (n *NotTypeNode) String() string

type NumericForExpressionNode

type NumericForExpressionNode struct {
	TypedNodeBase
	Initialiser ExpressionNode  // i := 0
	Condition   ExpressionNode  // i < 10
	Increment   ExpressionNode  // i += 1
	ThenBody    []StatementNode // then expression body
}

Represents a numeric `for` expression eg. `fornum i := 0; i < 10; i += 1 then println(i)`

func NewNumericForExpressionNode

func NewNumericForExpressionNode(loc *position.Location, init, cond, incr ExpressionNode, then []StatementNode) *NumericForExpressionNode

Create a new numeric `fornum` expression eg. `for i := 0; i < 10; i += 1 then println(i)`

func (*NumericForExpressionNode) Class

func (*NumericForExpressionNode) DirectClass

func (*NumericForExpressionNode) DirectClass() *value.Class

func (*NumericForExpressionNode) Equal

func (n *NumericForExpressionNode) Equal(other value.Value) bool

func (*NumericForExpressionNode) Error

func (n *NumericForExpressionNode) Error() string

func (*NumericForExpressionNode) Inspect

func (n *NumericForExpressionNode) Inspect() string

func (*NumericForExpressionNode) IsStatic

func (*NumericForExpressionNode) IsStatic() bool

func (*NumericForExpressionNode) MacroType

func (*NumericForExpressionNode) String

func (n *NumericForExpressionNode) String() string

type ObjectPatternNode

type ObjectPatternNode struct {
	TypedNodeBase
	ObjectType ComplexConstantNode
	Attributes []PatternNode
}

Represents an Object pattern eg. `Foo(foo: 5, bar: a, c)`

func NewObjectPatternNode

func NewObjectPatternNode(loc *position.Location, objectType ComplexConstantNode, attrs []PatternNode) *ObjectPatternNode

Create an Object pattern node eg. `Foo(foo: 5, bar: a, c)`

func (*ObjectPatternNode) Class

func (*ObjectPatternNode) Class() *value.Class

func (*ObjectPatternNode) DirectClass

func (*ObjectPatternNode) DirectClass() *value.Class

func (*ObjectPatternNode) Equal

func (n *ObjectPatternNode) Equal(other value.Value) bool

func (*ObjectPatternNode) Error

func (n *ObjectPatternNode) Error() string

func (*ObjectPatternNode) Inspect

func (n *ObjectPatternNode) Inspect() string

func (*ObjectPatternNode) IsStatic

func (m *ObjectPatternNode) IsStatic() bool

func (*ObjectPatternNode) MacroType

func (n *ObjectPatternNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*ObjectPatternNode) String

func (n *ObjectPatternNode) String() string

type ParameterKind

type ParameterKind uint8

Indicates whether the parameter is a rest param

const (
	NormalParameterKind ParameterKind = iota
	PositionalRestParameterKind
	NamedRestParameterKind
)

type ParameterNode

type ParameterNode interface {
	Node

	IsOptional() bool
	// contains filtered or unexported methods
}

All nodes that should be valid in parameter declaration lists of methods or functions should implement this interface.

type ParameterStatementNode

type ParameterStatementNode struct {
	NodeBase
	Parameter ParameterNode
}

Formal parameter optionally terminated with a newline or a semicolon.

func NewParameterStatementNode

func NewParameterStatementNode(loc *position.Location, param ParameterNode) *ParameterStatementNode

Create a new formal parameter statement node eg. `foo: Bar\n`

func (*ParameterStatementNode) Class

func (*ParameterStatementNode) DirectClass

func (*ParameterStatementNode) DirectClass() *value.Class

func (*ParameterStatementNode) Equal

func (n *ParameterStatementNode) Equal(other value.Value) bool

func (*ParameterStatementNode) Error

func (e *ParameterStatementNode) Error() string

func (*ParameterStatementNode) Inspect

func (n *ParameterStatementNode) Inspect() string

func (*ParameterStatementNode) IsStatic

func (*ParameterStatementNode) IsStatic() bool

func (*ParameterStatementNode) MacroType

func (*ParameterStatementNode) String

func (n *ParameterStatementNode) String() string

Return a string representation of the node.

type PatternExpressionNode

type PatternExpressionNode struct {
	NodeBase
	PatternNode PatternNode
}

Represents a pattern expression `pattern String?`

func NewPatternExpressionNode

func NewPatternExpressionNode(loc *position.Location, patternNode PatternNode) *PatternExpressionNode

Create a new pattern expression `pattern Foo(a: String, b: > 2)`

func (*PatternExpressionNode) Class

func (*PatternExpressionNode) Class() *value.Class

func (*PatternExpressionNode) DirectClass

func (*PatternExpressionNode) DirectClass() *value.Class

func (*PatternExpressionNode) Equal

func (n *PatternExpressionNode) Equal(other value.Value) bool

func (*PatternExpressionNode) Error

func (n *PatternExpressionNode) Error() string

func (*PatternExpressionNode) Inspect

func (n *PatternExpressionNode) Inspect() string

func (*PatternExpressionNode) IsStatic

func (*PatternExpressionNode) IsStatic() bool

func (*PatternExpressionNode) MacroType

func (*PatternExpressionNode) String

func (n *PatternExpressionNode) String() string

type PatternNode

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

All nodes that should be valid in pattern matching should implement this interface

func NewBinaryPatternNodeI

func NewBinaryPatternNodeI(loc *position.Location, op *token.Token, left, right PatternNode) PatternNode

Same as NewBinaryPatternNode but returns an interface

func NewInvalidPatternNode

func NewInvalidPatternNode(loc *position.Location, tok *token.Token) PatternNode

func NewListPatternNodeI

func NewListPatternNodeI(loc *position.Location, elements []PatternNode) PatternNode

Same as NewListPatternNode but returns an interface

func NewMapPatternNodeI

func NewMapPatternNodeI(loc *position.Location, elements []PatternNode) PatternNode

Same as NewMapPatternNode but returns an interface

func NewRecordPatternNodeI

func NewRecordPatternNodeI(loc *position.Location, elements []PatternNode) PatternNode

Same as NewRecordPatternNode but returns an interface

func NewSetPatternNodeI

func NewSetPatternNodeI(loc *position.Location, elements []PatternNode) PatternNode

Same as NewSetPatternNode but returns an interface

func NewTuplePatternNodeI

func NewTuplePatternNodeI(loc *position.Location, elements []PatternNode) PatternNode

Same as NewTuplePatternNode but returns an interface

type PatternStatementNode

type PatternStatementNode struct {
	NodeBase
	Pattern PatternNode
}

Pattern optionally terminated with a newline or a semicolon.

func NewPatternStatementNode

func NewPatternStatementNode(loc *position.Location, pattern PatternNode) *PatternStatementNode

Create a new pattern statement node eg. `Foo(n: 1 || nil)\n`

func (*PatternStatementNode) Class

func (*PatternStatementNode) Class() *value.Class

func (*PatternStatementNode) DirectClass

func (*PatternStatementNode) DirectClass() *value.Class

func (*PatternStatementNode) Equal

func (n *PatternStatementNode) Equal(other value.Value) bool

func (*PatternStatementNode) Error

func (e *PatternStatementNode) Error() string

func (*PatternStatementNode) Inspect

func (n *PatternStatementNode) Inspect() string

func (*PatternStatementNode) IsStatic

func (*PatternStatementNode) IsStatic() bool

func (*PatternStatementNode) MacroType

func (*PatternStatementNode) String

func (n *PatternStatementNode) String() string

Return a string representation of the node.

type PatternTypeExpressionNode

type PatternTypeExpressionNode interface {
	Node
	ExpressionNode
	PatternNode
	TypeNode
}

type PostfixExpressionNode

type PostfixExpressionNode struct {
	TypedNodeBase
	Op         *token.Token // operator
	Expression ExpressionNode
}

Postfix expression eg. `foo++`, `bar--`

func NewPostfixExpressionNode

func NewPostfixExpressionNode(loc *position.Location, op *token.Token, expr ExpressionNode) *PostfixExpressionNode

Create a new postfix expression node.

func (*PostfixExpressionNode) Class

func (*PostfixExpressionNode) Class() *value.Class

func (*PostfixExpressionNode) DirectClass

func (*PostfixExpressionNode) DirectClass() *value.Class

func (*PostfixExpressionNode) Equal

func (n *PostfixExpressionNode) Equal(other value.Value) bool

func (*PostfixExpressionNode) Error

func (p *PostfixExpressionNode) Error() string

func (*PostfixExpressionNode) Inspect

func (n *PostfixExpressionNode) Inspect() string

func (*PostfixExpressionNode) IsStatic

func (i *PostfixExpressionNode) IsStatic() bool

func (*PostfixExpressionNode) MacroType

func (*PostfixExpressionNode) String

func (n *PostfixExpressionNode) String() string

type PrivateConstantNode

type PrivateConstantNode struct {
	TypedNodeBase
	Value string
}

Represents a private constant eg. `_Foo`

func NewPrivateConstantNode

func NewPrivateConstantNode(loc *position.Location, val string) *PrivateConstantNode

Create a new private constant node eg. `_Foo`.

func (*PrivateConstantNode) Class

func (*PrivateConstantNode) Class() *value.Class

func (*PrivateConstantNode) DirectClass

func (*PrivateConstantNode) DirectClass() *value.Class

func (*PrivateConstantNode) Equal

func (n *PrivateConstantNode) Equal(other value.Value) bool

func (*PrivateConstantNode) Error

func (n *PrivateConstantNode) Error() string

func (*PrivateConstantNode) Inspect

func (n *PrivateConstantNode) Inspect() string

func (*PrivateConstantNode) IsStatic

func (*PrivateConstantNode) IsStatic() bool

func (*PrivateConstantNode) MacroType

func (*PrivateConstantNode) String

func (n *PrivateConstantNode) String() string

type PrivateIdentifierNode

type PrivateIdentifierNode struct {
	TypedNodeBase
	Value string
}

Represents a private identifier eg. `_foo`

func NewPrivateIdentifierNode

func NewPrivateIdentifierNode(loc *position.Location, val string) *PrivateIdentifierNode

Create a new private identifier node eg. `_foo`.

func (*PrivateIdentifierNode) Class

func (*PrivateIdentifierNode) Class() *value.Class

func (*PrivateIdentifierNode) DirectClass

func (*PrivateIdentifierNode) DirectClass() *value.Class

func (*PrivateIdentifierNode) Equal

func (n *PrivateIdentifierNode) Equal(other value.Value) bool

func (*PrivateIdentifierNode) Error

func (n *PrivateIdentifierNode) Error() string

func (*PrivateIdentifierNode) Inspect

func (n *PrivateIdentifierNode) Inspect() string

func (*PrivateIdentifierNode) IsStatic

func (*PrivateIdentifierNode) IsStatic() bool

func (*PrivateIdentifierNode) MacroType

func (*PrivateIdentifierNode) String

func (n *PrivateIdentifierNode) String() string

type ProgramNode

type ProgramNode struct {
	NodeBase
	Body        []StatementNode
	ImportPaths []string
	State       ProgramState
}

Represents a single Elk program (usually a single file).

func NewProgramNode

func NewProgramNode(loc *position.Location, body []StatementNode) *ProgramNode

Create a new program node.

func (*ProgramNode) Class

func (*ProgramNode) Class() *value.Class

func (*ProgramNode) DirectClass

func (*ProgramNode) DirectClass() *value.Class

func (*ProgramNode) Equal

func (n *ProgramNode) Equal(other value.Value) bool

func (*ProgramNode) Error

func (p *ProgramNode) Error() string

func (*ProgramNode) Inspect

func (n *ProgramNode) Inspect() string

func (*ProgramNode) IsStatic

func (*ProgramNode) IsStatic() bool

func (*ProgramNode) MacroType

func (n *ProgramNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*ProgramNode) String

func (n *ProgramNode) String() string

type ProgramState

type ProgramState uint8
const (
	UNCHECKED ProgramState = iota
	CHECKING_NAMESPACES
	CHECKED_NAMESPACES

	EXPANDING_TOP_LEVEL_MACROS
	EXPANDED_TOP_LEVEL_MACROS

	CHECKING_METHODS
	CHECKED_METHODS

	CHECKING_EXPRESSIONS
	CHECKED_EXPRESSIONS
)

type PublicConstantAsNode

type PublicConstantAsNode struct {
	NodeBase
	Target *PublicConstantNode
	AsName string
}

Represents a constant with as in using declarations eg. `Foo as Bar`.

func NewPublicConstantAsNode

func NewPublicConstantAsNode(loc *position.Location, target *PublicConstantNode, as string) *PublicConstantAsNode

Create a new identifier with as eg. `Foo as Bar`.

func (*PublicConstantAsNode) Class

func (*PublicConstantAsNode) Class() *value.Class

func (*PublicConstantAsNode) DirectClass

func (*PublicConstantAsNode) DirectClass() *value.Class

func (*PublicConstantAsNode) Equal

func (n *PublicConstantAsNode) Equal(other value.Value) bool

func (*PublicConstantAsNode) Error

func (n *PublicConstantAsNode) Error() string

func (*PublicConstantAsNode) Inspect

func (n *PublicConstantAsNode) Inspect() string

func (*PublicConstantAsNode) IsStatic

func (*PublicConstantAsNode) IsStatic() bool

func (*PublicConstantAsNode) MacroType

func (*PublicConstantAsNode) String

func (n *PublicConstantAsNode) String() string

type PublicConstantNode

type PublicConstantNode struct {
	TypedNodeBase
	Value string
}

Represents a public constant eg. `Foo`.

func NewPublicConstantNode

func NewPublicConstantNode(loc *position.Location, val string) *PublicConstantNode

Create a new public constant node eg. `Foo`.

func (*PublicConstantNode) Class

func (*PublicConstantNode) Class() *value.Class

func (*PublicConstantNode) DirectClass

func (*PublicConstantNode) DirectClass() *value.Class

func (*PublicConstantNode) Equal

func (n *PublicConstantNode) Equal(other value.Value) bool

func (*PublicConstantNode) Error

func (n *PublicConstantNode) Error() string

func (*PublicConstantNode) Inspect

func (n *PublicConstantNode) Inspect() string

func (*PublicConstantNode) IsStatic

func (*PublicConstantNode) IsStatic() bool

func (*PublicConstantNode) MacroType

func (*PublicConstantNode) String

func (n *PublicConstantNode) String() string

type PublicIdentifierNode

type PublicIdentifierNode struct {
	TypedNodeBase
	Value string
}

Represents a public identifier eg. `foo`.

func NewPublicIdentifierNode

func NewPublicIdentifierNode(loc *position.Location, val string) *PublicIdentifierNode

Create a new public identifier node eg. `foo`.

func (*PublicIdentifierNode) Class

func (*PublicIdentifierNode) Class() *value.Class

func (*PublicIdentifierNode) DirectClass

func (*PublicIdentifierNode) DirectClass() *value.Class

func (*PublicIdentifierNode) Equal

func (n *PublicIdentifierNode) Equal(other value.Value) bool

func (*PublicIdentifierNode) Error

func (n *PublicIdentifierNode) Error() string

func (*PublicIdentifierNode) Inspect

func (n *PublicIdentifierNode) Inspect() string

func (*PublicIdentifierNode) IsStatic

func (*PublicIdentifierNode) IsStatic() bool

func (*PublicIdentifierNode) MacroType

func (*PublicIdentifierNode) String

func (n *PublicIdentifierNode) String() string

type PublicInstanceVariableNode

type PublicInstanceVariableNode struct {
	TypedNodeBase
	Value string
}

Represents an instance variable eg. `@foo`

func NewPublicInstanceVariableNode

func NewPublicInstanceVariableNode(loc *position.Location, val string) *PublicInstanceVariableNode

Create an instance variable node eg. `@foo`.

func (*PublicInstanceVariableNode) Class

func (*PublicInstanceVariableNode) DirectClass

func (*PublicInstanceVariableNode) DirectClass() *value.Class

func (*PublicInstanceVariableNode) Equal

func (n *PublicInstanceVariableNode) Equal(other value.Value) bool

func (*PublicInstanceVariableNode) Error

func (*PublicInstanceVariableNode) Inspect

func (i *PublicInstanceVariableNode) Inspect() string

func (*PublicInstanceVariableNode) IsStatic

func (*PublicInstanceVariableNode) IsStatic() bool

func (*PublicInstanceVariableNode) MacroType

func (*PublicInstanceVariableNode) String

func (n *PublicInstanceVariableNode) String() string

type QuoteExpressionNode

type QuoteExpressionNode struct {
	TypedNodeBase
	Kind QuoteKind
	Body []StatementNode
}

Represents a quoted piecie of AST

func NewQuoteExpressionNode

func NewQuoteExpressionNode(loc *position.Location, kind QuoteKind, body []StatementNode) *QuoteExpressionNode

Create a quote expression node eg.

quote
	print("awesome!")
end

func (*QuoteExpressionNode) Class

func (*QuoteExpressionNode) Class() *value.Class

func (*QuoteExpressionNode) DirectClass

func (*QuoteExpressionNode) DirectClass() *value.Class

func (*QuoteExpressionNode) Equal

func (n *QuoteExpressionNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*QuoteExpressionNode) Error

func (n *QuoteExpressionNode) Error() string

func (*QuoteExpressionNode) Inspect

func (n *QuoteExpressionNode) Inspect() string

func (*QuoteExpressionNode) IsStatic

func (*QuoteExpressionNode) IsStatic() bool

func (*QuoteExpressionNode) MacroType

func (*QuoteExpressionNode) SingleExpression

func (n *QuoteExpressionNode) SingleExpression() ExpressionNode

Check if the quote block consists of a single expression statement, if so retrieves it and returns the expression. Otherwise returns nil.

func (*QuoteExpressionNode) String

func (n *QuoteExpressionNode) String() string

Return a string representation of the node.

type QuoteKind

type QuoteKind uint8
const (
	QUOTE_EXPRESSION_KIND QuoteKind = iota // Default kind of quote for expression nodes
	QUOTE_PATTERN_KIND                     // Quote kind for pattern nodes
	QUOTE_TYPE_KIND                        // Quote kind for type nodes
)

type RangeLiteralNode

type RangeLiteralNode struct {
	TypedNodeBase
	Start ExpressionNode
	End   ExpressionNode
	Op    *token.Token
	// contains filtered or unexported fields
}

Represents a Range literal eg. `1...5`

func NewRangeLiteralNode

func NewRangeLiteralNode(loc *position.Location, op *token.Token, start, end ExpressionNode) *RangeLiteralNode

Create a Range literal node eg. `1...5`

func (*RangeLiteralNode) Class

func (*RangeLiteralNode) Class() *value.Class

func (*RangeLiteralNode) DirectClass

func (*RangeLiteralNode) DirectClass() *value.Class

func (*RangeLiteralNode) Equal

func (n *RangeLiteralNode) Equal(other value.Value) bool

func (*RangeLiteralNode) Error

func (n *RangeLiteralNode) Error() string

func (*RangeLiteralNode) Inspect

func (n *RangeLiteralNode) Inspect() string

func (*RangeLiteralNode) IsStatic

func (r *RangeLiteralNode) IsStatic() bool

func (*RangeLiteralNode) MacroType

func (n *RangeLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*RangeLiteralNode) String

func (n *RangeLiteralNode) String() string

type RawCharLiteralNode

type RawCharLiteralNode struct {
	TypedNodeBase
	Value rune // value of the char literal
}

Raw Char literal eg. r`a`

func NewRawCharLiteralNode

func NewRawCharLiteralNode(loc *position.Location, val rune) *RawCharLiteralNode

Create a new raw char literal node eg. r`a`

func (*RawCharLiteralNode) Class

func (*RawCharLiteralNode) Class() *value.Class

func (*RawCharLiteralNode) DirectClass

func (*RawCharLiteralNode) DirectClass() *value.Class

func (*RawCharLiteralNode) Equal

func (n *RawCharLiteralNode) Equal(other value.Value) bool

func (*RawCharLiteralNode) Error

func (n *RawCharLiteralNode) Error() string

func (*RawCharLiteralNode) Inspect

func (n *RawCharLiteralNode) Inspect() string

func (*RawCharLiteralNode) IsStatic

func (*RawCharLiteralNode) IsStatic() bool

func (*RawCharLiteralNode) MacroType

func (*RawCharLiteralNode) String

func (n *RawCharLiteralNode) String() string

type RawStringLiteralNode

type RawStringLiteralNode struct {
	TypedNodeBase
	Value string // value of the string literal
}

Raw string literal enclosed with single quotes eg. `'foo'`.

func NewRawStringLiteralNode

func NewRawStringLiteralNode(loc *position.Location, val string) *RawStringLiteralNode

Create a new raw string literal node eg. `'foo'`.

func (*RawStringLiteralNode) Class

func (*RawStringLiteralNode) Class() *value.Class

func (*RawStringLiteralNode) DirectClass

func (*RawStringLiteralNode) DirectClass() *value.Class

func (*RawStringLiteralNode) Equal

func (n *RawStringLiteralNode) Equal(other value.Value) bool

func (*RawStringLiteralNode) Error

func (n *RawStringLiteralNode) Error() string

func (*RawStringLiteralNode) Inspect

func (n *RawStringLiteralNode) Inspect() string

func (*RawStringLiteralNode) IsStatic

func (*RawStringLiteralNode) IsStatic() bool

func (*RawStringLiteralNode) MacroType

func (*RawStringLiteralNode) String

func (n *RawStringLiteralNode) String() string

type ReceiverlessMacroCallNode

type ReceiverlessMacroCallNode struct {
	TypedNodeBase
	Kind                MacroKind
	MacroName           IdentifierNode
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
}

Represents a function-like macro call eg. `foo!(123)`

func NewReceiverlessMacroCallNode

func NewReceiverlessMacroCallNode(
	loc *position.Location,
	kind MacroKind,
	macroName IdentifierNode,
	posArgs []ExpressionNode,
	namedArgs []NamedArgumentNode,
) *ReceiverlessMacroCallNode

Create a function call node eg. `to_string(123)`

func (*ReceiverlessMacroCallNode) Class

func (*ReceiverlessMacroCallNode) DirectClass

func (*ReceiverlessMacroCallNode) DirectClass() *value.Class

func (*ReceiverlessMacroCallNode) Equal

func (n *ReceiverlessMacroCallNode) Equal(other value.Value) bool

func (*ReceiverlessMacroCallNode) Error

func (n *ReceiverlessMacroCallNode) Error() string

func (*ReceiverlessMacroCallNode) Inspect

func (n *ReceiverlessMacroCallNode) Inspect() string

func (*ReceiverlessMacroCallNode) IsStatic

func (*ReceiverlessMacroCallNode) IsStatic() bool

func (*ReceiverlessMacroCallNode) MacroType

func (*ReceiverlessMacroCallNode) String

func (n *ReceiverlessMacroCallNode) String() string

type ReceiverlessMethodCallNode

type ReceiverlessMethodCallNode struct {
	TypedNodeBase
	MethodName          IdentifierNode
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
	TailCall            bool
}

Represents a function-like call eg. `to_string(123)`

func NewReceiverlessMethodCallNode

func NewReceiverlessMethodCallNode(loc *position.Location, methodName IdentifierNode, posArgs []ExpressionNode, namedArgs []NamedArgumentNode) *ReceiverlessMethodCallNode

Create a function call node eg. `to_string(123)`

func (*ReceiverlessMethodCallNode) Class

func (*ReceiverlessMethodCallNode) DirectClass

func (*ReceiverlessMethodCallNode) DirectClass() *value.Class

func (*ReceiverlessMethodCallNode) Equal

func (n *ReceiverlessMethodCallNode) Equal(other value.Value) bool

func (*ReceiverlessMethodCallNode) Error

func (*ReceiverlessMethodCallNode) Inspect

func (n *ReceiverlessMethodCallNode) Inspect() string

func (*ReceiverlessMethodCallNode) IsStatic

func (*ReceiverlessMethodCallNode) IsStatic() bool

func (*ReceiverlessMethodCallNode) MacroType

func (*ReceiverlessMethodCallNode) String

func (n *ReceiverlessMethodCallNode) String() string

type RecordPatternNode

type RecordPatternNode struct {
	NodeBase
	Elements []PatternNode
}

Represents a Record pattern eg. `%{ foo: 5, bar: a, 5 => >= 10 }`

func NewRecordPatternNode

func NewRecordPatternNode(loc *position.Location, elements []PatternNode) *RecordPatternNode

Create a Record pattern node eg. `%{ foo: 5, bar: a, 5 => >= 10 }`

func (*RecordPatternNode) Class

func (*RecordPatternNode) Class() *value.Class

func (*RecordPatternNode) DirectClass

func (*RecordPatternNode) DirectClass() *value.Class

func (*RecordPatternNode) Equal

func (n *RecordPatternNode) Equal(other value.Value) bool

func (*RecordPatternNode) Error

func (n *RecordPatternNode) Error() string

func (*RecordPatternNode) Inspect

func (n *RecordPatternNode) Inspect() string

func (*RecordPatternNode) IsStatic

func (m *RecordPatternNode) IsStatic() bool

func (*RecordPatternNode) MacroType

func (n *RecordPatternNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*RecordPatternNode) String

func (n *RecordPatternNode) String() string

type RegexInterpolationNode

type RegexInterpolationNode struct {
	NodeBase
	Expression ExpressionNode
}

Represents a single interpolated section of a regex literal eg. `bar + 2` in `%/foo${bar + 2}/`

func NewRegexInterpolationNode

func NewRegexInterpolationNode(loc *position.Location, expr ExpressionNode) *RegexInterpolationNode

Create a new regex interpolation node eg. `bar + 2` in `%/foo${bar + 2}/`

func (*RegexInterpolationNode) Class

func (*RegexInterpolationNode) DirectClass

func (*RegexInterpolationNode) DirectClass() *value.Class

func (*RegexInterpolationNode) Equal

func (n *RegexInterpolationNode) Equal(other value.Value) bool

func (*RegexInterpolationNode) Error

func (n *RegexInterpolationNode) Error() string

func (*RegexInterpolationNode) Inspect

func (n *RegexInterpolationNode) Inspect() string

func (*RegexInterpolationNode) IsStatic

func (*RegexInterpolationNode) IsStatic() bool

func (*RegexInterpolationNode) MacroType

func (*RegexInterpolationNode) String

func (n *RegexInterpolationNode) String() string

type RegexLiteralContentNode

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

Nodes that implement this interface can appear inside of a Regex literal.

type RegexLiteralContentSectionNode

type RegexLiteralContentSectionNode struct {
	NodeBase
	Value string
}

Represents a single section of characters of a regex literal eg. `foo` in `%/foo${bar}/`.

func NewRegexLiteralContentSectionNode

func NewRegexLiteralContentSectionNode(loc *position.Location, val string) *RegexLiteralContentSectionNode

Create a new regex literal content section node eg. `foo` in `%/foo${bar}/`.

func (*RegexLiteralContentSectionNode) Class

func (*RegexLiteralContentSectionNode) DirectClass

func (*RegexLiteralContentSectionNode) DirectClass() *value.Class

func (*RegexLiteralContentSectionNode) Equal

func (*RegexLiteralContentSectionNode) Error

func (*RegexLiteralContentSectionNode) Inspect

func (*RegexLiteralContentSectionNode) IsStatic

func (*RegexLiteralContentSectionNode) MacroType

func (*RegexLiteralContentSectionNode) String

type RegexLiteralNode

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

All nodes that represent regexes should implement this interface.

type RestPatternNode

type RestPatternNode struct {
	NodeBase
	Identifier IdentifierNode
}

Represents a rest element in a list pattern eg. `*a`

func NewRestPatternNode

func NewRestPatternNode(loc *position.Location, ident IdentifierNode) *RestPatternNode

Create a rest pattern node eg. `*a`

func (*RestPatternNode) Class

func (*RestPatternNode) Class() *value.Class

func (*RestPatternNode) DirectClass

func (*RestPatternNode) DirectClass() *value.Class

func (*RestPatternNode) Equal

func (n *RestPatternNode) Equal(other value.Value) bool

func (*RestPatternNode) Error

func (n *RestPatternNode) Error() string

func (*RestPatternNode) Inspect

func (n *RestPatternNode) Inspect() string

func (*RestPatternNode) IsStatic

func (r *RestPatternNode) IsStatic() bool

func (*RestPatternNode) MacroType

func (n *RestPatternNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*RestPatternNode) String

func (n *RestPatternNode) String() string

type ReturnExpressionNode

type ReturnExpressionNode struct {
	NodeBase
	Value ExpressionNode
}

Represents a `return` expression eg. `return`, `return true`

func NewReturnExpressionNode

func NewReturnExpressionNode(loc *position.Location, val ExpressionNode) *ReturnExpressionNode

Create a new `return` expression node eg. `return`, `return true`

func (*ReturnExpressionNode) Class

func (*ReturnExpressionNode) Class() *value.Class

func (*ReturnExpressionNode) DirectClass

func (*ReturnExpressionNode) DirectClass() *value.Class

func (*ReturnExpressionNode) Equal

func (n *ReturnExpressionNode) Equal(other value.Value) bool

func (*ReturnExpressionNode) Error

func (n *ReturnExpressionNode) Error() string

func (*ReturnExpressionNode) Inspect

func (n *ReturnExpressionNode) Inspect() string

func (*ReturnExpressionNode) IsStatic

func (*ReturnExpressionNode) IsStatic() bool

func (*ReturnExpressionNode) MacroType

func (*ReturnExpressionNode) String

func (n *ReturnExpressionNode) String() string

func (*ReturnExpressionNode) Type

type ScopedMacroCallNode

type ScopedMacroCallNode struct {
	TypedNodeBase
	Kind                MacroKind
	Receiver            ExpressionNode
	MacroName           IdentifierNode
	PositionalArguments []ExpressionNode
	NamedArguments      []NamedArgumentNode
}

Represents a method call eg. `Foo::bar!(5)`

func NewScopedMacroCallNode

func NewScopedMacroCallNode(
	loc *position.Location,
	kind MacroKind,
	recv ExpressionNode,
	macroName IdentifierNode,
	posArgs []ExpressionNode,
	namedArgs []NamedArgumentNode,
) *ScopedMacroCallNode

Create a macro call node eg. `Foo::bar!(5)`

func (*ScopedMacroCallNode) Class

func (*ScopedMacroCallNode) Class() *value.Class

func (*ScopedMacroCallNode) DirectClass

func (*ScopedMacroCallNode) DirectClass() *value.Class

func (*ScopedMacroCallNode) Equal

func (n *ScopedMacroCallNode) Equal(other value.Value) bool

func (*ScopedMacroCallNode) Error

func (n *ScopedMacroCallNode) Error() string

func (*ScopedMacroCallNode) Inspect

func (n *ScopedMacroCallNode) Inspect() string

func (*ScopedMacroCallNode) IsStatic

func (*ScopedMacroCallNode) IsStatic() bool

func (*ScopedMacroCallNode) MacroType

func (*ScopedMacroCallNode) String

func (n *ScopedMacroCallNode) String() string

type SelfLiteralNode

type SelfLiteralNode struct {
	TypedNodeBase
}

`self` literal.

func NewSelfLiteralNode

func NewSelfLiteralNode(loc *position.Location) *SelfLiteralNode

Create a new `self` literal node.

func (*SelfLiteralNode) Class

func (*SelfLiteralNode) Class() *value.Class

func (*SelfLiteralNode) DirectClass

func (*SelfLiteralNode) DirectClass() *value.Class

func (*SelfLiteralNode) Equal

func (n *SelfLiteralNode) Equal(other value.Value) bool

func (*SelfLiteralNode) Error

func (n *SelfLiteralNode) Error() string

func (*SelfLiteralNode) Inspect

func (n *SelfLiteralNode) Inspect() string

func (*SelfLiteralNode) IsStatic

func (*SelfLiteralNode) IsStatic() bool

func (*SelfLiteralNode) MacroType

func (n *SelfLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*SelfLiteralNode) String

func (n *SelfLiteralNode) String() string

type SetPatternNode

type SetPatternNode struct {
	TypedNodeBase
	Elements []PatternNode
}

Represents a Set pattern eg. `^[1, "foo"]`

func NewSetPatternNode

func NewSetPatternNode(loc *position.Location, elements []PatternNode) *SetPatternNode

Create a Set pattern node eg. `^[1, "foo"]`

func (*SetPatternNode) Class

func (*SetPatternNode) Class() *value.Class

func (*SetPatternNode) DirectClass

func (*SetPatternNode) DirectClass() *value.Class

func (*SetPatternNode) Equal

func (n *SetPatternNode) Equal(other value.Value) bool

func (*SetPatternNode) Error

func (n *SetPatternNode) Error() string

func (*SetPatternNode) Inspect

func (n *SetPatternNode) Inspect() string

func (*SetPatternNode) IsStatic

func (s *SetPatternNode) IsStatic() bool

func (*SetPatternNode) MacroType

func (n *SetPatternNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*SetPatternNode) String

func (n *SetPatternNode) String() string

type SetterDeclarationNode

type SetterDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Entries []ParameterNode
}

Represents a new setter declaration eg. `setter foo: String`

func NewSetterDeclarationNode

func NewSetterDeclarationNode(loc *position.Location, docComment string, entries []ParameterNode) *SetterDeclarationNode

Create a setter declaration node eg. `setter foo: String`

func (*SetterDeclarationNode) Class

func (*SetterDeclarationNode) Class() *value.Class

func (*SetterDeclarationNode) DirectClass

func (*SetterDeclarationNode) DirectClass() *value.Class

func (*SetterDeclarationNode) Equal

func (n *SetterDeclarationNode) Equal(other value.Value) bool

func (*SetterDeclarationNode) Error

func (n *SetterDeclarationNode) Error() string

func (*SetterDeclarationNode) Inspect

func (n *SetterDeclarationNode) Inspect() string

func (*SetterDeclarationNode) IsStatic

func (*SetterDeclarationNode) IsStatic() bool

func (*SetterDeclarationNode) MacroType

func (*SetterDeclarationNode) String

func (n *SetterDeclarationNode) String() string

type SignatureParameterNode

type SignatureParameterNode struct {
	TypedNodeBase
	Name     IdentifierNode // name of the variable
	TypeNode TypeNode       // type of the variable
	Optional bool           // whether this parameter is optional
	Kind     ParameterKind
}

Represents a signature parameter in method and function signatures eg. `foo?: String`

func NewSignatureParameterNode

func NewSignatureParameterNode(loc *position.Location, name IdentifierNode, typ TypeNode, opt bool, kind ParameterKind) *SignatureParameterNode

Create a new signature parameter node eg. `foo?: String`

func (*SignatureParameterNode) Class

func (*SignatureParameterNode) DirectClass

func (*SignatureParameterNode) DirectClass() *value.Class

func (*SignatureParameterNode) Equal

func (n *SignatureParameterNode) Equal(other value.Value) bool

func (*SignatureParameterNode) Error

func (n *SignatureParameterNode) Error() string

func (*SignatureParameterNode) Inspect

func (n *SignatureParameterNode) Inspect() string

func (*SignatureParameterNode) IsOptional

func (f *SignatureParameterNode) IsOptional() bool

func (*SignatureParameterNode) IsStatic

func (*SignatureParameterNode) IsStatic() bool

func (*SignatureParameterNode) MacroType

func (*SignatureParameterNode) String

func (n *SignatureParameterNode) String() string

type SimpleStringLiteralNode

type SimpleStringLiteralNode interface {
	Node
	ExpressionNode
	StringLiteralNode
	StringOrSymbolLiteralNode
	// contains filtered or unexported methods
}

All nodes that represent simple strings (without interpolation) should implement this interface.

type SimpleSymbolLiteralNode

type SimpleSymbolLiteralNode struct {
	TypedNodeBase
	Content string
}

Represents a symbol literal with simple content eg. `:foo`, `:'foo bar`, `:"lol"`

func NewSimpleSymbolLiteralNode

func NewSimpleSymbolLiteralNode(loc *position.Location, cont string) *SimpleSymbolLiteralNode

Create a simple symbol literal node eg. `:foo`, `:'foo bar`, `:"lol"`

func (*SimpleSymbolLiteralNode) Class

func (*SimpleSymbolLiteralNode) DirectClass

func (*SimpleSymbolLiteralNode) DirectClass() *value.Class

func (*SimpleSymbolLiteralNode) Equal

func (n *SimpleSymbolLiteralNode) Equal(other value.Value) bool

func (*SimpleSymbolLiteralNode) Error

func (n *SimpleSymbolLiteralNode) Error() string

func (*SimpleSymbolLiteralNode) Inspect

func (n *SimpleSymbolLiteralNode) Inspect() string

func (*SimpleSymbolLiteralNode) IsStatic

func (*SimpleSymbolLiteralNode) IsStatic() bool

func (*SimpleSymbolLiteralNode) MacroType

func (*SimpleSymbolLiteralNode) String

func (n *SimpleSymbolLiteralNode) String() string

type SingletonBlockExpressionNode

type SingletonBlockExpressionNode struct {
	TypedNodeBase
	Body     []StatementNode // do expression body
	Bytecode value.Method
}

Represents a `singleton` block expression eg.

singleton
	def hello then println("awesome!")
end

func NewSingletonBlockExpressionNode

func NewSingletonBlockExpressionNode(loc *position.Location, body []StatementNode) *SingletonBlockExpressionNode

Create a new `singleton` block expression node eg.

singleton
	def hello then println("awesome!")
end

func (*SingletonBlockExpressionNode) Class

func (*SingletonBlockExpressionNode) DirectClass

func (*SingletonBlockExpressionNode) DirectClass() *value.Class

func (*SingletonBlockExpressionNode) Equal

func (n *SingletonBlockExpressionNode) Equal(other value.Value) bool

func (*SingletonBlockExpressionNode) Error

func (*SingletonBlockExpressionNode) Inspect

func (n *SingletonBlockExpressionNode) Inspect() string

func (*SingletonBlockExpressionNode) IsStatic

func (*SingletonBlockExpressionNode) IsStatic() bool

func (*SingletonBlockExpressionNode) MacroType

func (*SingletonBlockExpressionNode) SkipTypechecking

func (*SingletonBlockExpressionNode) SkipTypechecking() bool

func (*SingletonBlockExpressionNode) String

type SingletonTypeNode

type SingletonTypeNode struct {
	TypedNodeBase
	TypeNode TypeNode // right hand side
}

Represents a singleton type eg. `&String`

func NewSingletonTypeNode

func NewSingletonTypeNode(loc *position.Location, typ TypeNode) *SingletonTypeNode

Create a new singleton type node eg. `&String`

func (*SingletonTypeNode) Class

func (*SingletonTypeNode) Class() *value.Class

func (*SingletonTypeNode) DirectClass

func (*SingletonTypeNode) DirectClass() *value.Class

func (*SingletonTypeNode) Equal

func (n *SingletonTypeNode) Equal(other value.Value) bool

func (*SingletonTypeNode) Error

func (n *SingletonTypeNode) Error() string

func (*SingletonTypeNode) Inspect

func (n *SingletonTypeNode) Inspect() string

func (*SingletonTypeNode) IsStatic

func (*SingletonTypeNode) IsStatic() bool

func (*SingletonTypeNode) MacroType

func (n *SingletonTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*SingletonTypeNode) String

func (n *SingletonTypeNode) String() string

type SplatExpressionNode

type SplatExpressionNode struct {
	TypedNodeBase
	Value ExpressionNode
}

Represents a splat expression eg. `*foo`

func NewSplatExpressionNode

func NewSplatExpressionNode(loc *position.Location, val ExpressionNode) *SplatExpressionNode

Create a splat expression node eg. `*foo`

func (*SplatExpressionNode) Class

func (*SplatExpressionNode) Class() *value.Class

func (*SplatExpressionNode) DirectClass

func (*SplatExpressionNode) DirectClass() *value.Class

func (*SplatExpressionNode) Equal

func (n *SplatExpressionNode) Equal(other value.Value) bool

func (*SplatExpressionNode) Error

func (n *SplatExpressionNode) Error() string

func (*SplatExpressionNode) Inspect

func (n *SplatExpressionNode) Inspect() string

func (*SplatExpressionNode) IsStatic

func (*SplatExpressionNode) IsStatic() bool

func (*SplatExpressionNode) MacroType

func (*SplatExpressionNode) String

func (n *SplatExpressionNode) String() string

type StatementNode

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

Represents a single statement, so for example a single valid "line" of Elk code. Usually its an expression optionally terminated with a newline or a semicolon.

func ExpressionToStatement

func ExpressionToStatement(expr ExpressionNode) StatementNode

Turn an expression to a statement

func ExpressionToStatements

func ExpressionToStatements(expr ExpressionNode) []StatementNode

Turn an expression to a collection of statements.

func NewExpressionStatementNodeI

func NewExpressionStatementNodeI(loc *position.Location, expr ExpressionNode) StatementNode

Same as NewExpressionStatementNode but returns an interface

func PatternToStatement

func PatternToStatement(pattern PatternNode) StatementNode

Turn a pattern to a statement

func PatternToStatements

func PatternToStatements(pattern PatternNode) []StatementNode

Turn a pattern to a collection of statements.

func TypeToStatement

func TypeToStatement(typ TypeNode) StatementNode

Turn a type to a statement

func TypeToStatements

func TypeToStatements(typ TypeNode) []StatementNode

Turn a type to a collection of statements.

type StringInspectInterpolationNode

type StringInspectInterpolationNode struct {
	NodeBase
	Expression ExpressionNode
}

Represents a single inspect interpolated section of a string literal eg. `bar + 2` in `"foo#{bar + 2}"`

func NewStringInspectInterpolationNode

func NewStringInspectInterpolationNode(loc *position.Location, expr ExpressionNode) *StringInspectInterpolationNode

Create a new string inspect interpolation node eg. `bar + 2` in `"foo#{bar + 2}"`

func (*StringInspectInterpolationNode) Class

func (*StringInspectInterpolationNode) DirectClass

func (*StringInspectInterpolationNode) DirectClass() *value.Class

func (*StringInspectInterpolationNode) Equal

func (*StringInspectInterpolationNode) Error

func (*StringInspectInterpolationNode) Inspect

func (*StringInspectInterpolationNode) IsStatic

func (*StringInspectInterpolationNode) MacroType

func (*StringInspectInterpolationNode) String

type StringInterpolationNode

type StringInterpolationNode struct {
	NodeBase
	Expression ExpressionNode
}

Represents a single interpolated section of a string literal eg. `bar + 2` in `"foo${bar + 2}"`

func NewStringInterpolationNode

func NewStringInterpolationNode(loc *position.Location, expr ExpressionNode) *StringInterpolationNode

Create a new string interpolation node eg. `bar + 2` in `"foo${bar + 2}"`

func (*StringInterpolationNode) Class

func (*StringInterpolationNode) DirectClass

func (*StringInterpolationNode) DirectClass() *value.Class

func (*StringInterpolationNode) Equal

func (n *StringInterpolationNode) Equal(other value.Value) bool

func (*StringInterpolationNode) Error

func (n *StringInterpolationNode) Error() string

func (*StringInterpolationNode) Inspect

func (n *StringInterpolationNode) Inspect() string

func (*StringInterpolationNode) IsStatic

func (*StringInterpolationNode) IsStatic() bool

func (*StringInterpolationNode) MacroType

func (*StringInterpolationNode) String

func (n *StringInterpolationNode) String() string

type StringLiteralContentNode

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

Nodes that implement this interface can appear inside of a String literal.

type StringLiteralContentSectionNode

type StringLiteralContentSectionNode struct {
	NodeBase
	Value string
}

Represents a single section of characters of a string literal eg. `foo` in `"foo${bar}"`.

func NewStringLiteralContentSectionNode

func NewStringLiteralContentSectionNode(loc *position.Location, val string) *StringLiteralContentSectionNode

Create a new string literal content section node eg. `foo` in `"foo${bar}"`.

func (*StringLiteralContentSectionNode) Class

func (*StringLiteralContentSectionNode) DirectClass

func (*StringLiteralContentSectionNode) Equal

func (*StringLiteralContentSectionNode) Error

func (*StringLiteralContentSectionNode) Inspect

func (*StringLiteralContentSectionNode) IsStatic

func (*StringLiteralContentSectionNode) MacroType

func (*StringLiteralContentSectionNode) String

type StringLiteralNode

type StringLiteralNode interface {
	Node
	LiteralPatternNode
	StringOrSymbolLiteralNode
	// contains filtered or unexported methods
}

All nodes that represent strings should implement this interface.

type StringOrSymbolLiteralNode

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

type StringOrSymbolTypeNode

type StringOrSymbolTypeNode interface {
	Node
	TypeNode
	StringOrSymbolLiteralNode
}

type StringTypeNode

type StringTypeNode interface {
	Node
	TypeNode
	StringLiteralNode
}

type StructBodyStatementNode

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

Represents a single statement of a struct body optionally terminated with a newline or semicolon.

func NewParameterStatementNodeI

func NewParameterStatementNodeI(loc *position.Location, param ParameterNode) StructBodyStatementNode

Same as NewParameterStatementNode but returns an interface

type StructDeclarationNode

type StructDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Constant       ExpressionNode            // The constant that will hold the struct value
	TypeParameters []TypeParameterNode       // Generic type variable definitions
	Body           []StructBodyStatementNode // body of the struct
}

Represents a struct declaration eg. `struct Foo; end`

func NewStructDeclarationNode

func NewStructDeclarationNode(
	loc *position.Location,
	docComment string,
	constant ExpressionNode,
	typeParams []TypeParameterNode,
	body []StructBodyStatementNode,
) *StructDeclarationNode

Create a new struct declaration node eg. `struct Foo; end`

func (*StructDeclarationNode) Class

func (*StructDeclarationNode) Class() *value.Class

func (*StructDeclarationNode) DirectClass

func (*StructDeclarationNode) DirectClass() *value.Class

func (*StructDeclarationNode) Equal

func (n *StructDeclarationNode) Equal(other value.Value) bool

func (*StructDeclarationNode) Error

func (n *StructDeclarationNode) Error() string

func (*StructDeclarationNode) Inspect

func (n *StructDeclarationNode) Inspect() string

func (*StructDeclarationNode) IsStatic

func (*StructDeclarationNode) IsStatic() bool

func (*StructDeclarationNode) MacroType

func (*StructDeclarationNode) String

func (n *StructDeclarationNode) String() string

type SubscriptExpressionNode

type SubscriptExpressionNode struct {
	TypedNodeBase
	Receiver ExpressionNode
	Key      ExpressionNode
	// contains filtered or unexported fields
}

Represents subscript access eg. `arr[5]`

func NewSubscriptExpressionNode

func NewSubscriptExpressionNode(loc *position.Location, recv, key ExpressionNode) *SubscriptExpressionNode

Create a subscript expression node eg. `arr[5]`

func (*SubscriptExpressionNode) Class

func (*SubscriptExpressionNode) DirectClass

func (*SubscriptExpressionNode) DirectClass() *value.Class

func (*SubscriptExpressionNode) Equal

func (n *SubscriptExpressionNode) Equal(other value.Value) bool

func (*SubscriptExpressionNode) Error

func (n *SubscriptExpressionNode) Error() string

func (*SubscriptExpressionNode) Inspect

func (n *SubscriptExpressionNode) Inspect() string

func (*SubscriptExpressionNode) IsStatic

func (s *SubscriptExpressionNode) IsStatic() bool

func (*SubscriptExpressionNode) MacroType

func (*SubscriptExpressionNode) String

func (n *SubscriptExpressionNode) String() string

type SwitchExpressionNode

type SwitchExpressionNode struct {
	TypedNodeBase
	Value    ExpressionNode
	Cases    []*CaseNode
	ElseBody []StatementNode
}

Represents a `switch` expression eg.

switch a
case 3
  println("eureka!")
case nil
  println("boo")
else
  println("nothing")
end

func NewSwitchExpressionNode

func NewSwitchExpressionNode(loc *position.Location, val ExpressionNode, cases []*CaseNode, els []StatementNode) *SwitchExpressionNode

Create a new `switch` expression node

func (*SwitchExpressionNode) Class

func (*SwitchExpressionNode) Class() *value.Class

func (*SwitchExpressionNode) DirectClass

func (*SwitchExpressionNode) DirectClass() *value.Class

func (*SwitchExpressionNode) Equal

func (n *SwitchExpressionNode) Equal(other value.Value) bool

func (*SwitchExpressionNode) Error

func (n *SwitchExpressionNode) Error() string

func (*SwitchExpressionNode) Inspect

func (n *SwitchExpressionNode) Inspect() string

func (*SwitchExpressionNode) IsStatic

func (*SwitchExpressionNode) IsStatic() bool

func (*SwitchExpressionNode) MacroType

func (*SwitchExpressionNode) String

func (n *SwitchExpressionNode) String() string

type SymbolArrayListLiteralNode

type SymbolArrayListLiteralNode struct {
	TypedNodeBase
	Elements []SymbolCollectionContentNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a symbol ArrayList literal eg. `\s[foo bar]`

func NewSymbolArrayListLiteralNode

func NewSymbolArrayListLiteralNode(loc *position.Location, elements []SymbolCollectionContentNode, capacity ExpressionNode) *SymbolArrayListLiteralNode

Create a symbol ArrayList literal node eg. `\s[foo bar]`

func (*SymbolArrayListLiteralNode) Class

func (*SymbolArrayListLiteralNode) DirectClass

func (*SymbolArrayListLiteralNode) DirectClass() *value.Class

func (*SymbolArrayListLiteralNode) Equal

func (n *SymbolArrayListLiteralNode) Equal(other value.Value) bool

func (*SymbolArrayListLiteralNode) Error

func (*SymbolArrayListLiteralNode) Inspect

func (n *SymbolArrayListLiteralNode) Inspect() string

func (*SymbolArrayListLiteralNode) IsStatic

func (s *SymbolArrayListLiteralNode) IsStatic() bool

func (*SymbolArrayListLiteralNode) MacroType

func (*SymbolArrayListLiteralNode) String

func (n *SymbolArrayListLiteralNode) String() string

type SymbolArrayTupleLiteralNode

type SymbolArrayTupleLiteralNode struct {
	TypedNodeBase
	Elements []SymbolCollectionContentNode
}

Represents a symbol ArrayTuple literal eg. `%s[foo bar]`

func NewSymbolArrayTupleLiteralNode

func NewSymbolArrayTupleLiteralNode(loc *position.Location, elements []SymbolCollectionContentNode) *SymbolArrayTupleLiteralNode

Create a symbol arrayTuple literal node eg. `%s[foo bar]`

func (*SymbolArrayTupleLiteralNode) Class

func (*SymbolArrayTupleLiteralNode) DirectClass

func (*SymbolArrayTupleLiteralNode) DirectClass() *value.Class

func (*SymbolArrayTupleLiteralNode) Equal

func (n *SymbolArrayTupleLiteralNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*SymbolArrayTupleLiteralNode) Error

func (*SymbolArrayTupleLiteralNode) Inspect

func (n *SymbolArrayTupleLiteralNode) Inspect() string

func (*SymbolArrayTupleLiteralNode) IsStatic

func (*SymbolArrayTupleLiteralNode) IsStatic() bool

func (*SymbolArrayTupleLiteralNode) MacroType

func (*SymbolArrayTupleLiteralNode) String

func (n *SymbolArrayTupleLiteralNode) String() string

Return a string representation of the node.

type SymbolCollectionContentNode

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

All nodes that should be able to appear as elements of symbol collection literals should implement this interface.

type SymbolHashSetLiteralNode

type SymbolHashSetLiteralNode struct {
	TypedNodeBase
	Elements []SymbolCollectionContentNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a symbol HashSet literal eg. `^s[foo bar]`

func NewSymbolHashSetLiteralNode

func NewSymbolHashSetLiteralNode(loc *position.Location, elements []SymbolCollectionContentNode, capacity ExpressionNode) *SymbolHashSetLiteralNode

Create a symbol HashSet literal node eg. `^s[foo bar]`

func (*SymbolHashSetLiteralNode) Class

func (*SymbolHashSetLiteralNode) DirectClass

func (*SymbolHashSetLiteralNode) DirectClass() *value.Class

func (*SymbolHashSetLiteralNode) Equal

func (n *SymbolHashSetLiteralNode) Equal(other value.Value) bool

func (*SymbolHashSetLiteralNode) Error

func (n *SymbolHashSetLiteralNode) Error() string

func (*SymbolHashSetLiteralNode) Inspect

func (n *SymbolHashSetLiteralNode) Inspect() string

func (*SymbolHashSetLiteralNode) IsStatic

func (s *SymbolHashSetLiteralNode) IsStatic() bool

func (*SymbolHashSetLiteralNode) MacroType

func (*SymbolHashSetLiteralNode) String

func (n *SymbolHashSetLiteralNode) String() string

type SymbolKeyValueExpressionNode

type SymbolKeyValueExpressionNode struct {
	NodeBase
	Key   IdentifierNode
	Value ExpressionNode
}

Represents a symbol value expression eg. `foo: bar`

func NewSymbolKeyValueExpressionNode

func NewSymbolKeyValueExpressionNode(loc *position.Location, key IdentifierNode, val ExpressionNode) *SymbolKeyValueExpressionNode

Create a symbol key value node eg. `foo: bar`

func (*SymbolKeyValueExpressionNode) Class

func (*SymbolKeyValueExpressionNode) DirectClass

func (*SymbolKeyValueExpressionNode) DirectClass() *value.Class

func (*SymbolKeyValueExpressionNode) Equal

func (n *SymbolKeyValueExpressionNode) Equal(other value.Value) bool

func (*SymbolKeyValueExpressionNode) Error

func (*SymbolKeyValueExpressionNode) Inspect

func (n *SymbolKeyValueExpressionNode) Inspect() string

func (*SymbolKeyValueExpressionNode) IsStatic

func (s *SymbolKeyValueExpressionNode) IsStatic() bool

func (*SymbolKeyValueExpressionNode) MacroType

func (*SymbolKeyValueExpressionNode) String

type SymbolKeyValuePatternNode

type SymbolKeyValuePatternNode struct {
	NodeBase
	Key   string
	Value PatternNode
}

Represents a symbol value pattern eg. `foo: bar`

func NewSymbolKeyValuePatternNode

func NewSymbolKeyValuePatternNode(loc *position.Location, key string, val PatternNode) *SymbolKeyValuePatternNode

Create a symbol key value node eg. `foo: bar`

func (*SymbolKeyValuePatternNode) Class

func (*SymbolKeyValuePatternNode) DirectClass

func (*SymbolKeyValuePatternNode) DirectClass() *value.Class

func (*SymbolKeyValuePatternNode) Equal

func (n *SymbolKeyValuePatternNode) Equal(other value.Value) bool

func (*SymbolKeyValuePatternNode) Error

func (n *SymbolKeyValuePatternNode) Error() string

func (*SymbolKeyValuePatternNode) Inspect

func (n *SymbolKeyValuePatternNode) Inspect() string

func (*SymbolKeyValuePatternNode) IsStatic

func (s *SymbolKeyValuePatternNode) IsStatic() bool

func (*SymbolKeyValuePatternNode) MacroType

func (*SymbolKeyValuePatternNode) String

func (n *SymbolKeyValuePatternNode) String() string

type SymbolLiteralNode

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

Nodes that implement this interface represent symbol literals.

type ThrowExpressionNode

type ThrowExpressionNode struct {
	NodeBase
	Unchecked bool
	Value     ExpressionNode
}

Represents a `throw` expression eg. `throw ArgumentError("foo")`

func NewThrowExpressionNode

func NewThrowExpressionNode(loc *position.Location, unchecked bool, val ExpressionNode) *ThrowExpressionNode

Create a new `throw` expression node eg. `throw ArgumentError("foo")`

func (*ThrowExpressionNode) Class

func (*ThrowExpressionNode) Class() *value.Class

func (*ThrowExpressionNode) DirectClass

func (*ThrowExpressionNode) DirectClass() *value.Class

func (*ThrowExpressionNode) Equal

func (n *ThrowExpressionNode) Equal(other value.Value) bool

func (*ThrowExpressionNode) Error

func (n *ThrowExpressionNode) Error() string

func (*ThrowExpressionNode) Inspect

func (n *ThrowExpressionNode) Inspect() string

func (*ThrowExpressionNode) IsStatic

func (*ThrowExpressionNode) IsStatic() bool

func (*ThrowExpressionNode) MacroType

func (*ThrowExpressionNode) String

func (n *ThrowExpressionNode) String() string

func (*ThrowExpressionNode) Type

type TraverseOption

type TraverseOption uint8

Value used to decide what whether to skip the children of the node, break the traversal or continue in the AST Traverse method. The zero value continues the traversal.

const (
	TraverseContinue TraverseOption = iota
	TraverseSkip
	TraverseBreak
)

type TrueLiteralNode

type TrueLiteralNode struct {
	NodeBase
}

`true` literal.

func NewTrueLiteralNode

func NewTrueLiteralNode(loc *position.Location) *TrueLiteralNode

Create a new `true` literal node.

func (*TrueLiteralNode) Class

func (*TrueLiteralNode) Class() *value.Class

func (*TrueLiteralNode) DirectClass

func (*TrueLiteralNode) DirectClass() *value.Class

func (*TrueLiteralNode) Equal

func (n *TrueLiteralNode) Equal(other value.Value) bool

func (*TrueLiteralNode) Error

func (n *TrueLiteralNode) Error() string

func (*TrueLiteralNode) Inspect

func (n *TrueLiteralNode) Inspect() string

func (*TrueLiteralNode) IsStatic

func (*TrueLiteralNode) IsStatic() bool

func (*TrueLiteralNode) MacroType

func (n *TrueLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*TrueLiteralNode) String

func (n *TrueLiteralNode) String() string

func (*TrueLiteralNode) Type

func (*TrueLiteralNode) Type(globalEnv *types.GlobalEnvironment) types.Type

type TryExpressionNode

type TryExpressionNode struct {
	TypedNodeBase
	Value ExpressionNode
}

Represents a `try` expression eg. `try foo()`

func NewTryExpressionNode

func NewTryExpressionNode(loc *position.Location, val ExpressionNode) *TryExpressionNode

Create a new `try` expression node eg. `try foo()`

func (*TryExpressionNode) Class

func (*TryExpressionNode) Class() *value.Class

func (*TryExpressionNode) DirectClass

func (*TryExpressionNode) DirectClass() *value.Class

func (*TryExpressionNode) Equal

func (n *TryExpressionNode) Equal(other value.Value) bool

func (*TryExpressionNode) Error

func (n *TryExpressionNode) Error() string

func (*TryExpressionNode) Inspect

func (n *TryExpressionNode) Inspect() string

func (*TryExpressionNode) IsStatic

func (*TryExpressionNode) IsStatic() bool

func (*TryExpressionNode) MacroType

func (n *TryExpressionNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*TryExpressionNode) String

func (n *TryExpressionNode) String() string

type TuplePatternNode

type TuplePatternNode struct {
	TypedNodeBase
	Elements []PatternNode
}

Represents a Tuple pattern eg. `%[1, a, >= 10]`

func NewTuplePatternNode

func NewTuplePatternNode(loc *position.Location, elements []PatternNode) *TuplePatternNode

Create a Tuple pattern node eg. `%[1, a, >= 10]`

func (*TuplePatternNode) Class

func (*TuplePatternNode) Class() *value.Class

func (*TuplePatternNode) DirectClass

func (*TuplePatternNode) DirectClass() *value.Class

func (*TuplePatternNode) Equal

func (n *TuplePatternNode) Equal(other value.Value) bool

func (*TuplePatternNode) Error

func (n *TuplePatternNode) Error() string

func (*TuplePatternNode) Inspect

func (n *TuplePatternNode) Inspect() string

func (*TuplePatternNode) IsStatic

func (l *TuplePatternNode) IsStatic() bool

func (*TuplePatternNode) MacroType

func (n *TuplePatternNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*TuplePatternNode) String

func (n *TuplePatternNode) String() string

type TypeDefinitionNode

type TypeDefinitionNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Constant ComplexConstantNode // new name of the type
	TypeNode TypeNode            // the type
}

Represents a new type definition eg. `typedef StringList = ArrayList[String]`

func NewTypeDefinitionNode

func NewTypeDefinitionNode(loc *position.Location, docComment string, constant ComplexConstantNode, typ TypeNode) *TypeDefinitionNode

Create a type definition node eg. `typedef StringList = ArrayList[String]`

func (*TypeDefinitionNode) Class

func (*TypeDefinitionNode) Class() *value.Class

func (*TypeDefinitionNode) DirectClass

func (*TypeDefinitionNode) DirectClass() *value.Class

func (*TypeDefinitionNode) Equal

func (n *TypeDefinitionNode) Equal(other value.Value) bool

func (*TypeDefinitionNode) Error

func (n *TypeDefinitionNode) Error() string

func (*TypeDefinitionNode) Inspect

func (n *TypeDefinitionNode) Inspect() string

func (*TypeDefinitionNode) IsStatic

func (*TypeDefinitionNode) IsStatic() bool

func (*TypeDefinitionNode) MacroType

func (*TypeDefinitionNode) String

func (n *TypeDefinitionNode) String() string

type TypeExpressionNode

type TypeExpressionNode struct {
	NodeBase
	TypeNode TypeNode
}

Represents a type expression `type String?`

func NewTypeExpressionNode

func NewTypeExpressionNode(loc *position.Location, typeNode TypeNode) *TypeExpressionNode

Create a new type expression `type String?`

func (*TypeExpressionNode) Class

func (*TypeExpressionNode) Class() *value.Class

func (*TypeExpressionNode) DirectClass

func (*TypeExpressionNode) DirectClass() *value.Class

func (*TypeExpressionNode) Equal

func (n *TypeExpressionNode) Equal(other value.Value) bool

func (*TypeExpressionNode) Error

func (n *TypeExpressionNode) Error() string

func (*TypeExpressionNode) Inspect

func (n *TypeExpressionNode) Inspect() string

func (*TypeExpressionNode) IsStatic

func (*TypeExpressionNode) IsStatic() bool

func (*TypeExpressionNode) MacroType

func (*TypeExpressionNode) String

func (n *TypeExpressionNode) String() string

type TypeNode

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

All nodes that should be valid in type annotations should implement this interface

func NewBinaryTypeNodeI

func NewBinaryTypeNodeI(loc *position.Location, op *token.Token, left, right TypeNode) TypeNode

Same as NewBinaryTypeNode but returns an interface

type TypeParameterNode

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

Represents a type variable in generics like `class Foo[+V]; end`

type TypeStatementNode

type TypeStatementNode struct {
	NodeBase
	TypeNode TypeNode
}

Type optionally terminated with a newline or a semicolon.

func NewTypeStatementNode

func NewTypeStatementNode(loc *position.Location, typeNode TypeNode) *TypeStatementNode

Create a new type statement node eg. `Bar | Foo\n`

func (*TypeStatementNode) Class

func (*TypeStatementNode) Class() *value.Class

func (*TypeStatementNode) DirectClass

func (*TypeStatementNode) DirectClass() *value.Class

func (*TypeStatementNode) Equal

func (n *TypeStatementNode) Equal(other value.Value) bool

func (*TypeStatementNode) Error

func (e *TypeStatementNode) Error() string

func (*TypeStatementNode) Inspect

func (n *TypeStatementNode) Inspect() string

func (*TypeStatementNode) IsStatic

func (*TypeStatementNode) IsStatic() bool

func (*TypeStatementNode) MacroType

func (n *TypeStatementNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*TypeStatementNode) String

func (n *TypeStatementNode) String() string

Return a string representation of the node.

type TypedNodeBase

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

Base typed AST node.

func (*TypedNodeBase) Class

func (t *TypedNodeBase) Class() *value.Class

func (*TypedNodeBase) Copy

func (t *TypedNodeBase) Copy() value.Reference

func (*TypedNodeBase) DirectClass

func (t *TypedNodeBase) DirectClass() *value.Class

func (*TypedNodeBase) Error

func (t *TypedNodeBase) Error() string

func (*TypedNodeBase) Inspect

func (t *TypedNodeBase) Inspect() string

func (*TypedNodeBase) InstanceVariables

func (t *TypedNodeBase) InstanceVariables() *value.InstanceVariables

func (*TypedNodeBase) Location

func (t *TypedNodeBase) Location() *position.Location

func (*TypedNodeBase) SetLocation

func (t *TypedNodeBase) SetLocation(loc *position.Location)

func (*TypedNodeBase) SetSpan

func (t *TypedNodeBase) SetSpan(span *position.Span)

func (*TypedNodeBase) SetType

func (t *TypedNodeBase) SetType(typ types.Type)

func (*TypedNodeBase) SingletonClass

func (t *TypedNodeBase) SingletonClass() *value.Class

func (*TypedNodeBase) SkipTypechecking

func (t *TypedNodeBase) SkipTypechecking() bool

func (*TypedNodeBase) Span

func (t *TypedNodeBase) Span() *position.Span

func (*TypedNodeBase) Type

type TypeofExpressionNode

type TypeofExpressionNode struct {
	TypedNodeBase
	Value ExpressionNode
}

Represents a `typeof` expression eg. `typeof foo()`

func NewTypeofExpressionNode

func NewTypeofExpressionNode(loc *position.Location, val ExpressionNode) *TypeofExpressionNode

Create a new `typeof` expression node eg. `typeof foo()`

func (*TypeofExpressionNode) Class

func (*TypeofExpressionNode) Class() *value.Class

func (*TypeofExpressionNode) DirectClass

func (*TypeofExpressionNode) DirectClass() *value.Class

func (*TypeofExpressionNode) Equal

func (n *TypeofExpressionNode) Equal(other value.Value) bool

func (*TypeofExpressionNode) Error

func (n *TypeofExpressionNode) Error() string

func (*TypeofExpressionNode) Inspect

func (n *TypeofExpressionNode) Inspect() string

func (*TypeofExpressionNode) IsStatic

func (*TypeofExpressionNode) IsStatic() bool

func (*TypeofExpressionNode) MacroType

func (*TypeofExpressionNode) String

func (n *TypeofExpressionNode) String() string

type UInt8LiteralNode

type UInt8LiteralNode struct {
	TypedNodeBase
	Value string
}

UInt8 literal eg. `5u8`, `1_20u8`, `0xffu8`

func NewUInt8LiteralNode

func NewUInt8LiteralNode(loc *position.Location, val string) *UInt8LiteralNode

Create a new UInt8 literal node eg. `5u8`, `1_20u8`, `0xffu8`

func (*UInt8LiteralNode) Class

func (*UInt8LiteralNode) Class() *value.Class

func (*UInt8LiteralNode) DirectClass

func (*UInt8LiteralNode) DirectClass() *value.Class

func (*UInt8LiteralNode) Equal

func (n *UInt8LiteralNode) Equal(other value.Value) bool

func (*UInt8LiteralNode) Error

func (n *UInt8LiteralNode) Error() string

func (*UInt8LiteralNode) Inspect

func (n *UInt8LiteralNode) Inspect() string

func (*UInt8LiteralNode) IsStatic

func (*UInt8LiteralNode) IsStatic() bool

func (*UInt8LiteralNode) MacroType

func (n *UInt8LiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UInt8LiteralNode) String

func (n *UInt8LiteralNode) String() string

type UInt16LiteralNode

type UInt16LiteralNode struct {
	TypedNodeBase
	Value string
}

UInt16 literal eg. `5u16`, `1_20u16`, `0xffu16`

func NewUInt16LiteralNode

func NewUInt16LiteralNode(loc *position.Location, val string) *UInt16LiteralNode

Create a new UInt16 literal node eg. `5u16`, `1_20u16`, `0xffu16`

func (*UInt16LiteralNode) Class

func (*UInt16LiteralNode) Class() *value.Class

func (*UInt16LiteralNode) DirectClass

func (*UInt16LiteralNode) DirectClass() *value.Class

func (*UInt16LiteralNode) Equal

func (n *UInt16LiteralNode) Equal(other value.Value) bool

func (*UInt16LiteralNode) Error

func (n *UInt16LiteralNode) Error() string

func (*UInt16LiteralNode) Inspect

func (n *UInt16LiteralNode) Inspect() string

func (*UInt16LiteralNode) IsStatic

func (*UInt16LiteralNode) IsStatic() bool

func (*UInt16LiteralNode) MacroType

func (n *UInt16LiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UInt16LiteralNode) String

func (n *UInt16LiteralNode) String() string

type UInt32LiteralNode

type UInt32LiteralNode struct {
	TypedNodeBase
	Value string
}

UInt32 literal eg. `5u32`, `1_20u32`, `0xffu32`

func NewUInt32LiteralNode

func NewUInt32LiteralNode(loc *position.Location, val string) *UInt32LiteralNode

Create a new UInt32 literal node eg. `5u32`, `1_20u32`, `0xffu32`

func (*UInt32LiteralNode) Class

func (*UInt32LiteralNode) Class() *value.Class

func (*UInt32LiteralNode) DirectClass

func (*UInt32LiteralNode) DirectClass() *value.Class

func (*UInt32LiteralNode) Equal

func (n *UInt32LiteralNode) Equal(other value.Value) bool

func (*UInt32LiteralNode) Error

func (n *UInt32LiteralNode) Error() string

func (*UInt32LiteralNode) Inspect

func (n *UInt32LiteralNode) Inspect() string

func (*UInt32LiteralNode) IsStatic

func (*UInt32LiteralNode) IsStatic() bool

func (*UInt32LiteralNode) MacroType

func (n *UInt32LiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UInt32LiteralNode) String

func (n *UInt32LiteralNode) String() string

type UInt64LiteralNode

type UInt64LiteralNode struct {
	TypedNodeBase
	Value string
}

UInt64 literal eg. `5u64`, `125_355u64`, `0xffu64`

func NewUInt64LiteralNode

func NewUInt64LiteralNode(loc *position.Location, val string) *UInt64LiteralNode

Create a new UInt64 literal node eg. `5u64`, `125_355u64`, `0xffu64`

func (*UInt64LiteralNode) Class

func (*UInt64LiteralNode) Class() *value.Class

func (*UInt64LiteralNode) DirectClass

func (*UInt64LiteralNode) DirectClass() *value.Class

func (*UInt64LiteralNode) Equal

func (n *UInt64LiteralNode) Equal(other value.Value) bool

func (*UInt64LiteralNode) Error

func (n *UInt64LiteralNode) Error() string

func (*UInt64LiteralNode) Inspect

func (n *UInt64LiteralNode) Inspect() string

func (*UInt64LiteralNode) IsStatic

func (*UInt64LiteralNode) IsStatic() bool

func (*UInt64LiteralNode) MacroType

func (n *UInt64LiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UInt64LiteralNode) String

func (n *UInt64LiteralNode) String() string

type UIntLiteralNode

type UIntLiteralNode struct {
	TypedNodeBase
	Value string
}

UInt literal eg. `5u`, `125_355u`, `0xffu`

func NewUIntLiteralNode

func NewUIntLiteralNode(loc *position.Location, val string) *UIntLiteralNode

Create a new UInt literal node eg. `5u`, `125_355u`, `0xffu`

func (*UIntLiteralNode) Class

func (*UIntLiteralNode) Class() *value.Class

func (*UIntLiteralNode) DirectClass

func (*UIntLiteralNode) DirectClass() *value.Class

func (*UIntLiteralNode) Equal

func (n *UIntLiteralNode) Equal(other value.Value) bool

func (*UIntLiteralNode) Error

func (n *UIntLiteralNode) Error() string

func (*UIntLiteralNode) Inspect

func (n *UIntLiteralNode) Inspect() string

func (*UIntLiteralNode) IsStatic

func (*UIntLiteralNode) IsStatic() bool

func (*UIntLiteralNode) MacroType

func (n *UIntLiteralNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UIntLiteralNode) String

func (n *UIntLiteralNode) String() string

type UnaryExpressionNode

type UnaryExpressionNode struct {
	TypedNodeBase
	Op    *token.Token   // operator
	Right ExpressionNode // right hand side
}

Expression of an operator with one operand eg. `!foo`, `-bar`

func NewUnaryExpressionNode

func NewUnaryExpressionNode(loc *position.Location, op *token.Token, right ExpressionNode) *UnaryExpressionNode

Create a new unary expression node.

func (*UnaryExpressionNode) Class

func (*UnaryExpressionNode) Class() *value.Class

func (*UnaryExpressionNode) DirectClass

func (*UnaryExpressionNode) DirectClass() *value.Class

func (*UnaryExpressionNode) Equal

func (n *UnaryExpressionNode) Equal(other value.Value) bool

func (*UnaryExpressionNode) Error

func (n *UnaryExpressionNode) Error() string

func (*UnaryExpressionNode) Inspect

func (n *UnaryExpressionNode) Inspect() string

func (*UnaryExpressionNode) IsStatic

func (u *UnaryExpressionNode) IsStatic() bool

func (*UnaryExpressionNode) MacroType

func (*UnaryExpressionNode) String

func (n *UnaryExpressionNode) String() string

type UnaryTypeNode

type UnaryTypeNode struct {
	TypedNodeBase
	Op       *token.Token // operator
	TypeNode TypeNode     // right hand side
}

Type of an operator with one operand eg. `-2`, `+3`

func NewUnaryTypeNode

func NewUnaryTypeNode(loc *position.Location, op *token.Token, typeNode TypeNode) *UnaryTypeNode

Create a new unary expression node.

func (*UnaryTypeNode) Class

func (*UnaryTypeNode) Class() *value.Class

func (*UnaryTypeNode) DirectClass

func (*UnaryTypeNode) DirectClass() *value.Class

func (*UnaryTypeNode) Equal

func (n *UnaryTypeNode) Equal(other value.Value) bool

func (*UnaryTypeNode) Error

func (n *UnaryTypeNode) Error() string

func (*UnaryTypeNode) Inspect

func (n *UnaryTypeNode) Inspect() string

func (*UnaryTypeNode) IsStatic

func (u *UnaryTypeNode) IsStatic() bool

func (*UnaryTypeNode) MacroType

func (n *UnaryTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UnaryTypeNode) String

func (n *UnaryTypeNode) String() string

type UndefinedLiteralNode

type UndefinedLiteralNode struct {
	NodeBase
}

`undefined` literal.

func NewUndefinedLiteralNode

func NewUndefinedLiteralNode(loc *position.Location) *UndefinedLiteralNode

Create a new `undefined` literal node.

func (*UndefinedLiteralNode) Class

func (*UndefinedLiteralNode) Class() *value.Class

func (*UndefinedLiteralNode) DirectClass

func (*UndefinedLiteralNode) DirectClass() *value.Class

func (*UndefinedLiteralNode) Equal

func (n *UndefinedLiteralNode) Equal(other value.Value) bool

func (*UndefinedLiteralNode) Error

func (n *UndefinedLiteralNode) Error() string

func (*UndefinedLiteralNode) Inspect

func (n *UndefinedLiteralNode) Inspect() string

func (*UndefinedLiteralNode) IsStatic

func (*UndefinedLiteralNode) IsStatic() bool

func (*UndefinedLiteralNode) MacroType

func (*UndefinedLiteralNode) String

func (n *UndefinedLiteralNode) String() string

type UnhygienicNode

type UnhygienicNode struct {
	TypedNodeBase
	Node Node
}

Represents an unhygienic node

func NewUnhygienicNode

func NewUnhygienicNode(loc *position.Location, node Node) *UnhygienicNode

Create a new unhygienic node. It enables macro-generated code to access local variables from outer scopes.

func Unhygienic

func Unhygienic(node Node) *UnhygienicNode

func (*UnhygienicNode) Class

func (*UnhygienicNode) Class() *value.Class

func (*UnhygienicNode) DirectClass

func (*UnhygienicNode) DirectClass() *value.Class

func (*UnhygienicNode) Equal

func (n *UnhygienicNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*UnhygienicNode) Error

func (n *UnhygienicNode) Error() string

func (*UnhygienicNode) Inspect

func (n *UnhygienicNode) Inspect() string

func (*UnhygienicNode) IsStatic

func (n *UnhygienicNode) IsStatic() bool

func (*UnhygienicNode) MacroType

func (n *UnhygienicNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UnhygienicNode) String

func (n *UnhygienicNode) String() string

Return a string representation of the node.

type UninterpolatedRegexLiteralNode

type UninterpolatedRegexLiteralNode struct {
	NodeBase
	Content string
	Flags   bitfield.BitField8
}

Represents an uninterpolated regex literal eg. `%/foo/`

func NewUninterpolatedRegexLiteralNode

func NewUninterpolatedRegexLiteralNode(loc *position.Location, content string, flags bitfield.BitField8) *UninterpolatedRegexLiteralNode

Create a new uninterpolated regex literal node eg. `%/foo/`.

func (*UninterpolatedRegexLiteralNode) Class

func (*UninterpolatedRegexLiteralNode) DirectClass

func (*UninterpolatedRegexLiteralNode) DirectClass() *value.Class

func (*UninterpolatedRegexLiteralNode) Equal

func (*UninterpolatedRegexLiteralNode) Error

func (*UninterpolatedRegexLiteralNode) Inspect

func (*UninterpolatedRegexLiteralNode) IsASCII

func (r *UninterpolatedRegexLiteralNode) IsASCII() bool

func (*UninterpolatedRegexLiteralNode) IsCaseInsensitive

func (r *UninterpolatedRegexLiteralNode) IsCaseInsensitive() bool

func (*UninterpolatedRegexLiteralNode) IsDotAll

func (r *UninterpolatedRegexLiteralNode) IsDotAll() bool

func (*UninterpolatedRegexLiteralNode) IsExtended

func (r *UninterpolatedRegexLiteralNode) IsExtended() bool

func (*UninterpolatedRegexLiteralNode) IsMultiline

func (r *UninterpolatedRegexLiteralNode) IsMultiline() bool

func (*UninterpolatedRegexLiteralNode) IsStatic

func (*UninterpolatedRegexLiteralNode) IsUngreedy

func (r *UninterpolatedRegexLiteralNode) IsUngreedy() bool

func (*UninterpolatedRegexLiteralNode) MacroType

func (*UninterpolatedRegexLiteralNode) SetASCII

func (*UninterpolatedRegexLiteralNode) SetCaseInsensitive

func (*UninterpolatedRegexLiteralNode) SetDotAll

func (*UninterpolatedRegexLiteralNode) SetExtended

func (*UninterpolatedRegexLiteralNode) SetMultiline

func (*UninterpolatedRegexLiteralNode) SetUngreedy

func (*UninterpolatedRegexLiteralNode) String

func (*UninterpolatedRegexLiteralNode) Type

type UnionTypeNode

type UnionTypeNode struct {
	TypedNodeBase
	Elements []TypeNode
}

Union type eg. `String | Int | Float`

func NewUnionTypeNode

func NewUnionTypeNode(loc *position.Location, elements []TypeNode) *UnionTypeNode

Create a new binary type expression node eg. `String | Int`

func (*UnionTypeNode) Class

func (*UnionTypeNode) Class() *value.Class

func (*UnionTypeNode) DirectClass

func (*UnionTypeNode) DirectClass() *value.Class

func (*UnionTypeNode) Equal

func (n *UnionTypeNode) Equal(other value.Value) bool

func (*UnionTypeNode) Error

func (n *UnionTypeNode) Error() string

func (*UnionTypeNode) Inspect

func (n *UnionTypeNode) Inspect() string

func (*UnionTypeNode) IsStatic

func (*UnionTypeNode) IsStatic() bool

func (*UnionTypeNode) MacroType

func (n *UnionTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UnionTypeNode) String

func (n *UnionTypeNode) String() string

type UnlessExpressionNode

type UnlessExpressionNode struct {
	TypedNodeBase
	Condition ExpressionNode  // unless condition
	ThenBody  []StatementNode // then expression body
	ElseBody  []StatementNode // else expression body
}

Represents an `unless` expression eg. `unless foo then println("bar")`

func NewUnlessExpressionNode

func NewUnlessExpressionNode(loc *position.Location, cond ExpressionNode, then, els []StatementNode) *UnlessExpressionNode

Create a new `unless` expression node eg. `unless foo then println("bar")`

func (*UnlessExpressionNode) Class

func (*UnlessExpressionNode) Class() *value.Class

func (*UnlessExpressionNode) DirectClass

func (*UnlessExpressionNode) DirectClass() *value.Class

func (*UnlessExpressionNode) Equal

func (n *UnlessExpressionNode) Equal(other value.Value) bool

func (*UnlessExpressionNode) Error

func (n *UnlessExpressionNode) Error() string

func (*UnlessExpressionNode) Inspect

func (n *UnlessExpressionNode) Inspect() string

func (*UnlessExpressionNode) IsStatic

func (*UnlessExpressionNode) IsStatic() bool

func (*UnlessExpressionNode) MacroType

func (*UnlessExpressionNode) String

func (n *UnlessExpressionNode) String() string

type UnquoteKind

type UnquoteKind uint8
const (
	UNQUOTE_EXPRESSION_KIND         UnquoteKind = iota // Default kind of unquote for expression nodes
	UNQUOTE_PATTERN_KIND                               // Unquote kind for pattern nodes
	UNQUOTE_PATTERN_EXPRESSION_KIND                    // Unquote kind for pattern expression nodes
	UNQUOTE_TYPE_KIND                                  // Unquote kind for type nodes
	UNQUOTE_CONSTANT_KIND                              // Unquote kind for constant nodes
	UNQUOTE_IDENTIFIER_KIND                            // Unquote kind for identifier nodes
	UNQUOTE_INSTANCE_VARIABLE_KIND                     // Unquote kind for instance variable nodes
)

type UnquoteNode

type UnquoteNode struct {
	TypedNodeBase
	Kind       UnquoteKind
	Expression ExpressionNode
}

Represents an unquoted piece of AST inside of a quote

func NewUnquoteNode

func NewUnquoteNode(loc *position.Location, kind UnquoteKind, expr ExpressionNode) *UnquoteNode

Create an unquote node eg.

unquote(x)

func (*UnquoteNode) Class

func (*UnquoteNode) Class() *value.Class

func (*UnquoteNode) DirectClass

func (*UnquoteNode) DirectClass() *value.Class

func (*UnquoteNode) Equal

func (n *UnquoteNode) Equal(other value.Value) bool

Check if this node equals another node.

func (*UnquoteNode) Error

func (n *UnquoteNode) Error() string

func (*UnquoteNode) Inspect

func (n *UnquoteNode) Inspect() string

func (*UnquoteNode) IsStatic

func (*UnquoteNode) IsStatic() bool

func (*UnquoteNode) MacroType

func (n *UnquoteNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UnquoteNode) String

func (n *UnquoteNode) String() string

Return a string representation of the node.

type UnquoteOrInvalidNode

type UnquoteOrInvalidNode interface {
	ExpressionNode
	PatternNode
	TypeNode
	ConstantNode
	IdentifierNode
	InstanceVariableNode
	// contains filtered or unexported methods
}

type UntilExpressionNode

type UntilExpressionNode struct {
	TypedNodeBase
	Condition ExpressionNode  // until condition
	ThenBody  []StatementNode // then expression body
}

Represents a `until` expression eg. `until i >= 5 then i += 5`

func NewUntilExpressionNode

func NewUntilExpressionNode(loc *position.Location, cond ExpressionNode, then []StatementNode) *UntilExpressionNode

Create a new `until` expression node eg. `until i >= 5 then i += 5`

func (*UntilExpressionNode) Class

func (*UntilExpressionNode) Class() *value.Class

func (*UntilExpressionNode) DirectClass

func (*UntilExpressionNode) DirectClass() *value.Class

func (*UntilExpressionNode) Equal

func (n *UntilExpressionNode) Equal(other value.Value) bool

func (*UntilExpressionNode) Error

func (n *UntilExpressionNode) Error() string

func (*UntilExpressionNode) Inspect

func (n *UntilExpressionNode) Inspect() string

func (*UntilExpressionNode) IsStatic

func (*UntilExpressionNode) IsStatic() bool

func (*UntilExpressionNode) MacroType

func (*UntilExpressionNode) String

func (n *UntilExpressionNode) String() string

type UsingAllEntryNode

type UsingAllEntryNode struct {
	TypedNodeBase
	Namespace UsingEntryNode
}

Represents a using all entry node eg. `Foo::*`, `A::B::C::*`

func NewUsingAllEntryNode

func NewUsingAllEntryNode(loc *position.Location, namespace UsingEntryNode) *UsingAllEntryNode

Create a new using all entry node eg. `Foo::*`, `A::B::C::*`

func (*UsingAllEntryNode) Class

func (*UsingAllEntryNode) Class() *value.Class

func (*UsingAllEntryNode) DirectClass

func (*UsingAllEntryNode) DirectClass() *value.Class

func (*UsingAllEntryNode) Equal

func (n *UsingAllEntryNode) Equal(other value.Value) bool

func (*UsingAllEntryNode) Error

func (n *UsingAllEntryNode) Error() string

func (*UsingAllEntryNode) Inspect

func (n *UsingAllEntryNode) Inspect() string

func (*UsingAllEntryNode) IsStatic

func (*UsingAllEntryNode) IsStatic() bool

func (*UsingAllEntryNode) MacroType

func (n *UsingAllEntryNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*UsingAllEntryNode) String

func (n *UsingAllEntryNode) String() string

type UsingEntryNode

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

Represents all nodes that are valid in using declarations

type UsingEntryWithSubentriesNode

type UsingEntryWithSubentriesNode struct {
	NodeBase
	Namespace  UsingEntryNode
	Subentries []UsingSubentryNode
}

Represents a using entry node with subentries eg. `Foo::{Bar, baz}`, `A::B::C::{lol, foo as epic, Gro as Moe}`

func NewUsingEntryWithSubentriesNode

func NewUsingEntryWithSubentriesNode(loc *position.Location, namespace UsingEntryNode, subentries []UsingSubentryNode) *UsingEntryWithSubentriesNode

Create a new using all entry node eg. `Foo::*`, `A::B::C::*`

func (*UsingEntryWithSubentriesNode) Class

func (*UsingEntryWithSubentriesNode) DirectClass

func (*UsingEntryWithSubentriesNode) DirectClass() *value.Class

func (*UsingEntryWithSubentriesNode) Equal

func (n *UsingEntryWithSubentriesNode) Equal(other value.Value) bool

func (*UsingEntryWithSubentriesNode) Error

func (*UsingEntryWithSubentriesNode) Inspect

func (n *UsingEntryWithSubentriesNode) Inspect() string

func (*UsingEntryWithSubentriesNode) IsStatic

func (*UsingEntryWithSubentriesNode) IsStatic() bool

func (*UsingEntryWithSubentriesNode) MacroType

func (*UsingEntryWithSubentriesNode) String

type UsingExpressionNode

type UsingExpressionNode struct {
	TypedNodeBase
	Entries []UsingEntryNode
}

Represents a using expression eg. `using Foo`

func NewUsingExpressionNode

func NewUsingExpressionNode(loc *position.Location, consts []UsingEntryNode) *UsingExpressionNode

Create a using expression node eg. `using Foo`

func (*UsingExpressionNode) Class

func (*UsingExpressionNode) Class() *value.Class

func (*UsingExpressionNode) DirectClass

func (*UsingExpressionNode) DirectClass() *value.Class

func (*UsingExpressionNode) Equal

func (n *UsingExpressionNode) Equal(other value.Value) bool

func (*UsingExpressionNode) Error

func (n *UsingExpressionNode) Error() string

func (*UsingExpressionNode) Inspect

func (n *UsingExpressionNode) Inspect() string

func (*UsingExpressionNode) IsStatic

func (*UsingExpressionNode) IsStatic() bool

func (*UsingExpressionNode) MacroType

func (*UsingExpressionNode) SkipTypechecking

func (*UsingExpressionNode) SkipTypechecking() bool

func (*UsingExpressionNode) String

func (n *UsingExpressionNode) String() string

type UsingSubentryAsNode

type UsingSubentryAsNode struct {
	NodeBase
	Target IdentifierNode
	AsName IdentifierNode
}

Represents an identifier with as in using declarations eg. `foo as bar`.

func NewUsingSubentryAsNode

func NewUsingSubentryAsNode(loc *position.Location, target IdentifierNode, as IdentifierNode) *UsingSubentryAsNode

Create a new identifier with as eg. `foo as bar`.

func (*UsingSubentryAsNode) Class

func (*UsingSubentryAsNode) Class() *value.Class

func (*UsingSubentryAsNode) DirectClass

func (*UsingSubentryAsNode) DirectClass() *value.Class

func (*UsingSubentryAsNode) Equal

func (n *UsingSubentryAsNode) Equal(other value.Value) bool

func (*UsingSubentryAsNode) Error

func (n *UsingSubentryAsNode) Error() string

func (*UsingSubentryAsNode) Inspect

func (n *UsingSubentryAsNode) Inspect() string

func (*UsingSubentryAsNode) IsMacro

func (n *UsingSubentryAsNode) IsMacro() bool

func (*UsingSubentryAsNode) IsStatic

func (*UsingSubentryAsNode) IsStatic() bool

func (*UsingSubentryAsNode) MacroType

func (*UsingSubentryAsNode) String

func (n *UsingSubentryAsNode) String() string

type UsingSubentryNode

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

Represents all nodes that are valid in using subentries in `UsingEntryWithSubentriesNode`

type ValueDeclarationNode

type ValueDeclarationNode struct {
	TypedNodeBase
	Name        IdentifierNode // name of the value
	TypeNode    TypeNode       // type of the value
	Initialiser ExpressionNode // value assigned to the value
}

Represents a value declaration eg. `val foo: String`

func NewValueDeclarationNode

func NewValueDeclarationNode(loc *position.Location, name IdentifierNode, typ TypeNode, init ExpressionNode) *ValueDeclarationNode

Create a new value declaration node eg. `val foo: String`

func (*ValueDeclarationNode) Class

func (*ValueDeclarationNode) Class() *value.Class

func (*ValueDeclarationNode) DirectClass

func (*ValueDeclarationNode) DirectClass() *value.Class

func (*ValueDeclarationNode) Equal

func (n *ValueDeclarationNode) Equal(other value.Value) bool

func (*ValueDeclarationNode) Error

func (v *ValueDeclarationNode) Error() string

func (*ValueDeclarationNode) Inspect

func (n *ValueDeclarationNode) Inspect() string

func (*ValueDeclarationNode) IsStatic

func (*ValueDeclarationNode) IsStatic() bool

func (*ValueDeclarationNode) MacroType

func (*ValueDeclarationNode) String

func (n *ValueDeclarationNode) String() string

type ValuePatternDeclarationNode

type ValuePatternDeclarationNode struct {
	NodeBase
	Pattern     PatternNode
	Initialiser ExpressionNode // value assigned to the value
}

Represents a value pattern declaration eg. `val [foo, { bar }] = baz()`

func NewValuePatternDeclarationNode

func NewValuePatternDeclarationNode(loc *position.Location, pattern PatternNode, init ExpressionNode) *ValuePatternDeclarationNode

Create a new value declaration node eg. `val foo: String`

func (*ValuePatternDeclarationNode) Class

func (*ValuePatternDeclarationNode) DirectClass

func (*ValuePatternDeclarationNode) DirectClass() *value.Class

func (*ValuePatternDeclarationNode) Equal

func (n *ValuePatternDeclarationNode) Equal(other value.Value) bool

func (*ValuePatternDeclarationNode) Error

func (*ValuePatternDeclarationNode) Inspect

func (n *ValuePatternDeclarationNode) Inspect() string

func (*ValuePatternDeclarationNode) IsStatic

func (*ValuePatternDeclarationNode) IsStatic() bool

func (*ValuePatternDeclarationNode) MacroType

func (*ValuePatternDeclarationNode) String

func (n *ValuePatternDeclarationNode) String() string

type VariableDeclarationNode

type VariableDeclarationNode struct {
	TypedNodeBase
	DocCommentableNodeBase
	Name        IdentifierNode // name of the variable
	TypeNode    TypeNode       // type of the variable
	Initialiser ExpressionNode // value assigned to the variable
}

Represents a variable declaration eg. `var foo: String`

func NewVariableDeclarationNode

func NewVariableDeclarationNode(loc *position.Location, docComment string, name IdentifierNode, typ TypeNode, init ExpressionNode) *VariableDeclarationNode

Create a new variable declaration node eg. `var foo: String`

func (*VariableDeclarationNode) Class

func (*VariableDeclarationNode) DirectClass

func (*VariableDeclarationNode) DirectClass() *value.Class

func (*VariableDeclarationNode) Equal

func (n *VariableDeclarationNode) Equal(other value.Value) bool

func (*VariableDeclarationNode) Error

func (v *VariableDeclarationNode) Error() string

func (*VariableDeclarationNode) Inspect

func (n *VariableDeclarationNode) Inspect() string

func (*VariableDeclarationNode) IsStatic

func (*VariableDeclarationNode) IsStatic() bool

func (*VariableDeclarationNode) MacroType

func (*VariableDeclarationNode) String

func (n *VariableDeclarationNode) String() string

type VariablePatternDeclarationNode

type VariablePatternDeclarationNode struct {
	NodeBase
	Pattern     PatternNode
	Initialiser ExpressionNode // value assigned to the variable
}

Represents a variable declaration with patterns eg. `var [foo, { bar }] = baz()`

func NewVariablePatternDeclarationNode

func NewVariablePatternDeclarationNode(loc *position.Location, pattern PatternNode, init ExpressionNode) *VariablePatternDeclarationNode

Create a new variable declaration node with patterns eg. `var [foo, { bar }] = baz()`

func (*VariablePatternDeclarationNode) Class

func (*VariablePatternDeclarationNode) DirectClass

func (*VariablePatternDeclarationNode) DirectClass() *value.Class

func (*VariablePatternDeclarationNode) Equal

func (*VariablePatternDeclarationNode) Error

func (*VariablePatternDeclarationNode) Inspect

func (*VariablePatternDeclarationNode) IsStatic

func (*VariablePatternDeclarationNode) MacroType

func (*VariablePatternDeclarationNode) String

type Variance

type Variance uint8

Represents the variance of a type parameter.

const (
	INVARIANT Variance = iota
	COVARIANT
	CONTRAVARIANT
)

type VariantTypeParameterNode

type VariantTypeParameterNode struct {
	TypedNodeBase
	Variance   Variance // Variance level of this type parameter
	Name       string   // Name of the type parameter eg. `T`
	LowerBound TypeNode
	UpperBound TypeNode
	Default    TypeNode
}

Represents a type parameter eg. `+V`

func NewVariantTypeParameterNode

func NewVariantTypeParameterNode(loc *position.Location, variance Variance, name string, lower, upper, def TypeNode) *VariantTypeParameterNode

Create a new type variable node eg. `+V`

func (*VariantTypeParameterNode) Class

func (*VariantTypeParameterNode) DirectClass

func (*VariantTypeParameterNode) DirectClass() *value.Class

func (*VariantTypeParameterNode) Equal

func (n *VariantTypeParameterNode) Equal(other value.Value) bool

func (*VariantTypeParameterNode) Error

func (n *VariantTypeParameterNode) Error() string

func (*VariantTypeParameterNode) Inspect

func (n *VariantTypeParameterNode) Inspect() string

func (*VariantTypeParameterNode) IsStatic

func (*VariantTypeParameterNode) IsStatic() bool

func (*VariantTypeParameterNode) MacroType

func (*VariantTypeParameterNode) String

func (n *VariantTypeParameterNode) String() string

type VoidTypeNode

type VoidTypeNode struct {
	NodeBase
}

`void` type.

func NewVoidTypeNode

func NewVoidTypeNode(loc *position.Location) *VoidTypeNode

Create a new `void` type node.

func (*VoidTypeNode) Class

func (*VoidTypeNode) Class() *value.Class

func (*VoidTypeNode) DirectClass

func (*VoidTypeNode) DirectClass() *value.Class

func (*VoidTypeNode) Equal

func (n *VoidTypeNode) Equal(other value.Value) bool

func (*VoidTypeNode) Error

func (n *VoidTypeNode) Error() string

func (*VoidTypeNode) Inspect

func (n *VoidTypeNode) Inspect() string

func (*VoidTypeNode) IsStatic

func (*VoidTypeNode) IsStatic() bool

func (*VoidTypeNode) MacroType

func (n *VoidTypeNode) MacroType(env *types.GlobalEnvironment) types.Type

func (*VoidTypeNode) String

func (n *VoidTypeNode) String() string

type WhileExpressionNode

type WhileExpressionNode struct {
	TypedNodeBase
	Condition ExpressionNode  // while condition
	ThenBody  []StatementNode // then expression body
}

Represents a `while` expression eg. `while i < 5 then i += 5`

func NewWhileExpressionNode

func NewWhileExpressionNode(loc *position.Location, cond ExpressionNode, then []StatementNode) *WhileExpressionNode

Create a new `while` expression node eg. `while i < 5 then i += 5`

func (*WhileExpressionNode) Class

func (*WhileExpressionNode) Class() *value.Class

func (*WhileExpressionNode) DirectClass

func (*WhileExpressionNode) DirectClass() *value.Class

func (*WhileExpressionNode) Equal

func (n *WhileExpressionNode) Equal(other value.Value) bool

func (*WhileExpressionNode) Error

func (n *WhileExpressionNode) Error() string

func (*WhileExpressionNode) Inspect

func (n *WhileExpressionNode) Inspect() string

func (*WhileExpressionNode) IsStatic

func (*WhileExpressionNode) IsStatic() bool

func (*WhileExpressionNode) MacroType

func (*WhileExpressionNode) String

func (n *WhileExpressionNode) String() string

type WordArrayListLiteralNode

type WordArrayListLiteralNode struct {
	TypedNodeBase
	Elements []WordCollectionContentNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a word ArrayList literal eg. `\w[foo bar]`

func NewWordArrayListLiteralNode

func NewWordArrayListLiteralNode(loc *position.Location, elements []WordCollectionContentNode, capacity ExpressionNode) *WordArrayListLiteralNode

Create a word ArrayList literal node eg. `\w[foo bar]`

func (*WordArrayListLiteralNode) Class

func (*WordArrayListLiteralNode) DirectClass

func (*WordArrayListLiteralNode) DirectClass() *value.Class

func (*WordArrayListLiteralNode) Equal

func (n *WordArrayListLiteralNode) Equal(other value.Value) bool

func (*WordArrayListLiteralNode) Error

func (n *WordArrayListLiteralNode) Error() string

func (*WordArrayListLiteralNode) Inspect

func (n *WordArrayListLiteralNode) Inspect() string

func (*WordArrayListLiteralNode) IsStatic

func (w *WordArrayListLiteralNode) IsStatic() bool

func (*WordArrayListLiteralNode) MacroType

func (*WordArrayListLiteralNode) String

func (n *WordArrayListLiteralNode) String() string

type WordArrayTupleLiteralNode

type WordArrayTupleLiteralNode struct {
	TypedNodeBase
	Elements []WordCollectionContentNode
}

Represents a word ArrayTuple literal eg. `%w[foo bar]`

func NewWordArrayTupleLiteralNode

func NewWordArrayTupleLiteralNode(loc *position.Location, elements []WordCollectionContentNode) *WordArrayTupleLiteralNode

Create a word ArrayTuple literal node eg. `%w[foo bar]`

func (*WordArrayTupleLiteralNode) Class

func (*WordArrayTupleLiteralNode) DirectClass

func (*WordArrayTupleLiteralNode) DirectClass() *value.Class

func (*WordArrayTupleLiteralNode) Equal

func (n *WordArrayTupleLiteralNode) Equal(other value.Value) bool

func (*WordArrayTupleLiteralNode) Error

func (n *WordArrayTupleLiteralNode) Error() string

func (*WordArrayTupleLiteralNode) Inspect

func (n *WordArrayTupleLiteralNode) Inspect() string

func (*WordArrayTupleLiteralNode) IsStatic

func (*WordArrayTupleLiteralNode) IsStatic() bool

func (*WordArrayTupleLiteralNode) MacroType

func (*WordArrayTupleLiteralNode) String

func (n *WordArrayTupleLiteralNode) String() string

type WordCollectionContentNode

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

All nodes that should be able to appear as elements of word collection literals should implement this interface.

type WordHashSetLiteralNode

type WordHashSetLiteralNode struct {
	TypedNodeBase
	Elements []WordCollectionContentNode
	Capacity ExpressionNode
	// contains filtered or unexported fields
}

Represents a word HashSet literal eg. `^w[foo bar]`

func NewWordHashSetLiteralNode

func NewWordHashSetLiteralNode(loc *position.Location, elements []WordCollectionContentNode, capacity ExpressionNode) *WordHashSetLiteralNode

Create a word HashSet literal node eg. `^w[foo bar]`

func (*WordHashSetLiteralNode) Class

func (*WordHashSetLiteralNode) DirectClass

func (*WordHashSetLiteralNode) DirectClass() *value.Class

func (*WordHashSetLiteralNode) Equal

func (n *WordHashSetLiteralNode) Equal(other value.Value) bool

func (*WordHashSetLiteralNode) Error

func (n *WordHashSetLiteralNode) Error() string

func (*WordHashSetLiteralNode) Inspect

func (n *WordHashSetLiteralNode) Inspect() string

func (*WordHashSetLiteralNode) IsStatic

func (w *WordHashSetLiteralNode) IsStatic() bool

func (*WordHashSetLiteralNode) MacroType

func (*WordHashSetLiteralNode) String

func (n *WordHashSetLiteralNode) String() string

type YieldExpressionNode

type YieldExpressionNode struct {
	NodeBase
	Value   ExpressionNode
	Forward bool
}

Represents a `yield` expression eg. `yield`, `yield true`, `yield* foo()`

func NewYieldExpressionNode

func NewYieldExpressionNode(loc *position.Location, forward bool, val ExpressionNode) *YieldExpressionNode

Create a new `yield` expression node eg. `yield`, `yield true`, `yield* foo()`

func (*YieldExpressionNode) Class

func (*YieldExpressionNode) Class() *value.Class

func (*YieldExpressionNode) DirectClass

func (*YieldExpressionNode) DirectClass() *value.Class

func (*YieldExpressionNode) Equal

func (n *YieldExpressionNode) Equal(other value.Value) bool

func (*YieldExpressionNode) Error

func (n *YieldExpressionNode) Error() string

func (*YieldExpressionNode) Inspect

func (n *YieldExpressionNode) Inspect() string

func (*YieldExpressionNode) IsStatic

func (*YieldExpressionNode) IsStatic() bool

func (*YieldExpressionNode) MacroType

func (*YieldExpressionNode) String

func (n *YieldExpressionNode) String() string

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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