Struct Parser

Source
pub struct Parser<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Parser<'a>

Source

pub fn new(lexer: Lexer<'a>, root_scope: Scope) -> Parser<'a>

Source

pub fn enter_new_scope(&mut self, typ: ScopeType) -> Scope

Source

pub fn return_to_scope(&mut self, old: Scope)

Source

pub fn new_expression( &self, loc: SourceRange, expr: Expression, ) -> Node<Expression>

Source

pub fn new_statement( &self, loc: SourceRange, stmt: Statement, ) -> Node<Statement>

Source

pub fn new_module_item( &self, loc: SourceRange, item: ModuleItem, ) -> Node<ModuleItem>

Source

pub fn lexer_mut(&mut self) -> &mut Lexer<'a>

Source

pub fn source(&self, range: SourceRange) -> &[u8]

Source

pub fn source_as_string(&self, range: SourceRange) -> String

Source

pub fn source_range(&self) -> SourceRange

Source

pub fn checkpoint(&self) -> ParserCheckpoint

Source

pub fn since_checkpoint(&self, checkpoint: ParserCheckpoint) -> SourceRange

Source

pub fn restore_checkpoint(&mut self, checkpoint: ParserCheckpoint)

Source

pub fn peek(&mut self) -> SyntaxResult<Token>

Source

pub fn consume(&mut self) -> SyntaxResult<Token>

Source

pub fn consume_if_pred<F: FnOnce(&Token) -> bool>( &mut self, pred: F, ) -> SyntaxResult<MaybeToken>

Source

pub fn consume_if(&mut self, typ: TokenType) -> SyntaxResult<MaybeToken>

Source

pub fn require_predicate<P: FnOnce(TokenType) -> bool>( &mut self, pred: P, expected: &'static str, ) -> SyntaxResult<Token>

Source

pub fn require(&mut self, typ: TokenType) -> SyntaxResult<Token>

Source

pub fn require_identifier_as_string( &mut self, ) -> SyntaxResult<(SourceRange, String)>

Source§

impl<'a> Parser<'a>

Source§

impl<'a> Parser<'a>

Source§

impl<'a> Parser<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Parser<'a>

§

impl<'a> !RefUnwindSafe for Parser<'a>

§

impl<'a> !Send for Parser<'a>

§

impl<'a> !Sync for Parser<'a>

§

impl<'a> Unpin for Parser<'a>

§

impl<'a> !UnwindSafe for Parser<'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.