From 64526a0b1cdc304f3770420485aa1960fd1a27b5 Mon Sep 17 00:00:00 2001 From: Jesse Brault Date: Mon, 30 Mar 2026 14:04:29 -0500 Subject: [PATCH] Small parser changes. --- dmc-lib/src/parser.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dmc-lib/src/parser.rs b/dmc-lib/src/parser.rs index 9bc5941..5463c4a 100644 --- a/dmc-lib/src/parser.rs +++ b/dmc-lib/src/parser.rs @@ -96,7 +96,7 @@ struct Parser<'a> { lexer: Lexer<'a>, current: Option, lookahead: Option, - node_index: usize, + node_id: usize, } impl<'a> Parser<'a> { @@ -106,7 +106,7 @@ impl<'a> Parser<'a> { lexer: Lexer::new(input), current: None, lookahead: None, - node_index: 0, + node_id: 0, } } @@ -212,6 +212,7 @@ impl<'a> Parser<'a> { .with_primary_label_message(&format!("Expected {}.", Self::join_kinds(kinds))) } + #[must_use] fn expect_advance(&mut self, token_kind: TokenKind) -> (Option, Diagnostics) { match self.current.take() { None => ( @@ -290,6 +291,12 @@ impl<'a> Parser<'a> { self.sample_input(token.start(), token.end()) } + fn next_node_id(&mut self) -> usize { + let node_id = self.node_id; + self.node_id += 1; + node_id + } + fn compilation_unit(&mut self) -> ParseResult { let mut functions: Vec = vec![]; let mut extern_functions: Vec = vec![];