Struct erg_parser::token::Token
source · [−]pub struct Token {
pub kind: TokenKind,
pub content: Str,
pub lineno: usize,
pub col_begin: usize,
}
Fields
kind: TokenKind
content: Str
lineno: usize
1 origin
col_begin: usize
a pointer from which the token starts (0 origin)
Implementations
sourceimpl Token
impl Token
pub fn dummy() -> Self
pub fn new<S: Into<Str>>(
kind: TokenKind,
cont: S,
lineno: usize,
col_begin: usize
) -> Self
pub fn from_str(kind: TokenKind, cont: &str) -> Self
pub fn symbol(cont: &str) -> Self
pub fn symbol_with_line(cont: &str, line: usize) -> Self
pub const fn static_symbol(s: &'static str) -> Self
pub const fn category(&self) -> TokenCategory
pub fn category_is(&self, category: TokenCategory) -> bool
pub fn is(&self, kind: TokenKind) -> bool
pub const fn is_block_op(&self) -> bool
pub const fn inspect(&self) -> &Str
pub fn is_procedural(&self) -> bool
Trait Implementations
sourceimpl Locational for Token
impl Locational for Token
sourceimpl Stream<Token> for TokenStream
impl Stream<Token> for TokenStream
fn payload(self) -> Vec<Token>
fn ref_payload(&self) -> &Vec<Token>
fn ref_mut_payload(&mut self) -> &mut Vec<Token>
fn clear(&mut self)
fn len(&self) -> usize
fn size(&self) -> usize
fn is_empty(&self) -> bool
fn insert(&mut self, idx: usize, elem: T)
fn remove(&mut self, idx: usize) -> T
fn push(&mut self, elem: T)
fn append<S>(&mut self, s: &mut S)where
S: Stream<T>,
fn pop(&mut self) -> Option<T>
fn lpop(&mut self) -> Option<T>
fn get(&self, idx: usize) -> Option<&T>
fn get_mut(&mut self, idx: usize) -> Option<&mut T>
fn first(&self) -> Option<&T>
fn first_mut(&mut self) -> Option<&mut T>
fn last(&self) -> Option<&T>
fn last_mut(&mut self) -> Option<&mut T>
fn iter(&self) -> Iter<'_, T>
fn iter_mut(&mut self) -> IterMut<'_, T>
fn into_iter(self) -> IntoIter<T, Global>
fn take_all(&mut self) -> Vec<T, Global>
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
impl Eq for Token
impl StructuralEq for Token
Auto Trait Implementations
impl RefUnwindSafe for Token
impl !Send for Token
impl !Sync for Token
impl Unpin for Token
impl UnwindSafe for Token
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more