diff --git a/src/ast/parser.rs b/src/ast/parser.rs index 68cd672..d4e3e42 100644 --- a/src/ast/parser.rs +++ b/src/ast/parser.rs @@ -378,6 +378,25 @@ impl<'a> Parser<'a> { ty: (), } } + TokenKind::Tilde => { + let token = self.advance(); // consume ~ + if *self.peek() == TokenKind::At { + self.advance(); // consume @ + let expr = self.parse_expression(); + Node { + identity: NodeIdentity::new(token.location), + kind: UntypedKind::Splice(Box::new(expr)), + ty: (), + } + } else { + let expr = self.parse_expression(); + Node { + identity: NodeIdentity::new(token.location), + kind: UntypedKind::Placeholder(Box::new(expr)), + ty: (), + } + } + } _ => { self.diagnostics.push_error( format!( @@ -386,6 +405,7 @@ impl<'a> Parser<'a> { ), Some(NodeIdentity::new(self.current_token.location)), ); + self.advance(); Node { identity: NodeIdentity::new(self.current_token.location), kind: UntypedKind::Error,