Enum kailua_syntax::ast::K
[−]
[src]
pub enum K { Oops, Dynamic, Any, Nil, Boolean, BooleanLit(bool), Number, Integer, IntegerLit(i32), String, StringLit(Str), Table, EmptyTable, Record(Vec<(Spanned<Str>, Spanned<SlotKind>)>, bool), Tuple(Vec<Spanned<SlotKind>>), Array(Spanned<SlotKind>), Map(Spanned<Kind>, Spanned<SlotKind>), Function, Func(Spanned<FuncKind>), Thread, UserData, Named(Spanned<Name>), WithNil(Spanned<Kind>), WithoutNil(Spanned<Kind>), Union(Vec<Spanned<Kind>>), Attr(Spanned<Kind>, Spanned<Attr>), Error(Option<Spanned<Str>>), }
A Kailua type.
The syntax-level type is actually termed a "kind", because this and the actual type are frequently used altogether, and it is not really a "type" but a specification that leads to a type.
Variants
Oops
An error type resulting from a parsing error.
Dynamic
WHATEVER
.
Any
any
.
Nil
nil
.
Boolean
boolean
or bool
.
BooleanLit(bool)
A boolean literal type (true
or false
).
Number
number
.
Integer
integer
or int
.
IntegerLit(i32)
An integral literal type.
String
string
.
StringLit(Str)
A string literal type.
Table
table
.
EmptyTable
{}
.
Record(Vec<(Spanned<Str>, Spanned<SlotKind>)>, bool)
{a: T, b: U}
(inextensible) or {a: T, b: U, ...}
(extensible).
The second bool
is true if the record type is extensible.
Tuple(Vec<Spanned<SlotKind>>)
{T, U}
.
The tuple type is never extensible, though the checker can internally have extensible tuples.
Array(Spanned<SlotKind>)
vector<T>
. (The name "array" is a historic artifact.)
Map(Spanned<Kind>, Spanned<SlotKind>)
map<T, U>
.
Function
function
.
Func(Spanned<FuncKind>)
function(...) -> ...
.
Thread
thread
.
UserData
userdata
.
Named(Spanned<Name>)
A named type.
WithNil(Spanned<Kind>)
T?
.
The checker distinguishes a plain type and a "nilable" type,
but in the syntax ?
is considered a (non-associative) type operator.
WithoutNil(Spanned<Kind>)
T!
.
The checker distinguishes a plain type and a "nilable" type,
but in the syntax !
is considered a (non-associative) type operator.
Union(Vec<Spanned<Kind>>)
T | U | ...
.
Attr(Spanned<Kind>, Spanned<Attr>)
[attribute] T
.
Error(Option<Spanned<Str>>)
error "message"
. Currently parsed but not checked.
Trait Implementations
impl Clone for K
[src]
fn clone(&self) -> K
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for K
[src]
fn eq(&self, __arg_0: &K) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &K) -> bool
This method tests for !=
.