diff --git a/rust_compiler/libs/parser/src/lib.rs b/rust_compiler/libs/parser/src/lib.rs
index 63e8ec2..c8b3340 100644
--- a/rust_compiler/libs/parser/src/lib.rs
+++ b/rust_compiler/libs/parser/src/lib.rs
@@ -441,7 +441,13 @@ impl<'a> Parser<'a> {
));
}
- TokenType::Keyword(Keyword::Let) => Some(self.spanned(|p| p.declaration())?),
+ TokenType::Keyword(Keyword::Let) => {
+ if self_matches_peek!(self, TokenType::Symbol(Symbol::LParen)) {
+ Some(self.spanned(|p| p.tuple_declaration())?)
+ } else {
+ Some(self.spanned(|p| p.declaration())?)
+ }
+ }
TokenType::Keyword(Keyword::Device) => {
let spanned_dev = self.spanned(|p| p.device())?;
@@ -561,9 +567,7 @@ impl<'a> Parser<'a> {
})
}
- TokenType::Symbol(Symbol::LParen) => {
- self.spanned(|p| p.priority())?.node.map(|node| *node)
- }
+ TokenType::Symbol(Symbol::LParen) => self.parenthesized_or_tuple()?,
TokenType::Symbol(Symbol::Minus) => {
let start_span = self.current_span();
@@ -642,8 +646,8 @@ impl<'a> Parser<'a> {
}
}
TokenType::Symbol(Symbol::LParen) => *self
- .spanned(|p| p.priority())?
- .node
+ .parenthesized_or_tuple()?
+ .map(Box::new)
.ok_or(Error::UnexpectedEOF)?,
TokenType::Identifier(ref id) if SysCall::is_syscall(id) => {
@@ -774,7 +778,8 @@ impl<'a> Parser<'a> {
| Expression::Ternary(_)
| Expression::Negation(_)
| Expression::MemberAccess(_)
- | Expression::MethodCall(_) => {}
+ | Expression::MethodCall(_)
+ | Expression::Tuple(_) => {}
_ => {
return Err(Error::InvalidSyntax(
self.current_span(),
@@ -1117,8 +1122,12 @@ impl<'a> Parser<'a> {
expressions.pop().ok_or(Error::UnexpectedEOF)
}
- fn priority(&mut self) -> Result