2008-07-29 11:03:26 +00:00
|
|
|
#include "afparser.h"
|
|
|
|
#include "afutils.h"
|
|
|
|
// #include "aftypes.h"
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
class FilterEvaluator {
|
|
|
|
public:
|
|
|
|
void reset();
|
|
|
|
void setVar( string key, AFPData value );
|
|
|
|
void setVars( map<string,AFPData> values );
|
|
|
|
bool evaluateFilter( string code );
|
2008-08-04 14:27:48 +00:00
|
|
|
string evaluateExpression( string code );
|
2008-07-29 11:03:26 +00:00
|
|
|
protected:
|
|
|
|
bool move();
|
|
|
|
bool move( int shift );
|
|
|
|
void doLevelEntry( AFPData* result );
|
|
|
|
void doLevelSet( AFPData* result );
|
|
|
|
void doLevelBoolOps( AFPData* result );
|
|
|
|
void doLevelCompares( AFPData* result );
|
|
|
|
void doLevelMulRels( AFPData* result );
|
|
|
|
void doLevelSumRels( AFPData* result );
|
|
|
|
void doLevelPow( AFPData* result );
|
|
|
|
void doLevelBoolInvert( AFPData* result );
|
|
|
|
void doLevelSpecialWords( AFPData* result );
|
|
|
|
void doLevelUnarys( AFPData* result );
|
|
|
|
void doLevelBraces( AFPData* result );
|
|
|
|
void doLevelFunction( AFPData* result );
|
|
|
|
void doLevelAtom( AFPData* result );
|
|
|
|
|
|
|
|
AFPToken cur;
|
|
|
|
vector<AFPToken> tokens;
|
2008-07-31 16:28:24 +00:00
|
|
|
map<string, vector<AFPToken> > tokenCache;
|
2008-07-29 11:03:26 +00:00
|
|
|
unsigned int pos;
|
|
|
|
string code;
|
|
|
|
map<string,AFPData> vars;
|
2008-07-31 16:28:24 +00:00
|
|
|
bool forceResult;
|
2008-07-29 11:03:26 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// typedef AFPData (*AFPFunction) (vector<AFPData>);
|
|
|
|
|
|
|
|
vector<string> getOpsForType( string type );
|