pub struct Parser<'a> {
pub parse_stack: Vec<ParseStackEntry>,
pub diags: DiagList,
/* private fields */
}Fields§
§parse_stack: Vec<ParseStackEntry>§diags: DiagListImplementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
pub fn expression(&mut self) -> Result<Loc<Expression>>
Sourcepub fn non_comptime_expression(&mut self) -> Result<Loc<Expression>>
pub fn non_comptime_expression(&mut self) -> Result<Loc<Expression>>
We need a function like this in order to not run into parser conflicts when parsing blocks, since both statements and expressions can start with $if.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
pub fn register_reset_definition( &mut self, ) -> Result<(Loc<Expression>, Loc<Expression>)>
pub fn register_reset( &mut self, ) -> Result<Option<(Loc<Expression>, Loc<Expression>)>>
pub fn register_initial(&mut self) -> Result<Option<Loc<Expression>>>
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
pub fn identifier(&mut self) -> Result<Loc<Identifier>>
pub fn path(&mut self) -> Result<Loc<Path>>
pub fn named_turbofish(&mut self) -> Result<Loc<NamedTurbofish>>
pub fn turbofish(&mut self) -> Result<Option<Loc<TurbofishInner>>>
pub fn path_with_turbofish( &mut self, ) -> Result<Option<(Loc<Path>, Option<Loc<TurbofishInner>>)>>
pub fn if_expression( &mut self, allow_stages: bool, ) -> Result<Option<Loc<Expression>>>
pub fn type_level_if(&mut self) -> Result<Option<Loc<Expression>>>
pub fn match_expression(&mut self) -> Result<Option<Loc<Expression>>>
pub fn int_literal(&mut self) -> Result<Option<Loc<IntLiteral>>>
pub fn block(&mut self, is_pipeline: bool) -> Result<Option<Loc<Block>>>
pub fn pipeline_reference(&mut self) -> Result<Option<Loc<Expression>>>
pub fn pipeline_stage_reference( &mut self, stage_keyword: &Token, ) -> Result<Option<Loc<Expression>>>
pub fn pipeline_stage_status( &mut self, stage_keyword: &Token, ) -> Result<Option<Loc<Expression>>>
pub fn type_expression(&mut self) -> Result<Loc<TypeExpression>>
pub fn type_spec(&mut self) -> Result<Loc<TypeSpec>>
pub fn tuple_spec(&mut self) -> Result<Option<Loc<TypeSpec>>>
pub fn array_spec(&mut self) -> Result<Option<Loc<TypeSpec>>>
Sourcepub fn name_and_type(&mut self) -> Result<(Loc<Identifier>, Loc<TypeSpec>)>
pub fn name_and_type(&mut self) -> Result<(Loc<Identifier>, Loc<TypeSpec>)>
A name with an associated type, as used in argument definitions as well as struct definitions
name: Type
pub fn pattern(&mut self) -> Result<Loc<Pattern>>
pub fn statements( &mut self, allow_stages: bool, ) -> Result<(Vec<Loc<Statement>>, Option<Loc<Expression>>)>
pub fn self_arg(&mut self) -> Result<Option<Loc<()>>>
pub fn parameter( &mut self, ) -> Result<(AttributeList, Loc<Identifier>, Loc<TypeSpec>)>
pub fn parameter_list(&mut self) -> Result<ParameterList>
pub fn type_parameter_list(&mut self) -> Result<ParameterList>
pub fn type_param(&mut self) -> Result<Loc<TypeParam>>
pub fn generics_list(&mut self) -> Result<Option<Loc<Vec<Loc<TypeParam>>>>>
pub fn generic_spec_list( &mut self, ) -> Result<Option<Loc<Vec<Loc<TypeExpression>>>>>
pub fn path_with_generic_spec( &mut self, ) -> Result<(Loc<Path>, Option<Loc<Vec<Loc<TypeExpression>>>>)>
pub fn unit_kind( &mut self, start_token: &Token, ) -> Result<Option<Loc<UnitKind>>>
pub fn unit_head( &mut self, attributes: &AttributeList, ) -> Result<Option<Loc<UnitHead>>>
pub fn impl_body(&mut self) -> Result<Vec<Loc<Unit>>>
pub fn enum_variant(&mut self) -> Result<EnumVariant>
pub fn attribute_key_value<T>( &mut self, key: &str, value: impl Fn(&mut Self) -> Result<T>, ) -> Result<Option<(Loc<String>, T)>>
pub fn attribute_inner(&mut self) -> Result<Attribute>
pub fn attributes(&mut self) -> Result<AttributeList>
pub fn module_body(&mut self) -> Result<ModuleBody>
Sourcepub fn top_level_module_body(&mut self) -> Result<Loc<ModuleBody>>
pub fn top_level_module_body(&mut self) -> Result<Loc<ModuleBody>>
A module body which is not part of a mod. Errors if there is anything
but an item found after the last item
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
pub fn comma_separated<T>( &mut self, inner: impl Fn(&mut Self) -> Result<T>, end_marker: &TokenKind, ) -> CommaSeparatedResult<Vec<T>>
pub fn token_separated<T>( &mut self, inner: impl Fn(&mut Self) -> Result<T>, separator: &TokenKind, end_markers: Vec<TokenKind>, ) -> CommaSeparatedResult<Vec<T>>
pub fn with_recovery<T>( &mut self, inner: impl Fn(&mut Self) -> Result<T>, continuations: Vec<TokenKind>, ) -> RecoveryResult<T>
Trait Implementations§
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more