From 6bb227d05282116b755d84dd573b1ad95758ae08 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 23 Jan 2016 01:49:53 -0800 Subject: [PATCH] Rename methods make reduce() the entry point to evaluation --- src/eval.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/eval.rs b/src/eval.rs index 49e7387..ef88c2c 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -52,7 +52,7 @@ impl Evaluator { pub fn run(&mut self, ast: AST) -> Vec { ast.into_iter().map(|astnode| { - self.reduce_node(astnode) + self.reduce(astnode) }).collect() } } @@ -84,7 +84,7 @@ impl Evaluable for Expression { } impl Evaluator { - fn reduce_node(&mut self, mut node: ASTNode) -> String { + fn reduce(&mut self, mut node: ASTNode) -> String { loop { node = self.step(node); if !node.is_reducible() { @@ -96,10 +96,10 @@ impl Evaluator { } fn step(&mut self, node: ASTNode) -> ASTNode { - self.reduce(node) + self.reduce_astnode(node) } - fn reduce(&mut self, node: ASTNode) -> ASTNode { //TODO swap the names of this and reduce_node + fn reduce_astnode(&mut self, node: ASTNode) -> ASTNode { use parser::ASTNode::*; match node { ExprNode(expr) => {