Tuple literals

This commit is contained in:
2026-05-04 20:40:38 +02:00
parent 8f95b69e21
commit 341000b98e
5 changed files with 15 additions and 3 deletions
+1
View File
@@ -142,6 +142,7 @@ pub enum Expression {
FloatLiteral(f64),
BoolLiteral(bool),
StringLiteral(String),
TupleLiteral(Vec<Expression>),
Fix {
initial: Box<Expression>,
prefixes: Vec<Prefix>,
+3
View File
@@ -87,12 +87,15 @@ macro_inner_v = {
| (!("(" | ")") ~ ANY)
}
tuple = { "(" ~ (expr ~ ("," ~ expr)*)? ~ ")" }
primary = {
integer
| float
| boolean
| string_lit
| static_path
| tuple
}
postfix = {
+1 -1
View File
@@ -309,7 +309,7 @@ impl From<pest::iterators::Pair<'_, Rule>> for Expression {
let inner_str = pair.into_inner().next().unwrap().as_str();
Expression::StringLiteral(inner_str.to_string())
}
Rule::tuple => Expression::TupleLiteral(inner.map(Expression::from).collect()),
_ => unimplemented!("{rule:#?}"),
}
}