pub enum TableKey {
ERROR,
UndefinedNumber(u32),
UndefinedString(SmolStr),
Simple(Token),
Expression(Bracketed<Pointer<Expression>>),
Type(Bracketed<Pointer<TypeValue>>),
}Expand description
A possible key entry in a table. The key is usually a string, but it can be a value (from an expression) in tables or a type in type definitions.
local t = {
-- The normal string key.
foo = "foo",
-- A Value key, it's still a string, but what's inside [] is
-- always counted as an expression, even if simple.
["bar"] = "bar",
}
type T = {
-- The normal string key.
foo: "foo",
-- A Type key, it indicates that the key can be any string, not the word "string".
[string]: number,
}Variants§
ERROR
This TableKey had a syntax error.
UndefinedNumber(u32)
Cases in which a key in a table expression wasn’t provided, it’s guessed as a number in that case.
UndefinedString(SmolStr)
Cases in which a key in a type expression wasn’t provided,
it’s guessed as number. It has no other possible values
than number.
Simple(Token)
Simple key
Expression(Bracketed<Pointer<Expression>>)
An expression, can only be used in definitions and not in types.
Type(Bracketed<Pointer<TypeValue>>)
A type definition, can only be used in other types and not definitions.
Trait Implementations§
Source§impl GetRange for TableKey
impl GetRange for TableKey
Source§fn get_range(&self) -> Result<Range, GetRangeError>
fn get_range(&self) -> Result<Range, GetRangeError>
Get the range of the node. This will only fail if
Cst.status is
AstStatus::HasErrors.Source§impl Ord for TableKey
impl Ord for TableKey
Source§impl Parse<TableAccessKey> for TableKey
impl Parse<TableAccessKey> for TableKey
Source§fn parse(
token: Token,
lexer: &mut Lexer<'_>,
errors: &mut Vec<ParseError>,
) -> Option<TableAccessKey>
fn parse( token: Token, lexer: &mut Lexer<'_>, errors: &mut Vec<ParseError>, ) -> Option<TableAccessKey>
Try parsing the current item, starting from the passed token.
Source§impl ParseWithArgs<bool> for TableKey
impl ParseWithArgs<bool> for TableKey
Source§fn parse_with(
token: Token,
lexer: &mut Lexer<'_>,
errors: &mut Vec<ParseError>,
is_type: bool,
) -> Option<Self>
fn parse_with( token: Token, lexer: &mut Lexer<'_>, errors: &mut Vec<ParseError>, is_type: bool, ) -> Option<Self>
Try parsing the current item, starting from the passed token with the
passed arguments.
Source§impl PartialOrd for TableKey
impl PartialOrd for TableKey
impl Eq for TableKey
impl StructuralPartialEq for TableKey
Auto Trait Implementations§
impl Freeze for TableKey
impl RefUnwindSafe for TableKey
impl !Send for TableKey
impl !Sync for TableKey
impl Unpin for TableKey
impl UnwindSafe for TableKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more