[−][src]Enum full_moon::tokenizer::TokenType
The type of tokens in parsed code
Variants
Eof
End of file, should always be the very last token
Identifier
An identifier, such as foo
Fields of Identifier
MultiLineComment
A multi line comment in the format of --[[ comment ]]
Fields of MultiLineComment
Number
A literal number, such as 3.3
Fields of Number
SingleLineComment
A single line comment, such as -- comment
Fields of SingleLineComment
StringLiteral
A literal string, such as "Hello, world"
Fields of StringLiteral
literal: Cow<'a, str>
The literal itself, ignoring quotation marks
multi_line: Option<usize>
Number of equals signs used for a multi line string, if it is one
For example, [=[string]=]
would have a multi_line
value of Some(1)
[[string]] would have a multi_line
value of Some(0)
A string such as "string"
would have a multi_line
value of None
quote_type: StringLiteralQuoteType
The type of quotation mark used to make the string
Symbol
A Symbol
, such as local
or +
Fields of Symbol
symbol: Symbol
The symbol itself
Whitespace
Whitespace, such as tabs or new lines
Fields of Whitespace
Methods
impl<'a> TokenType<'a>
[src]
pub fn ignore(&self) -> bool
[src]
Returns whether a token can be practically ignored in most cases
Comments and whitespace will return true
, everything else will return false
pub fn kind(&self) -> TokenKind
[src]
Returns the TokenKind
of the token type.
use std::borrow::Cow; use full_moon::tokenizer::{TokenKind, TokenType}; assert_eq!( TokenType::Identifier { identifier: Cow::from("hello") }.kind(), TokenKind::Identifier, );
Trait Implementations
impl<'_> Owned for TokenType<'_>
[src]
type Owned = TokenType<'static>
What an owned version of the object looks like. Usually contains a 'static
lifetime.
fn owned(&self) -> Self::Owned
[src]
impl<'a> Eq for TokenType<'a>
[src]
impl<'a> Clone for TokenType<'a>
[src]
impl<'a> PartialEq<TokenType<'a>> for TokenType<'a>
[src]
impl<'a> Debug for TokenType<'a>
[src]
impl<'a> Serialize for TokenType<'a>
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de: 'a, 'a> Deserialize<'de> for TokenType<'a>
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<'a> Unpin for TokenType<'a>
impl<'a> Sync for TokenType<'a>
impl<'a> Send for TokenType<'a>
impl<'a> UnwindSafe for TokenType<'a>
impl<'a> RefUnwindSafe for TokenType<'a>
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,