pub struct Parser<'a> { /* private fields */ }Expand description
Parser state wrapping a token slice with a cursor.
Implementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_constraints_block(&mut self) -> Result<Vec<Constraint>, ParseError>
pub fn parse_constraints_block(&mut self) -> Result<Vec<Constraint>, ParseError>
Parse a constraints { ... } block.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_variables_block(&mut self) -> Result<Vec<VarDecl>, ParseError>
pub fn parse_variables_block(&mut self) -> Result<Vec<VarDecl>, ParseError>
Parse a variables { ... } block.
Sourcepub fn parse_ident_list(&mut self) -> Result<Vec<String>, ParseError>
pub fn parse_ident_list(&mut self) -> Result<Vec<String>, ParseError>
Parse a comma-separated list of identifiers (at least one).
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_domains_block(&mut self) -> Result<Vec<DomainStmt>, ParseError>
pub fn parse_domains_block(&mut self) -> Result<Vec<DomainStmt>, ParseError>
Parse a domains { ... } block.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse_expr(&mut self) -> Result<Expr, ParseError>
pub fn parse_expr(&mut self) -> Result<Expr, ParseError>
Parse an expression.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn peek_kind(&self) -> Option<TokenKind>
pub fn peek_kind(&self) -> Option<TokenKind>
Peek at the current token’s kind without consuming it.
Sourcepub fn current_span(&self) -> Span
pub fn current_span(&self) -> Span
Get the span of the current token (or a default EOF span).
Sourcepub fn expect_token(&mut self, expected: TokenKind) -> Result<(), ParseError>
pub fn expect_token(&mut self, expected: TokenKind) -> Result<(), ParseError>
Expect and consume a specific token kind.
Sourcepub fn expect_ident(&mut self) -> Result<String, ParseError>
pub fn expect_ident(&mut self) -> Result<String, ParseError>
Expect and consume an identifier, returning its name.
Sourcepub fn expect_ident_matching(
&mut self,
expected: &str,
) -> Result<(), ParseError>
pub fn expect_ident_matching( &mut self, expected: &str, ) -> Result<(), ParseError>
Expect and consume a specific identifier.
Sourcepub fn expect_number(&mut self) -> Result<i64, ParseError>
pub fn expect_number(&mut self) -> Result<i64, ParseError>
Expect and consume a number literal.
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> 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