From a0f0c005a39ddaf693c7de84d6ab1c380a93dca2 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Thu, 26 Sep 2013 20:41:37 +0200 Subject: Code restructuring of tree and parsing logic * Enabled tree to generate itself ** Main work is now done during tree construction * Moved lexer and getPriority utility functions into separate compilation unit --- src/parser.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/parser.h') diff --git a/src/parser.h b/src/parser.h index 677717a..a27d1c0 100644 --- a/src/parser.h +++ b/src/parser.h @@ -8,13 +8,12 @@ namespace SimpleParser { -double calculate(std::string); -std::string exportTree(std::string); +double calculate(std::string term) { + return Tree(term).solve(); +} -namespace { - int8_t getPriority(char); - std::vector lexer(std::string); - Node* buildTree(Tree*, std::string); +std::string exportTree(std::string term) { + return Tree(term).print(); } } -- cgit v1.2.3