pub struct CommonToken { /* private fields */ }Implementations§
Source§impl CommonToken
impl CommonToken
pub fn new(token_type: i32) -> Self
pub fn eof( source_name: impl Into<Rc<str>>, index: usize, line: usize, column: usize, ) -> Self
pub fn with_text(self, text: impl Into<Rc<str>>) -> Self
pub fn with_source_text( self, input: Rc<str>, start_byte: u32, stop_byte: u32, ) -> Self
pub const fn with_span(self, start: usize, stop: usize) -> Self
pub const fn with_position(self, line: usize, column: usize) -> Self
pub const fn with_channel(self, channel: i32) -> Self
pub fn with_source_name(self, source_name: impl Into<Rc<str>>) -> Self
pub const fn set_token_index(&mut self, token_index: isize)
Source§impl CommonToken
impl CommonToken
Sourcepub fn text(&self) -> &str
pub fn text(&self) -> &str
The token’s text, empty when unset — ANTLR’s getText() shape, which
generated test actions print directly (token.text() in {}).
This inherent method intentionally shadows the Option-returning
Token::text trait method on concrete CommonToken values; generic
code keeps the trait signature.
Trait Implementations§
Source§impl Clone for CommonToken
impl Clone for CommonToken
Source§fn clone(&self) -> CommonToken
fn clone(&self) -> CommonToken
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommonToken
impl Debug for CommonToken
Source§impl Display for CommonToken
impl Display for CommonToken
impl Eq for CommonToken
Source§impl PartialEq for CommonToken
impl PartialEq for CommonToken
impl StructuralPartialEq for CommonToken
Source§impl Token for CommonToken
impl Token for CommonToken
fn token_type(&self) -> i32
fn channel(&self) -> i32
Source§fn stop(&self) -> usize
fn stop(&self) -> usize
Zero-based absolute inclusive stop index measured in Unicode scalar
values.
fn token_index(&self) -> isize
Source§fn column(&self) -> usize
fn column(&self) -> usize
Zero-based source column where the token starts, measured in Unicode
scalar values from the start of
line.fn text(&self) -> Option<&str>
fn source_name(&self) -> &str
Source§fn start_byte(&self) -> usize
fn start_byte(&self) -> usize
Zero-based absolute start offset measured in UTF-8 bytes. Read more
Source§fn stop_byte(&self) -> usize
fn stop_byte(&self) -> usize
Zero-based exclusive end offset measured in UTF-8 bytes. Read more
fn interval(&self) -> TextInterval
Auto Trait Implementations§
impl !Send for CommonToken
impl !Sync for CommonToken
impl Freeze for CommonToken
impl RefUnwindSafe for CommonToken
impl Unpin for CommonToken
impl UnsafeUnpin for CommonToken
impl UnwindSafe for CommonToken
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