pub struct Lexer<'a> { /* private fields */ }Expand description
A scanner over one file.
Implementations§
Source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
Sourcepub fn new(src: &'a [u8], file_start: BytePos, opts: Options) -> Lexer<'a>
pub fn new(src: &'a [u8], file_start: BytePos, opts: Options) -> Lexer<'a>
A scanner over src, whose first byte sits at file_start.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Everything the scan has complained about so far.
Sourcepub fn take_diagnostics(&mut self) -> Vec<Diagnostic>
pub fn take_diagnostics(&mut self) -> Vec<Diagnostic>
Takes the diagnostics, leaving the scanner able to carry on.
Sourcepub fn next_token(&mut self, interner: &mut Interner) -> PpToken
pub fn next_token(&mut self, interner: &mut Interner) -> PpToken
The next preprocessing token, or an end of file token at the end.
Sourcepub fn header_name(&mut self, interner: &mut Interner) -> Option<PpToken>
pub fn header_name(&mut self, interner: &mut Interner) -> Option<PpToken>
Scans a header name, which only a #include line can ask for.
Returns None when the line does not begin with < or ", which is the computed
include case: the directive has to macro expand the line and try again. The scanner
cannot make this call itself, because <stdio.h> and a pair of comparisons are the
same bytes and only the directive knows which one is possible here.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Lexer<'a>
impl<'a> RefUnwindSafe for Lexer<'a>
impl<'a> Send for Lexer<'a>
impl<'a> Sync for Lexer<'a>
impl<'a> Unpin for Lexer<'a>
impl<'a> UnsafeUnpin for Lexer<'a>
impl<'a> UnwindSafe for Lexer<'a>
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