From 88747e6fe51fba85446c9edc44bda9d4730dd14d Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 22 Oct 2023 15:24:10 -0400 Subject: [PATCH] Clean up --- src/abstract_tree/filter.rs | 7 ++++--- src/abstract_tree/find.rs | 7 ++++--- src/abstract_tree/for.rs | 7 ++++--- src/abstract_tree/remove.rs | 7 ++++--- src/abstract_tree/select.rs | 3 ++- src/abstract_tree/transform.rs | 7 ++++--- 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/abstract_tree/filter.rs b/src/abstract_tree/filter.rs index b0bbb41..44081c6 100644 --- a/src/abstract_tree/filter.rs +++ b/src/abstract_tree/filter.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; +use tree_sitter::Node; -use crate::{AbstractTree, Expression, Identifier, Item, Value}; +use crate::{AbstractTree, Expression, Identifier, Item, Result, Value, VariableMap}; #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)] pub struct Filter { @@ -10,7 +11,7 @@ pub struct Filter { } impl AbstractTree for Filter { - fn from_syntax_node(source: &str, node: tree_sitter::Node) -> crate::Result { + fn from_syntax_node(source: &str, node: Node) -> Result { let identifier_node = node.child(1).unwrap(); let identifier = Identifier::from_syntax_node(source, identifier_node)?; @@ -27,7 +28,7 @@ impl AbstractTree for Filter { }) } - fn run(&self, source: &str, context: &mut crate::VariableMap) -> crate::Result { + fn run(&self, source: &str, context: &mut VariableMap) -> Result { let value = self.expression.run(source, context)?; let list = value.as_list()?; let key = self.identifier.inner(); diff --git a/src/abstract_tree/find.rs b/src/abstract_tree/find.rs index 5d7efca..65690a6 100644 --- a/src/abstract_tree/find.rs +++ b/src/abstract_tree/find.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; +use tree_sitter::Node; -use crate::{AbstractTree, Expression, Identifier, Item, Value}; +use crate::{AbstractTree, Expression, Identifier, Item, Result, Value, VariableMap}; #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)] pub struct Find { @@ -10,7 +11,7 @@ pub struct Find { } impl AbstractTree for Find { - fn from_syntax_node(source: &str, node: tree_sitter::Node) -> crate::Result { + fn from_syntax_node(source: &str, node: Node) -> Result { let identifier_node = node.child(1).unwrap(); let identifier = Identifier::from_syntax_node(source, identifier_node)?; @@ -27,7 +28,7 @@ impl AbstractTree for Find { }) } - fn run(&self, source: &str, context: &mut crate::VariableMap) -> crate::Result { + fn run(&self, source: &str, context: &mut VariableMap) -> Result { let value = self.expression.run(source, context)?; let list = value.as_list()?; let key = self.identifier.inner(); diff --git a/src/abstract_tree/for.rs b/src/abstract_tree/for.rs index 3df4ee2..91c9470 100644 --- a/src/abstract_tree/for.rs +++ b/src/abstract_tree/for.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; +use tree_sitter::Node; -use crate::{AbstractTree, Expression, Identifier, Item, Value}; +use crate::{AbstractTree, Expression, Identifier, Item, Result, Value, VariableMap}; #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)] pub struct For { @@ -10,7 +11,7 @@ pub struct For { } impl AbstractTree for For { - fn from_syntax_node(source: &str, node: tree_sitter::Node) -> crate::Result { + fn from_syntax_node(source: &str, node: Node) -> Result { let identifier_node = node.child(1).unwrap(); let identifier = Identifier::from_syntax_node(source, identifier_node)?; @@ -27,7 +28,7 @@ impl AbstractTree for For { }) } - fn run(&self, source: &str, context: &mut crate::VariableMap) -> crate::Result { + fn run(&self, source: &str, context: &mut VariableMap) -> Result { let value = self.expression.run(source, context)?; let list = value.as_list()?; let key = self.identifier.inner(); diff --git a/src/abstract_tree/remove.rs b/src/abstract_tree/remove.rs index b019cf2..a923223 100644 --- a/src/abstract_tree/remove.rs +++ b/src/abstract_tree/remove.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; +use tree_sitter::Node; -use crate::{AbstractTree, Expression, Identifier, Item, Value}; +use crate::{AbstractTree, Expression, Identifier, Item, Result, Value, VariableMap}; #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)] pub struct Remove { @@ -10,7 +11,7 @@ pub struct Remove { } impl AbstractTree for Remove { - fn from_syntax_node(source: &str, node: tree_sitter::Node) -> crate::Result { + fn from_syntax_node(source: &str, node: Node) -> Result { let identifier_node = node.child(1).unwrap(); let identifier = Identifier::from_syntax_node(source, identifier_node)?; @@ -27,7 +28,7 @@ impl AbstractTree for Remove { }) } - fn run(&self, source: &str, context: &mut crate::VariableMap) -> crate::Result { + fn run(&self, source: &str, context: &mut VariableMap) -> Result { let value = self.expression.run(source, context)?; let mut list = value.into_inner_list()?; let key = self.identifier.inner(); diff --git a/src/abstract_tree/select.rs b/src/abstract_tree/select.rs index bb96abc..51b1af9 100644 --- a/src/abstract_tree/select.rs +++ b/src/abstract_tree/select.rs @@ -1,4 +1,5 @@ use serde::{Deserialize, Serialize}; +use tree_sitter::Node; use crate::{AbstractTree, Expression, Identifier, Item, Result, Table, Value, VariableMap}; @@ -10,7 +11,7 @@ pub struct Select { } impl AbstractTree for Select { - fn from_syntax_node(source: &str, node: tree_sitter::Node) -> crate::Result { + fn from_syntax_node(source: &str, node: Node) -> Result { let child_count = node.child_count(); let mut identifiers = Vec::new(); diff --git a/src/abstract_tree/transform.rs b/src/abstract_tree/transform.rs index 9e982bd..908dbe7 100644 --- a/src/abstract_tree/transform.rs +++ b/src/abstract_tree/transform.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; +use tree_sitter::Node; -use crate::{AbstractTree, Expression, Identifier, Item, Value}; +use crate::{AbstractTree, Expression, Identifier, Item, Result, Value, VariableMap}; #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)] pub struct Transform { @@ -10,7 +11,7 @@ pub struct Transform { } impl AbstractTree for Transform { - fn from_syntax_node(source: &str, node: tree_sitter::Node) -> crate::Result { + fn from_syntax_node(source: &str, node: Node) -> Result { let identifier_node = node.child(1).unwrap(); let identifier = Identifier::from_syntax_node(source, identifier_node)?; @@ -27,7 +28,7 @@ impl AbstractTree for Transform { }) } - fn run(&self, source: &str, context: &mut crate::VariableMap) -> crate::Result { + fn run(&self, source: &str, context: &mut VariableMap) -> Result { let value = self.expression.run(source, context)?; let list = value.as_list()?; let key = self.identifier.inner();