Skip to main content

ParseSession

Struct ParseSession 

Source
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: Token

the 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>

Source

pub fn new( l: Lexer<'a, Token>, id_provider: IdProvider, source_range_factory: SourceLocationFactory, ) -> ParseSession<'a>

Source

pub fn get_src(&self) -> &str

Source

pub fn next_id(&mut self) -> AstId

Source

pub fn try_consume(&mut self, token: Token) -> bool

Tries to consume the given token, returning false if it failed.

Source

pub fn peek(&self) -> Token

Returns the token that follows the current one without consuming the current token.

Source

pub fn try_consume_or_report(&mut self, token: Token)

Source

pub fn slice_and_advance(&mut self) -> String

Source

pub fn is_end_of_stream(&self) -> bool

Source

pub fn slice_region(&self, range: Range<usize>) -> &str

Source

pub fn advance(&mut self)

Source

pub fn slice(&self) -> &str

Source

pub fn location(&self) -> SourceLocation

Source

pub fn last_location(&self) -> SourceLocation

Source

pub fn range(&self) -> Range<usize>

Source

pub fn accept_diagnostic(&mut self, diagnostic: Diagnostic)

Source

pub fn enter_region(&mut self, end_token: Vec<Token>)

Source

pub fn close_region(&mut self)

Source

pub fn closes_open_region(&self, token: &Token) -> bool

returns true if the given token closes an open region

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.