pub struct ParseSession<'a> {
pub token: Token,
pub diagnostics: Vec<Diagnostic>,
pub closing_keywords: Vec<Vec<Token>>,
pub last_token: Token,
pub last_range: Range<usize>,
pub parse_progress: usize,
pub id_provider: IdProvider,
pub source_range_factory: SourceLocationFactory,
pub scope: Option<String>,
/* private fields */
}Fields§
§token: Token§diagnostics: Vec<Diagnostic>§closing_keywords: Vec<Vec<Token>>§last_token: Tokenthe token parsed before the current one stored in token
last_range: Range<usize>the range of the last_token
parse_progress: usize§id_provider: IdProvider§source_range_factory: SourceLocationFactory§scope: Option<String>Implementations§
Source§impl<'a> ParseSession<'a>
impl<'a> ParseSession<'a>
pub fn new( l: Lexer<'a, Token>, id_provider: IdProvider, source_range_factory: SourceLocationFactory, ) -> ParseSession<'a>
pub fn get_src(&self) -> &str
pub fn next_id(&mut self) -> AstId
Sourcepub fn try_consume(&mut self, token: Token) -> bool
pub fn try_consume(&mut self, token: Token) -> bool
Tries to consume the given token, returning false if it failed.
Sourcepub fn peek(&self) -> Token
pub fn peek(&self) -> Token
Returns the token that follows the current one without consuming the current token.
pub fn try_consume_or_report(&mut self, token: Token)
pub fn slice_and_advance(&mut self) -> String
pub fn is_end_of_stream(&self) -> bool
pub fn slice_region(&self, range: Range<usize>) -> &str
pub fn advance(&mut self)
pub fn slice(&self) -> &str
pub fn location(&self) -> SourceLocation
pub fn last_location(&self) -> SourceLocation
pub fn range(&self) -> Range<usize>
pub fn accept_diagnostic(&mut self, diagnostic: Diagnostic)
pub fn enter_region(&mut self, end_token: Vec<Token>)
pub fn close_region(&mut self)
Sourcepub fn closes_open_region(&self, token: &Token) -> bool
pub fn closes_open_region(&self, token: &Token) -> bool
returns true if the given token closes an open region
pub fn recover_until_close(&mut self)
Auto Trait Implementations§
impl<'a> Freeze for ParseSession<'a>
impl<'a> RefUnwindSafe for ParseSession<'a>
impl<'a> Send for ParseSession<'a>
impl<'a> Sync for ParseSession<'a>
impl<'a> Unpin for ParseSession<'a>
impl<'a> UnsafeUnpin for ParseSession<'a>
impl<'a> UnwindSafe for ParseSession<'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