pub struct Parser<'a> {
pub parse_stack: Vec<ParseStackEntry>,
pub diags: DiagList,
pub floating_nodes: FloatingNodes,
/* private fields */
}Fields§
§parse_stack: Vec<ParseStackEntry>§diags: DiagList§floating_nodes: FloatingNodesImplementations§
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 expect_eof(&mut self, actual_expected: &'static str) -> Result<()>
pub fn identifier(&mut self) -> Result<Loc<Identifier>>
pub fn path(&mut self) -> Result<Loc<Path>>
pub fn path_allow_trailing_separator(&mut self) -> Result<(Loc<Path>, bool)>
Sourcepub fn continue_path(&mut self, leading: Loc<Path>) -> Result<(Loc<Path>, bool)>
pub fn continue_path(&mut self, leading: Loc<Path>) -> Result<(Loc<Path>, bool)>
Continue parsing a path that has been parsed with leading so far. This allows
a trailing ::, primarily to improve completion. If the trailing :: is present (_, true)
is returned, otherwise (_, false)
pub fn path_tree_with_as_alias( &mut self, ) -> Result<Vec<(Loc<Path>, Option<Loc<Identifier>>)>>
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>, bool, Option<Loc<TurbofishInner>>)>>
pub fn if_expression( &mut self, allow_stages: bool, allow_let: bool, is_gen: 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 unsafe_block(&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 label_access(&mut self) -> Result<Option<Loc<Expression>>>
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, accept_impl: bool) -> 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,
accept_impl: bool,
) -> Result<(Loc<Identifier>, Loc<TypeSpec>)>
pub fn name_and_type( &mut self, accept_impl: bool, ) -> 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 block_statements( &mut self, allow_stages: bool, ) -> Result<(Vec<Loc<Statement>>, Option<Loc<Expression>>)>
pub fn parameter( &mut self, accept_impl: bool, ) -> Result<(AttributeList, Option<Loc<WireMarker>>, Loc<Identifier>, Loc<TypeSpec>)>
pub fn parameter_list(&mut self, accept_impl: bool) -> 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 trait_spec(&mut self) -> Result<TraitSpec>
pub fn unit_kind( &mut self, start_token: &Token, ) -> Result<Option<Loc<UnitKind>>>
pub fn unit_head( &mut self, attributes: &AttributeList, visibility: &Loc<Visibility>, ) -> Result<Option<Loc<UnitHead>>>
pub fn impl_body( &mut self, ) -> Result<(Vec<Loc<TypeDeclaration>>, 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 macro_pattern(&mut self) -> Result<Loc<MacroPattern>>
pub fn macro_template(&mut self) -> Result<Loc<Vec<Loc<TokenKind>>>>
pub fn enclosed_token_stream( &mut self, open_token: &TokenKind, close_token: &TokenKind, ) -> Result<Loc<Vec<Loc<TokenKind>>>>
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 FnMut(&mut Self) -> Result<T>, continuations: Vec<fn(&TokenKind) -> bool>, ) -> RecoveryResult<T>
Trait Implementations§
Auto Trait Implementations§
impl<'a> !Send for Parser<'a>
impl<'a> !Sync for Parser<'a>
impl<'a> Freeze for Parser<'a>
impl<'a> RefUnwindSafe for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnsafeUnpin 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 moreSource§impl<T> WithLocation for T
impl<T> WithLocation for T
fn at(self, file_id: usize, span: &impl HasCodespan) -> Loc<Self>where
Self: Sized,
Source§fn near_loc<T>(self, loc: &Loc<T>) -> Loc<Self>
fn near_loc<T>(self, loc: &Loc<T>) -> Loc<Self>
Creates a new Loc from another Loc, but with future internal tracking that this loc
is imprecise and should not be shown to a user outside Diagnostic::bug. Currently,
this is completely untracked, but something we can enable in the future