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

Implementations§

source§

impl<'a> Parser<'a>

source

pub fn parse_file( db: &'a dyn SyntaxGroup, diagnostics: &mut DiagnosticsBuilder<ParserDiagnostic>, file_id: FileId, text: &'a str ) -> SyntaxFile

Parses a file.

source

pub fn parse_syntax_file(self) -> SyntaxFileGreen

source

pub fn try_parse_top_level_item(&mut self) -> Option<ItemGreen>

Returns a GreenId of a node with an Item.* kind (see syntax::node::ast::Item). If can’t parse as a top level item, keeps skipping tokens until it can. Returns None only when it reaches EOF.

source

pub fn try_parse_trait_item(&mut self) -> Option<TraitItemGreen>

Returns a GreenId of a node with a TraitItem.* kind (see syntax::node::ast::TraitItem).

source

pub fn parse_expr(&mut self) -> ExprGreen

Returns a GreenId of a node with an Expr.* kind (see syntax::node::ast::Expr) or a node with kind ExprMissing if an expression can’t be parsed.

source

pub fn try_parse_match_arm(&mut self) -> Option<MatchArmGreen>

Returns a GreenId of a node with a MatchArm kind or None if a match arm can’t be parsed.

source

pub fn try_parse_statement(&mut self) -> Option<StatementGreen>

Returns a GreenId of a node with a Statement.* kind (see syntax::node::ast::Statement) or None if a statement can’t be parsed.

Auto Trait Implementations§

§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> Upcast<T> for Twhere T: ?Sized,

source§

fn upcast(&self) -> &T