diff --git a/runner/src/ast.rs b/runner/src/ast.rs index f0ad2891f..a58e06c22 100644 --- a/runner/src/ast.rs +++ b/runner/src/ast.rs @@ -6,14 +6,14 @@ use std::{ #[derive(Debug, Clone)] pub enum Expr { Value(String), - Array(Vec), + Array(Vec), } impl Display for Expr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Expr::Value(v) => write!(f, "{}", v), - Expr::Array(v) => write!(f, "{:?}", v), + Expr::Value(v) => write!(f, "{v}"), + Expr::Array(v) => write!(f, "{v:?}"), } } } @@ -29,7 +29,7 @@ impl Display for Exprs { if i != 0 { write!(f, ", ")?; } - write!(f, "{}", expr)?; + write!(f, "{expr}")?; } write!(f, "]")?; diff --git a/runner/src/parser.lalrpop b/runner/src/parser.lalrpop index f79958ff2..daa655768 100644 --- a/runner/src/parser.lalrpop +++ b/runner/src/parser.lalrpop @@ -7,20 +7,15 @@ pub CairoParserOutput: Exprs = { StructName "(" > ")" => Exprs(n.iter().flat_map(|x| x.iter().cloned()).collect()), }; -FlatExpr: Vec = { - => vec![n], - StructName "()" => Vec::new(), - StructName "(" > ")" => n.iter().flat_map(|x| x.iter().cloned()).collect(), -}; - -FlatArg: Vec = { - ArgName "=" => n, +CairoParserOutputInner: Exprs = { + => Exprs(vec![Expr::Value(n)]), + "[" > "]" => Exprs(vec![Expr::Array(n.iter().flat_map(|x| x.iter().cloned()).collect())]), + StructName "()" => Exprs(Vec::new()), + StructName "(" > ")" => Exprs(n.iter().flat_map(|x| x.iter().cloned()).collect()), }; Arg: Exprs = { - ArgName "=" => Exprs(vec![Expr::Value(n)]), - ArgName "=" "[" > "]" => Exprs(vec![Expr::Array(n.iter().flat_map(|x| x.iter().cloned()).collect())]), - ArgName "=" => n, + ArgName "=" => n, }; Comma: Vec = {