Tuple literals
This commit is contained in:
@@ -142,6 +142,7 @@ pub enum Expression {
|
||||
FloatLiteral(f64),
|
||||
BoolLiteral(bool),
|
||||
StringLiteral(String),
|
||||
TupleLiteral(Vec<Expression>),
|
||||
Fix {
|
||||
initial: Box<Expression>,
|
||||
prefixes: Vec<Prefix>,
|
||||
|
||||
@@ -87,12 +87,15 @@ macro_inner_v = {
|
||||
| (!("(" | ")") ~ ANY)
|
||||
}
|
||||
|
||||
tuple = { "(" ~ (expr ~ ("," ~ expr)*)? ~ ")" }
|
||||
|
||||
primary = {
|
||||
integer
|
||||
| float
|
||||
| boolean
|
||||
| string_lit
|
||||
| static_path
|
||||
| tuple
|
||||
}
|
||||
|
||||
postfix = {
|
||||
|
||||
+1
-1
@@ -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:#?}"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user