Struct erg_parser::token::Token
source · pub struct Token {
pub kind: TokenKind,
pub content: Str,
pub lineno: u32,
pub col_begin: u32,
}
Fields§
§kind: TokenKind
§content: Str
§lineno: u32
1 origin
col_begin: u32
a pointer from which the token starts (0 origin)
Implementations§
source§impl Token
impl Token
pub const DUMMY: Token = _
pub const fn dummy(kind: TokenKind, content: &'static str) -> Self
pub fn new<S: Into<Str>>( kind: TokenKind, cont: S, lineno: u32, col_begin: u32 ) -> Self
pub fn from_str(kind: TokenKind, cont: &str) -> Self
pub fn symbol(cont: &str) -> Self
pub fn symbol_with_line(cont: &str, lineno: u32) -> Self
pub const fn static_symbol(s: &'static str) -> Self
pub fn deep_eq(&self, other: &Self) -> bool
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
pub fn is_const(&self) -> bool
Trait Implementations§
source§impl DequeStream<Token> for TokenStream
impl DequeStream<Token> for TokenStream
fn payload(self) -> VecDeque<Token>
fn ref_payload(&self) -> &VecDeque<Token>
fn ref_mut_payload(&mut self) -> &mut VecDeque<Token>
fn is_empty(&self) -> bool
fn push(&mut self, elem: T)
fn push_front(&mut self, elem: T)
fn pop_front(&mut self) -> Option<T>
fn get(&self, idx: usize) -> Option<&T>
fn first(&self) -> Option<&T>
fn last(&self) -> Option<&T>
fn iter(&self) -> Iter<'_, T>
fn len(&self) -> usize
source§impl FromIterator<Token> for TokenStream
impl FromIterator<Token> for TokenStream
source§impl Locational for Token
impl Locational for Token
source§fn loc(&self) -> Location
fn loc(&self) -> Location
NOTE:
loc
cannot be treated as a light method when self
is a large grammatical element.
If possible, delay the computation by passing &impl Locational
or other means.