Add check for trailing tokens
Ensure that a script does not contain any tokens after the main expression. This prevents accidental trailing expressions and enforces a clearer script structure.
This commit is contained in:
@@ -46,6 +46,10 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn at_eof(&self) -> bool {
|
||||
matches!(self.current_token.kind, TokenKind::EOF)
|
||||
}
|
||||
|
||||
fn parse_atom(&mut self) -> Result<Node<UntypedKind>, String> {
|
||||
let token = self.advance()?;
|
||||
let identity = Rc::new(NodeIdentity { location: token.location });
|
||||
|
||||
Reference in New Issue
Block a user