From ea539bad915f289ffe6b4a900815866713803d9d Mon Sep 17 00:00:00 2001 From: Valk Richard Li <48872266+ValKmjolnir@users.noreply.github.com> Date: Wed, 2 Oct 2019 18:33:25 +0800 Subject: [PATCH] Delete abstract_syntax_tree.h --- .../version0.16.1/abstract_syntax_tree.h | 188 ------------------ 1 file changed, 188 deletions(-) delete mode 100644 version0.16/version0.16.1/abstract_syntax_tree.h diff --git a/version0.16/version0.16.1/abstract_syntax_tree.h b/version0.16/version0.16.1/abstract_syntax_tree.h deleted file mode 100644 index 2c44cc3..0000000 --- a/version0.16/version0.16.1/abstract_syntax_tree.h +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef __ABSTRACT_SYNTAX_TREE_H__ -#define __ABSTRACT_SYNTAX_TREE_H__ - -class ast_tree_node -{ - protected: - int line; - int type; - std::list children;// for node that can be extended - - long long int num; // for number - double fnum; // for number - std::string str; // for string - public: - ast_tree_node() - { - line=0; - type=__root; - children.clear(); - - num=0; - fnum=0; - str=""; - } - void set_line(int _line) - { - line=_line; - return; - } - int return_type() - { - return type; - } - int return_line() - { - return line; - } - void add_child(ast_tree_node& new_child) - { - children.push_back(new_child); - return; - } - ast_tree_node& return_last_child() - { - std::list::iterator i; - for(i=children.begin();i!=children.end();++i) - ; - --i; - return *i; - } - void clear_tree() - { - line=0; - type=__root; - children.clear(); - - num=0; - fnum=0; - str=""; - return; - } - int child_num() - { - int cnt=0; - for(std::list::iterator i=children.begin();i!=children.end();++i) - ++cnt; - return cnt; - } - void print(int tab_num) - { - for(int i=0;i::iterator i=children.begin();i!=children.end();++i) - i->print(tab_num+1); - for(int i=0;i=0;--i) - { - num+=acc*((double)(str[i]-'0')); - acc*=10; - } - } - else - { - fnum=0; - double acc=1; - double aff=0.1; - for(int i=DotPlace+1;i<(int)str.length();++i) - { - fnum+=aff*((double)(str[i]-'0')); - aff*=0.1; - } - for(int i=DotPlace-1;i>=0;--i) - { - fnum+=acc*((double)(str[i]-'0')); - acc*=10; - } - } - return; - } -}; -class string_expr:public ast_tree_node -{ - public: - string_expr():ast_tree_node() - { - type=__string; - } - void set_str(std::string& t) - { - str=t; - return; - } - std::string& return_str() - { - return str; - } -}; - -#endif