00001 #ifndef INC_ExpressionTreeWalker_hpp_
00002 #define INC_ExpressionTreeWalker_hpp_
00003
00004 #include "antlr/config.hpp"
00005 #include "ExpressionParserTokenTypes.hpp"
00006
00007 #include "antlr/TreeParser.hpp"
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <string>
00034 #include <map>
00035 #include <list>
00036 #include "UAPNode.hpp"
00037
00049 class ExpressionTreeWalker : public ANTLR_USE_NAMESPACE(antlr)TreeParser, public ExpressionParserTokenTypes
00050 {
00051
00052 private:
00053
00055 class UAPUtilities* utilities;
00056
00058 class UAPNode* context;
00059
00061 std::map<std::string, double> mathConstants;
00062
00063 public:
00064
00069 void setUtilities(class UAPUtilities* _utilities){
00070 utilities = _utilities;
00071 }
00072
00077 void setContext(class UAPNode* _context = NULL){
00078 context = _context;
00079 }
00080
00084 void setMathConstants(const std::map<std::string, double>& _mathConstants){
00085 mathConstants = _mathConstants;
00086 }
00087
00088 public:
00089 ExpressionTreeWalker();
00090 public: double evaluate(ANTLR_USE_NAMESPACE(antlr)RefAST _t);
00091 public: double evaluate_function(ANTLR_USE_NAMESPACE(antlr)RefAST _t);
00092 public: void mathFunction(ANTLR_USE_NAMESPACE(antlr)RefAST _t);
00093 public: std::string subs_params(ANTLR_USE_NAMESPACE(antlr)RefAST _t);
00094 public: void twConst(ANTLR_USE_NAMESPACE(antlr)RefAST _t);
00095 public: std::string amlPath(ANTLR_USE_NAMESPACE(antlr)RefAST _t);
00096 public: void amlAttrValue(ANTLR_USE_NAMESPACE(antlr)RefAST _t);
00097 private:
00098 static const char* _tokenNames[];
00099
00100 static const unsigned long _tokenSet_0_data_[];
00101 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0;
00102 static const unsigned long _tokenSet_1_data_[];
00103 static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1;
00104 };
00105
00106 #endif