pub struct Parser<'src> { /* private fields */ }Expand description
A parser for Haskell 2026 source code.
Implementations§
Source§impl<'src> Parser<'src>
impl<'src> Parser<'src>
Sourcepub fn parse_module(&mut self) -> ParseResult<Module>
pub fn parse_module(&mut self) -> ParseResult<Module>
Parse a complete module.
Sourcepub fn parse_import(&mut self) -> ParseResult<ImportDecl>
pub fn parse_import(&mut self) -> ParseResult<ImportDecl>
Parse an import declaration.
Sourcepub fn parse_local_decls(&mut self) -> ParseResult<Vec<Decl>>
pub fn parse_local_decls(&mut self) -> ParseResult<Vec<Decl>>
Parse local declarations (in let or where).
Source§impl<'src> Parser<'src>
impl<'src> Parser<'src>
Sourcepub fn parse_expr(&mut self) -> ParseResult<Expr>
pub fn parse_expr(&mut self) -> ParseResult<Expr>
Parse an expression, including optional type annotation.
Source§impl<'src> Parser<'src>
impl<'src> Parser<'src>
Sourcepub fn is_pattern_start(&self) -> bool
pub fn is_pattern_start(&self) -> bool
Check if the current token can start a pattern.
Sourcepub fn parse_pattern(&mut self) -> ParseResult<Pat>
pub fn parse_pattern(&mut self) -> ParseResult<Pat>
Parse a pattern.
Sourcepub fn is_apat_start(&self) -> bool
pub fn is_apat_start(&self) -> bool
Check if current token can start an atomic pattern.
Sourcepub fn parse_atom_pattern(&mut self) -> ParseResult<Pat>
pub fn parse_atom_pattern(&mut self) -> ParseResult<Pat>
Parse an atomic pattern. This is used for function argument patterns in clause LHS.
Source§impl<'src> Parser<'src>
impl<'src> Parser<'src>
Sourcepub fn parse_type(&mut self) -> ParseResult<Type>
pub fn parse_type(&mut self) -> ParseResult<Type>
Parse a type.
Sourcepub fn is_atype_start(&self) -> bool
pub fn is_atype_start(&self) -> bool
Check if current token can start an atomic type.
Sourcepub fn parse_atype(&mut self) -> ParseResult<Type>
pub fn parse_atype(&mut self) -> ParseResult<Type>
Parse an atomic type.
Source§impl<'src> Parser<'src>
impl<'src> Parser<'src>
Sourcepub fn new(src: &'src str, file_id: FileId) -> Self
pub fn new(src: &'src str, file_id: FileId) -> Self
Create a new parser for the given source code.
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
Check if there are errors.
Sourcepub fn take_diagnostics(&mut self) -> Vec<Diagnostic>
pub fn take_diagnostics(&mut self) -> Vec<Diagnostic>
Take the diagnostics.
Auto Trait Implementations§
impl<'src> Freeze for Parser<'src>
impl<'src> RefUnwindSafe for Parser<'src>
impl<'src> Send for Parser<'src>
impl<'src> Sync for Parser<'src>
impl<'src> Unpin for Parser<'src>
impl<'src> UnsafeUnpin for Parser<'src>
impl<'src> UnwindSafe for Parser<'src>
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