Add expressions in parenthesis

This commit is contained in:
Sofia 2026-03-20 18:00:13 +02:00
parent 3eaf91760e
commit 8bb49321ae
2 changed files with 6 additions and 1 deletions

View File

@ -90,6 +90,6 @@ function ipairs(t)
end, "otus", "potus" end, "otus", "potus"
end end
for k, v in ipairs(table) do for k, v in (ipairs(table)) do
print(k, v) print(k, v)
end end

View File

@ -689,6 +689,11 @@ impl Parse for PrimaryExpression {
Expression::TableConstructor(entries) Expression::TableConstructor(entries)
} else if let Ok(_) = stream.parse::<Ellipsis>() { } else if let Ok(_) = stream.parse::<Ellipsis>() {
Expression::Ellipsis Expression::Ellipsis
} else if let Some(Token::Symbol('(')) = stream.peek() {
stream.next();
let expression = stream.parse()?;
stream.expect_symbol(')')?;
expression
} else { } else {
Expression::ValueRef(stream.parse()?) Expression::ValueRef(stream.parse()?)
}; };