From dd5136827c4ee3968489b6631db211deb024ff60 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 17 Mar 2024 21:10:51 -0400 Subject: [PATCH] Pass all tests --- src/abstract_tree/expression.rs | 12 ++++++------ src/parser.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/abstract_tree/expression.rs b/src/abstract_tree/expression.rs index 4b01206..fb66486 100644 --- a/src/abstract_tree/expression.rs +++ b/src/abstract_tree/expression.rs @@ -24,8 +24,8 @@ impl AbstractTree for Expression { match self { Expression::FunctionCall(function_call) => function_call.expected_type(_context), Expression::Identifier(identifier) => identifier.expected_type(_context), - Expression::MapIndex(index) => index.expected_type(_context), - Expression::ListIndex(_) => todo!(), + Expression::MapIndex(map_index) => map_index.expected_type(_context), + Expression::ListIndex(list_index) => list_index.expected_type(_context), Expression::Logic(logic) => logic.expected_type(_context), Expression::Math(math) => math.expected_type(_context), Expression::Value(value_node) => value_node.expected_type(_context), @@ -36,8 +36,8 @@ impl AbstractTree for Expression { match self { Expression::FunctionCall(function_call) => function_call.validate(_context), Expression::Identifier(identifier) => identifier.validate(_context), - Expression::MapIndex(index) => index.validate(_context), - Expression::ListIndex(_) => todo!(), + Expression::MapIndex(map_index) => map_index.validate(_context), + Expression::ListIndex(list_index) => list_index.validate(_context), Expression::Logic(logic) => logic.validate(_context), Expression::Math(math) => math.validate(_context), Expression::Value(value_node) => value_node.validate(_context), @@ -48,8 +48,8 @@ impl AbstractTree for Expression { match self { Expression::FunctionCall(function_call) => function_call.run(_context), Expression::Identifier(identifier) => identifier.run(_context), - Expression::MapIndex(index) => index.run(_context), - Expression::ListIndex(_) => todo!(), + Expression::MapIndex(map_index) => map_index.run(_context), + Expression::ListIndex(list_index) => list_index.run(_context), Expression::Logic(logic) => logic.run(_context), Expression::Math(math) => math.run(_context), Expression::Value(value_node) => value_node.run(_context), diff --git a/src/parser.rs b/src/parser.rs index e7d2ff3..40578ce 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -234,7 +234,7 @@ pub fn parser<'src>() -> DustParser<'src> { just(Token::Control(Control::SquareClose)), ), |op, expression, span| { - Expression::ListIndex(Box::new(ListIndex::new(expression, op))) + Expression::ListIndex(Box::new(ListIndex::new(op, expression))) .with_position(span) }, ),