Skip to main content

Parser

Struct Parser 

Source
pub struct Parser<'source> {
    pub errors: Vec<ParseError>,
    /* private fields */
}

Fields§

§errors: Vec<ParseError>

Implementations§

Source§

impl<'source> Parser<'source>

Source§

impl<'source> Parser<'source>

Source

pub fn parse_enum_definition( &mut self, doc: Option<String>, attributes: Vec<Attribute>, ) -> Expression

Source

pub fn parse_struct_definition( &mut self, doc: Option<String>, attributes: Vec<Attribute>, ) -> Expression

Source

pub fn parse_const_definition(&mut self, doc: Option<String>) -> Expression

Source

pub fn parse_var_declaration(&mut self, doc: Option<String>) -> Expression

Source

pub fn parse_impl_block(&mut self) -> Expression

Source

pub fn parse_interface_definition(&mut self, doc: Option<String>) -> Expression

Source§

impl<'source> Parser<'source>

Source

pub fn parse_directive(&mut self) -> Expression

Source§

impl<'source> Parser<'source>

Source

pub fn parse_expression(&mut self) -> Expression

Source

pub fn parse_atomic_expression(&mut self) -> Expression

Source

pub fn parse_range( &mut self, start: Option<Box<Expression>>, span_start: Token<'source>, ) -> Expression

Source

pub fn parse_struct_call(&mut self, expression: Expression) -> Expression

Source

pub fn parse_index_expression(&mut self, expression: Expression) -> Expression

Source

pub fn parse_function_call( &mut self, expression: Expression, type_args: Vec<Annotation>, ) -> Expression

Source

pub fn parse_type_args(&mut self) -> Vec<Annotation>

Source

pub fn parse_binary_operator(&mut self) -> BinaryOperator

Source

pub fn parse_try(&mut self, expression: Expression) -> Expression

Source

pub fn parse_block_expression(&mut self) -> Expression

Source

pub fn parse_function_params(&mut self) -> Vec<Binding>

Source

pub fn parse_lambda_params(&mut self) -> Vec<Binding>

Source

pub fn parse_function( &mut self, doc: Option<String>, attributes: Vec<Attribute>, ) -> Expression

Source

pub fn parse_field_access(&mut self, expression: Expression) -> Expression

Source

pub fn collect_delimited_expressions( &mut self, open: TokenKind, close: TokenKind, ) -> (Vec<Expression>, bool)

Source

pub fn parse_let(&mut self) -> Expression

Source

pub fn parse_import(&mut self) -> Expression

Source

pub fn parse_assignment(&mut self) -> Expression

Source

pub fn parse_task(&mut self) -> Expression

Source

pub fn parse_defer(&mut self) -> Expression

Source

pub fn parse_try_block(&mut self) -> Expression

Source

pub fn parse_recover_block(&mut self) -> Expression

Source

pub fn parse_select(&mut self) -> Expression

Source

pub fn with_control_flow_header<F, R>(&mut self, f: F) -> R
where F: FnOnce(&mut Self) -> R,

Source§

impl<'source> Parser<'source>

Source§

impl<'source> Parser<'source>

Source

pub fn parse_pattern_allowing_or(&mut self) -> Pattern

Source

pub fn parse_pattern(&mut self) -> Pattern

Source

pub fn parse_binding(&mut self) -> Binding

Source

pub fn parse_binding_allowing_or(&mut self) -> Binding

Source

pub fn parse_binding_with_type(&mut self) -> Binding

Source

pub fn can_start_pattern(&self) -> bool

Source§

impl<'source> Parser<'source>

Source

pub fn pratt_parse(&mut self, min_prec: u8) -> Expression

Parses by grouping together operations in expressions based on precedence.

  1. Parse a left-hand side expression (primary, unary, or prefix).
  2. Look for binary or postfix operators.
  3. For binary operators: If the operator’s precedence is higher than min_prec, parse the right-hand side recursively with the operator’s precedence.
  4. For postfix operators: Transform the current expression into a larger one.

The min_prec param sets the minimum precedence level for this parsing context.

Source

pub fn include_in_larger_expression(&mut self, lhs: Expression) -> Expression

Source

pub fn parse_range_end(&mut self) -> Expression

Source§

impl<'source> Parser<'source>

Source

pub fn new(tokens: Vec<Token<'source>>, source: &'source str) -> Parser<'source>

Source

pub fn lex_and_parse_file(source: &str, file_id: u32) -> ParseResult

Source

pub fn parse(self) -> ParseResult

Source

pub fn parse_top_item(&mut self) -> Expression

Source

pub fn parse_block_item(&mut self) -> Expression

Source

pub fn at_eof(&self) -> bool

Auto Trait Implementations§

§

impl<'source> Freeze for Parser<'source>

§

impl<'source> RefUnwindSafe for Parser<'source>

§

impl<'source> Send for Parser<'source>

§

impl<'source> Sync for Parser<'source>

§

impl<'source> Unpin for Parser<'source>

§

impl<'source> UnsafeUnpin for Parser<'source>

§

impl<'source> UnwindSafe for Parser<'source>

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.