Documentation ¶
Overview ¶
Package entity provides data representations of language concepts. They are used to construct syntax trees, and semantic trees. It additionally provides some utility functions to compare certain entities.
Index ¶
- func FormatType(ty Type) string
- func Quote(in string) string
- func TypesEqual(left, right Type) bool
- type Access
- type Address
- type Assignment
- type BitCast
- type Block
- type Break
- type Breakable
- type Call
- type Declaration
- type DefaultCase
- type Dependency
- type Dereference
- type Directive
- type Expression
- type For
- type Function
- type Hash
- type IfElse
- type Key
- type Length
- type LiteralArray
- type LiteralBoolean
- type LiteralFloat
- type LiteralInt
- type LiteralNil
- type LiteralString
- type LiteralStruct
- type Loop
- type Match
- type MatchCase
- type Member
- type MemberAccess
- type Metadata
- type Method
- type MethodCall
- type Operation
- type Operator
- type Reference
- type Return
- type Scope
- type Scoped
- type Signature
- type Slice
- type Subscript
- type Switch
- type SwitchCase
- type TopLevel
- type Type
- type TypeArray
- type TypeFloat
- type TypeInt
- type TypeInterface
- type TypeNamed
- type TypePointer
- type TypeSlice
- type TypeStruct
- type TypeUnion
- type TypeWord
- type Typedef
- type ValueCast
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatType ¶
FormatType returns a string representing a type. If the type is nil, it returns "Void".
func TypesEqual ¶
TypesEqual checks if two types are equal to eachother, even if one or both are nil.
Types ¶
type Access ¶
type Access int
Access determines the external access control mode for a top-level entity.
const ( // AccessPublic allows other modules to access an entity normally. AccessPublic Access = iota // AccessOpaque causes a top-level entity to appear opaque to other // units. Values of opaque types can be passed around, assigned to each- // other, and their methods can be called, but the implementation of the // type is entirely hidden. This access mode cannot be applied to // functions or methods. AccessOpaque // AccessPrivate disallows other modules from accessing a top-level // entity. AccessPrivate )
type Address ¶
type Address string
Address is the address of a unit.
func (Address) Module ¶
Module returns the module associated with the address. If the address does does not point to a module, it returns "", false.
func (Address) Nickname ¶
Nickname automatically generates a nickname from the address, which is a valid Ident token. On failure "", false is returned. The nickname is generated according to the folowing rules:
- If the name contains at least one dot, the last dot and everything after it is removed
- All non-letter, non-numeric characters are removed, and any letters that were directly after them are converted to uppercase
- All numeric digits at the start of the string are removed
- The first character is converted to lowercase
func (Address) SourceFile ¶
SourceFile returns the FSPL source file associated with the address. If the address does not point to an FSPL source file, it returns "", false.
type Assignment ¶
type Assignment struct { Pos errors.Position Location Expression Value Expression }
Assignment allows assigning the result of one expression to one or more location expressions. The assignment statement itself has no value and may not be assigned to anything. An assignment statement is never a valid location expression.
func (*Assignment) HasExplicitType ¶
func (this *Assignment) HasExplicitType() bool
func (*Assignment) Position ¶
func (this *Assignment) Position() errors.Position
func (*Assignment) String ¶
func (this *Assignment) String() string
func (*Assignment) Type ¶
func (this *Assignment) Type() Type
type BitCast ¶
type BitCast struct { Pos errors.Position Ty Type Value Expression }
Bit casting takes the raw data in memory of a certain value and re-interprets it as a value of another type. Since it contains inherent type information, it may be directly assigned to an interface. A bit cast is never a valid location expression.
func (*BitCast) HasExplicitType ¶
type Block ¶
type Block struct { // Syntax Pos errors.Position Steps []Expression // Semantics Ty Type Scope }
Block is an ordered collection of expressions that are evaluated sequentially. It has its own scope. The last expression in the block specifies the block's value, and any assignment rules of the block are equivalent to those of its last expression. A block is never a valid location expression.
func (*Block) HasExplicitType ¶
type Break ¶
type Break struct { // Syntax Pos errors.Position Value Expression // Semantics Loop Breakable }
Break allows breaking out of loops. It has no value and may not be assigned to anything. It is never a valid location expression.
func (*Break) HasExplicitType ¶
type Breakable ¶ added in v0.3.0
type Breakable interface { Expression // contains filtered or unexported methods }
Breakable is any expression that can be halted using a break.
type Call ¶
type Call struct { // Syntax Pos errors.Position UnitNickname string Name string Arguments []Expression // Semantics Function *Function Unit uuid.UUID }
Call calls upon the function specified by the first argument, passing the rest of the arguments to that function. The first argument must be a function name. The result of a call may be assigned to any type matching the function's return type. Since it contains inherent type information, it may be directly assigned to an interface. A call is never a valid location expression.
func (*Call) HasExplicitType ¶
type Declaration ¶
Declaration binds a local identifier to a typed variable, but also acts as a variable expression allowing the variable to be used the moment it is defined. Since it contains inherent type information, it may be directly assigned to an interface. A declaration is always a valid location expression.
func (*Declaration) HasExplicitType ¶
func (this *Declaration) HasExplicitType() bool
func (*Declaration) Position ¶
func (this *Declaration) Position() errors.Position
func (*Declaration) String ¶
func (this *Declaration) String() string
func (*Declaration) Type ¶
func (this *Declaration) Type() Type
type DefaultCase ¶ added in v0.4.0
type DefaultCase struct { Pos errors.Position Expression Scope }
DefaultCase represents the default case in a switch or match expression.
func (*DefaultCase) Position ¶ added in v0.4.0
func (this *DefaultCase) Position() errors.Position
func (*DefaultCase) String ¶ added in v0.4.0
func (this *DefaultCase) String() string
type Dependency ¶
Dependency is a metadata dependency listing.
func (*Dependency) Position ¶
func (this *Dependency) Position() errors.Position
func (*Dependency) String ¶
func (this *Dependency) String() string
type Dereference ¶
type Dereference struct { // Syntax Pos errors.Position Pointer Expression // Semantics Ty Type }
Pointer dereferencing allows retrieving the value of a pointer. It accepts any pointer. It may be assigned to any type matching the pointer's pointed type. Since it contains inherent type information, it may be directly assigned to an interface. A dereference is a valid location expression only if the pointer being dereferenced is.
func (*Dereference) HasExplicitType ¶
func (this *Dereference) HasExplicitType() bool
func (*Dereference) Position ¶
func (this *Dereference) Position() errors.Position
func (*Dereference) String ¶
func (this *Dereference) String() string
func (*Dereference) Type ¶
func (this *Dereference) Type() Type
type Directive ¶
type Directive interface { fmt.Stringer // Position returns the position of the directive within its metadata // file. Position() errors.Position // contains filtered or unexported methods }
Directive is a declaration within a module metadata file.
type Expression ¶
type Expression interface { fmt.Stringer // Position returns the position of the expression within its source // file. Position() errors.Position // Type returns the type of the expression. The return value of this is // only considered valid if the expression has its semantic information // fields filled. Type() Type // HasExplicitType returns true if the expression carries inherent type // information. If it returns false, the expression must be given a type // to conform to. The value of this does not depend on semantic // information fields. HasExplicitType() bool // contains filtered or unexported methods }
Expression is any construct that can be evaluated.
type For ¶ added in v0.3.0
type For struct { // Syntax Pos errors.Position Index *Declaration Element *Declaration Over Expression Body Expression // Semantics Ty Type Scope }
For is a special kind of loop that evaluates an expression for each element of an array or slice. It accepts an index declaration and an element declaration, which are scoped to the loop's body and are set to the index of the current element and the element itself respectively at the beginning of each iteration. The assignment rules of a for statement are identical to that of a normal loop.
func (*For) HasExplicitType ¶ added in v0.3.0
type Function ¶
type Function struct { // Syntax Pos errors.Position Acc Access LinkName string Signature *Signature Body Expression // Semantics Unt uuid.UUID Scope }
Function binds a global identifier and argument list to an expression which is evaluated each time the function is called. If no expression is specified, the function is marked as external. Functions have an argument list, where each argument is passed as a separate variable. They return one value. All of these are typed.
type Hash ¶ added in v0.2.0
type Hash [8]byte
A hash represents a hash sum that fits within a uint64.
func HashType ¶ added in v0.2.0
HashType returns a hash representing a type. If the type is nil, it returns NewHash([]byte("TypeVoid"))
type IfElse ¶
type IfElse struct { // Syntax Pos errors.Position Condition Expression True Expression False Expression // Semantics Ty Type }
If/else is a control flow branching expression that executes one of two expressions depending on a boolean value. If the value of the if/else is unused, the else expression need not be specified. It may be assigned to any type that satisfies the assignment rules of both the true and false expressions. An If/else is never a valid location expression.
func (*IfElse) HasExplicitType ¶
type Key ¶
Key globally indexes top level entities in contexts where modules matter.
func (Key) Hash ¶ added in v0.2.0
Hash returns a representation of the hash of this key that fits within a uint64.
func (Key) LinkName ¶
LinkName returns the name that the entity it refers to will be given when compiled.
func (Key) StripMethod ¶
StripMethod returns a copy of the key that refers to a type instead of a method.
type Length ¶
type Length struct { // Syntax Pos errors.Position Slice Expression // Semantics Ty Type }
Length returns the length of an array or a slice. It always returns a value of type Index. A length is never a valid location expression.
func (*Length) HasExplicitType ¶
type LiteralArray ¶
type LiteralArray struct { // Syntax Pos errors.Position Elements []Expression // Semantics Ty Type }
LiteralArray is a composite array literal. It can contain any number of values. It can be assigned to any array type that:
- has an identical length, and
- who's element type can be assigned to by all the element values in the literal.
It cannot be directly assigned to an interface because it contains no inherent type information. A value cast may be used for this purpose.
func (*LiteralArray) HasExplicitType ¶
func (this *LiteralArray) HasExplicitType() bool
func (*LiteralArray) Position ¶
func (this *LiteralArray) Position() errors.Position
func (*LiteralArray) String ¶
func (this *LiteralArray) String() string
func (*LiteralArray) Type ¶
func (this *LiteralArray) Type() Type
type LiteralBoolean ¶
LiteralBoolean is a boolean literal. It may be either true or false. It can be assigned to any type derived from a boolean. It cannot be directly assigned to an interface because it contains no inherent type information. A value cast may be used for this purpose.
func (*LiteralBoolean) HasExplicitType ¶
func (this *LiteralBoolean) HasExplicitType() bool
func (*LiteralBoolean) Position ¶
func (this *LiteralBoolean) Position() errors.Position
func (*LiteralBoolean) String ¶
func (this *LiteralBoolean) String() string
func (*LiteralBoolean) Type ¶
func (this *LiteralBoolean) Type() Type
type LiteralFloat ¶
LiteralFloat specifies a floating point value. It can be assigned to any type that is derived from a float. It cannot be directly assigned to an interface because it contains no inherent type information. A value cast may be used for this purpose.
func (*LiteralFloat) HasExplicitType ¶
func (this *LiteralFloat) HasExplicitType() bool
func (*LiteralFloat) Position ¶
func (this *LiteralFloat) Position() errors.Position
func (*LiteralFloat) String ¶
func (this *LiteralFloat) String() string
func (*LiteralFloat) Type ¶
func (this *LiteralFloat) Type() Type
type LiteralInt ¶
LiteralInt specifies an integer value. It can be assigned to any type that is derived from an integer or a float, as long as the value fo the literal can fit within the range of the type. It cannot be directly assigned to an interface because it contains no inherent type information. A value cast may be used for this purpose.
func (*LiteralInt) HasExplicitType ¶
func (this *LiteralInt) HasExplicitType() bool
func (*LiteralInt) Position ¶
func (this *LiteralInt) Position() errors.Position
func (*LiteralInt) String ¶
func (this *LiteralInt) String() string
func (*LiteralInt) Type ¶
func (this *LiteralInt) Type() Type
type LiteralNil ¶
TODO: document, put in spec, fully implement nil for slices interfaces etc
func (*LiteralNil) HasExplicitType ¶
func (this *LiteralNil) HasExplicitType() bool
func (*LiteralNil) Position ¶
func (this *LiteralNil) Position() errors.Position
func (*LiteralNil) String ¶
func (this *LiteralNil) String() string
func (*LiteralNil) Type ¶
func (this *LiteralNil) Type() Type
type LiteralString ¶
type LiteralString struct { // Syntax Pos errors.Position ValueUTF8 string ValueUTF16 []uint16 ValueUTF32 []rune // Semantics Ty Type }
LiteralString specifies a string value. It takes on different data representations depending on what the base type of what it is assigned to is structurally equivalent to:
- Integer: Single unicode code point. When assigning to an integer, the string literal may not be longer than one code point, and that code point must fit in the integer.
- Slice of 8 bit integers: UTF-8 string.
- Slice of 16 bit integers: UTF-16 string.
- Slice of 32 bit (or larger) integers: UTF-32 string.
- Array of integers: The same as slices of integers, but the string literal must fit inside of the array.
- Pointer to 8 bit integer: Null-terminated UTF-8 string (AKA C-string).
A string literal cannot be directly assigned to an interface because it contains no inherent type information. A value cast may be used for this purpose.
func (*LiteralString) HasExplicitType ¶
func (this *LiteralString) HasExplicitType() bool
func (*LiteralString) Position ¶
func (this *LiteralString) Position() errors.Position
func (*LiteralString) String ¶
func (this *LiteralString) String() string
func (*LiteralString) Type ¶
func (this *LiteralString) Type() Type
type LiteralStruct ¶
type LiteralStruct struct { // Syntax Pos errors.Position Members []*Member // Semantics Ty Type MemberOrder []string MemberMap map[string]*Member }
LiteralStruct is a composite structure literal. It can contain any number of name:value pairs. It can be assigned to any struct type that:
- has at least the members specified in the literal
- who's member types can be assigned to by the corresponding member values in the literal.
It cannot be directly assigned to an interface because it contains no inherent type information. A value cast may be used for this purpose.
func (*LiteralStruct) HasExplicitType ¶
func (this *LiteralStruct) HasExplicitType() bool
func (*LiteralStruct) Position ¶
func (this *LiteralStruct) Position() errors.Position
func (*LiteralStruct) String ¶
func (this *LiteralStruct) String() string
func (*LiteralStruct) Type ¶
func (this *LiteralStruct) Type() Type
type Loop ¶
type Loop struct { // Syntax Pos errors.Position Body Expression // Semantics Ty Type }
Loop is a control flow expression that repeats an expression until a break statement is called from within it. The break statement must be given a value if the value of the loop is used. Otherwise, it need not even have a break statement. The result of the loop may be assigned to any type that satisfies the assignment rules of all of its break statements. Loops may be nested, and break statements only apply to the closest containing loop. The value of the loop's expression is never used. A loop is never a valid location expression.
func (*Loop) HasExplicitType ¶
type Match ¶ added in v0.2.0
type Match struct { // Syntax Pos errors.Position Value Expression Cases []*MatchCase Default *DefaultCase // Semantics Ty Type CaseOrder []Hash CaseMap map[Hash]*MatchCase }
Match is a control flow branching expression that executes one of several case expressions depending on the input. It can be used to check the type of a union value. Each case takes the form of a declaration, and an associated expression. If the type of the union matches the type of the declaration in the case, the expression is executed and the value of the union is made available to it through the declaration. If the value of the match expression is used, all possible types in the union must be accounted for. It may be assigned to any type that satisfies the assignment rules of its first case.
func (*Match) HasExplicitType ¶ added in v0.2.0
type MatchCase ¶ added in v0.4.0
type MatchCase struct { Pos errors.Position Declaration *Declaration Expression Scope }
MatchCase represents a case in a match expression.
type Member ¶
type Member struct { Pos errors.Position Name string Value Expression }
Member is a syntactical construct that is used to list members in struct literals.
type MemberAccess ¶
type MemberAccess struct { // Syntax Pos errors.Position Source Expression Member string // Semantics Ty Type }
Member access allows referring to a specific member of a value with a struct type. It accepts any struct type that contains the specified member name, and may be assigned to any type that matches the type of the selected member. Since it contains inherent type information, it may be directly assigned to an interface. A member access is a valid location expression only when the struct being accessed is.
func (*MemberAccess) HasExplicitType ¶
func (this *MemberAccess) HasExplicitType() bool
func (*MemberAccess) Position ¶
func (this *MemberAccess) Position() errors.Position
func (*MemberAccess) String ¶
func (this *MemberAccess) String() string
func (*MemberAccess) Type ¶
func (this *MemberAccess) Type() Type
type Metadata ¶
type Metadata struct { Pos errors.Position UUID uuid.UUID Dependencies []*Dependency }
Metadata represents a module metadata file.
type Method ¶
type Method struct { // Syntax Pos errors.Position Acc Access TypeName string LinkName string Signature *Signature Body Expression // Semantics Unt uuid.UUID Type Type This *Declaration Scope }
Method is like a function, except localized to a defined type. Methods are called on an instance of that type, and receive a pointer to that instance via the "this" variable when they are run. Method names are not globally unique, but are unique within the type they are defined on.
type MethodCall ¶
type MethodCall struct { // Syntax Pos errors.Position Source Expression Name string Arguments []Expression // Semantics Method *Method Behavior *Signature Ty Type }
MethodCall calls upon the method of the variable before the dot that is specified by the first argument, passing the rest of the arguments to the method. The first argument must be a method name. The result of a call may be assigned to any type matching the method's return type. Since it contains inherent type information, it may be directly assigned to an interface. A method call is never a valid location expression.
func (*MethodCall) HasExplicitType ¶
func (this *MethodCall) HasExplicitType() bool
func (*MethodCall) Position ¶
func (this *MethodCall) Position() errors.Position
func (*MethodCall) String ¶
func (this *MethodCall) String() string
func (*MethodCall) Type ¶
func (this *MethodCall) Type() Type
type Operation ¶
type Operation struct { // Syntax Pos errors.Position Operator Operator Arguments []Expression // Semantics Ty Type }
Operations perform math, logic, or bit manipulation on values. They accept values of the same type as the type they are being assigned to, except in special cases. Since they contain no inherent type information, they may not be assigned to interfaces. An operation is never a valid location expression.
func (*Operation) HasExplicitType ¶
type Operator ¶
type Operator int
Operator determines which operation to apply to a value in an operation expression.
const ( // Math OperatorAdd Operator = iota OperatorIncrement OperatorSubtract OperatorDecrement OperatorMultiply OperatorDivide OperatorModulo // Logic OperatorLogicalNot OperatorLogicalOr OperatorLogicalAnd OperatorLogicalXor // Bit manipulation OperatorNot OperatorOr OperatorAnd OperatorXor OperatorLeftShift OperatorRightShift // Comparison OperatorLess OperatorGreater OperatorLessEqual OperatorGreaterEqual OperatorEqual )
func OperatorFromString ¶
func (Operator) ResultsInBoolean ¶
ResultsInBoolean determines whether or not this operation will always result in a boolean value.
type Reference ¶
type Reference struct { // Syntax Pos errors.Position Value Expression // Semantics Ty Type }
Value referencing allows retrieving the location of a value in memory. It accepts any location expression, and can be assigned to any type that is a pointer to the location expression's type. Since it contains inherent type information, it can be directly assigned to an interface, although it doesn't make a whole lot of sense to do so because assigning a value to an interface automatically references it anyway. A reference is never a valid location expression.
func (*Reference) HasExplicitType ¶
type Return ¶
type Return struct { // Syntax Pos errors.Position Value Expression // Semantics Declaration TopLevel }
Return allows terminating functions before they have reached their end. It accepts values that may be assigned to the function's return type. If a function does not return anything, the return statement does not accept a value. In all cases, return statements have no value and may not be assigned to anything. A return statement is never a valid location expression.
func (*Return) HasExplicitType ¶
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope implements a scope.
func (*Scope) AddVariable ¶
func (this *Scope) AddVariable(declaration *Declaration)
func (*Scope) OverVariables ¶
func (this *Scope) OverVariables(callback func(*Declaration) bool)
func (*Scope) Variable ¶
func (this *Scope) Variable(name string) *Declaration
type Scoped ¶
type Scoped interface { // Variable returns the declaration of the variable with the given name. // If no variable is found in this scope, it returns nil. Only the scope // in this entity is searched. Variable(name string) *Declaration // AddVariable adds a variable to this entity's scope. AddVariable(declaration *Declaration) // OverVariables calls callback for each defined variable, stopping if // returns false. OverVariables(callback func(*Declaration) bool) }
Scoped represents any entity that has its own scope.
type Signature ¶
type Signature struct { // Syntax Pos errors.Position Name string Arguments []*Declaration Return Type // Semantics Acc Access Unt uuid.UUID ArgumentOrder []string ArgumentMap map[string]*Declaration }
Signature is a function or method signature that is used in functions, methods, and specifying interface behaviors. It defines the type of a function.
type Slice ¶
type Slice struct { // Syntax Pos errors.Position Slice Expression Start Expression End Expression }
Slice adjusts the start and end points of a slice relative to its current starting index, and returns an adjusted copy pointing to the same data. Any assignment rules of this expression are equivalent to those of the slice it is operating on. A slice is never a valid location expression.
func (*Slice) HasExplicitType ¶
type Subscript ¶
type Subscript struct { // Syntax Pos errors.Position Slice Expression Offset Expression // Semantics Ty Type }
Slice subscripting allows referring to a specific element of a slice. It accepts any slice, and any offset of type Size. It may be assigned to any type matching the slice's element type. Since it contains inherent type information, it may be directly assigned to an interface. A subscript is a valid location expression only if the array being subscripted is.
func (*Subscript) HasExplicitType ¶
type Switch ¶ added in v0.4.0
type Switch struct { // Syntax Pos errors.Position Value Expression Cases []*SwitchCase Default *DefaultCase // Semantics Ty Type CaseOrder []int64 CaseMap map[int64]*SwitchCase }
Switch is a control flow branching expression that executes one of several case expressions depending on the value of the input. It accepts any pointer or integer type. If the value of the switch expression is used, a default case must be present. It may be assigned to any type that satisfies the assignment rules of its first case.
func (*Switch) HasExplicitType ¶ added in v0.4.0
type SwitchCase ¶ added in v0.4.0
type SwitchCase struct { Pos errors.Position Key Expression Expression Scope }
SwitchCase represents a case in a switch expression.
func (*SwitchCase) Position ¶ added in v0.4.0
func (this *SwitchCase) Position() errors.Position
func (*SwitchCase) String ¶ added in v0.4.0
func (this *SwitchCase) String() string
type TopLevel ¶
type TopLevel interface { fmt.Stringer // Position returns the position of the entity within its source file. Position() errors.Position // Access returns the access control mode of the entity. Access() Access // Unit returns the unit that the entity was defined in. Unit() uuid.UUID // contains filtered or unexported methods }
TopLevel is any construct that is placed at the root of a file.
type Type ¶
type Type interface { fmt.Stringer // Position returns the position of the type within its source file. Position() errors.Position // Equals returns whether this type is equivalent to another type. Equals(ty Type) bool // Access returns the access control mode of the type. Access() Access // Unit returns the unit that the type was defined in. Unit() uuid.UUID // Hash returns a hash of this type that fits within a uint64. Hash() Hash // contains filtered or unexported methods }
Type is any type notation.
type TypeArray ¶
type TypeArray struct { Pos errors.Position Length int Element Type // Semantics Acc Access Unt uuid.UUID }
TypeArray is a group of values of a given type stored next to eachother. The length of an array is fixed and is part of its type. Arrays are passed by value unless a pointer is used.
type TypeInt ¶
type TypeInt struct { Pos errors.Position Width int Signed bool // Semantics Acc Access Unt uuid.UUID }
TypeInt represents any signed or unsigned integer type.
type TypeInterface ¶
type TypeInterface struct { // Syntax Pos errors.Position Behaviors []*Signature // Semantics Acc Access Unt uuid.UUID BehaviorOrder []string BehaviorMap map[string]*Signature }
TypeInterface is a polymorphic pointer that allows any value of any type through, except it must have at least the methods defined within the interface. Interfaces are always passed by reference. When assigning a value to an interface, it will be referenced automatically. When assigning a pointer to an interface, the pointer's reference will be used instead.
func (*TypeInterface) Access ¶
func (this *TypeInterface) Access() Access
func (*TypeInterface) Equals ¶
func (this *TypeInterface) Equals(ty Type) bool
func (*TypeInterface) Hash ¶ added in v0.2.0
func (this *TypeInterface) Hash() Hash
func (*TypeInterface) Position ¶
func (this *TypeInterface) Position() errors.Position
func (*TypeInterface) String ¶
func (this *TypeInterface) String() string
func (*TypeInterface) Unit ¶
func (this *TypeInterface) Unit() uuid.UUID
type TypeNamed ¶
type TypeNamed struct { // Syntax Pos errors.Position UnitNickname string Name string Type Type // Semantics Acc Access Unt uuid.UUID }
TypeNamed refers to a user-defined or built in named type.
type TypePointer ¶
type TypePointer struct { Pos errors.Position Referenced Type // Semantics Acc Access Unt uuid.UUID }
TypePointer is a pointer to another type.
func (*TypePointer) Access ¶
func (this *TypePointer) Access() Access
func (*TypePointer) Equals ¶
func (this *TypePointer) Equals(ty Type) bool
func (*TypePointer) Hash ¶ added in v0.2.0
func (this *TypePointer) Hash() Hash
func (*TypePointer) Position ¶
func (this *TypePointer) Position() errors.Position
func (*TypePointer) String ¶
func (this *TypePointer) String() string
func (*TypePointer) Unit ¶
func (this *TypePointer) Unit() uuid.UUID
type TypeSlice ¶
TypeSlice is a pointer to several values of a given type stored next to eachother. Its length is not built into its type and can be changed at runtime.
type TypeStruct ¶
type TypeStruct struct { // Syntax Pos errors.Position Members []*Declaration // Semantics Acc Access Unt uuid.UUID MemberOrder []string MemberMap map[string]*Declaration }
TypeStruct is a composite type that stores keyed values. The positions of the values within the struct are decided at compile time, based on the order they are specified in. Structs are passed by value unless a pointer is used.
func (*TypeStruct) Access ¶
func (this *TypeStruct) Access() Access
func (*TypeStruct) Equals ¶
func (this *TypeStruct) Equals(ty Type) bool
func (*TypeStruct) Hash ¶ added in v0.2.0
func (this *TypeStruct) Hash() Hash
func (*TypeStruct) Position ¶
func (this *TypeStruct) Position() errors.Position
func (*TypeStruct) String ¶
func (this *TypeStruct) String() string
func (*TypeStruct) Unit ¶
func (this *TypeStruct) Unit() uuid.UUID
type TypeUnion ¶ added in v0.2.0
type TypeUnion struct { // Syntax Pos errors.Position Allowed []Type // Semantics Acc Access Unt uuid.UUID AllowedOrder []Hash AllowedMap map[Hash]Type }
TypeUnion is a polymorphic type that can hold any value as long as it is one of a list of allowed types. It is not a pointer. It holds the hash of the actual type of the value stored within it, followed by the value. The hash field is computed using the type's name, and the UUID that it was defined in. If it is not named, then the hash is computed using the structure of the type. The value field is always big enough to hold the largest type in the allowed list.
type TypeWord ¶
TypeWord represents an integer type of unspecified width. The optimal width is chosen based on the machine word size (32 on 32 bit systems, 64 on 64 bit systems, etc)
type Typedef ¶
type Typedef struct { // Syntax Pos errors.Position Acc Access Name string Type Type // Semantics Unt uuid.UUID Methods map[string]*Method }
Typedef binds a type to a global identifier.
type ValueCast ¶
type ValueCast struct { Pos errors.Position Ty Type Value Expression }
Vaue casting converts a value of a certain type to another type. Since it contains inherent type information, it may be directly assigned to an interface. A value cast is never a valid location expression.
func (*ValueCast) HasExplicitType ¶
type Variable ¶
type Variable struct { // Syntax Pos errors.Position Name string // Semantics Declaration *Declaration }
Variable specifies a named variable. It can be assigned to a type matching the variable declaration's type. Since it contains inherent type information, it may be directly assigned to an interface. A variable is always a valid location expression.