mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-25 14:35:54 +00:00
1912d62d09
- rewrote parser to use boost.spirit instead of a hand-written parser - refactored request loading into 'request' object - added 'expr', a command-line tool to test the new parser - some performance fixes for affunctions
24 lines
452 B
C++
Executable file
24 lines
452 B
C++
Executable file
#include "filter_evaluator.h"
|
|
#include "affunctions.h"
|
|
|
|
int main( int argc, char** argv ) {
|
|
filter_evaluator f;
|
|
|
|
bool result = false;
|
|
|
|
for(int i=0;i<=100;i++) {
|
|
try {
|
|
f.add_variable( "foo", AFPData(string("love")) );
|
|
result = f.evaluate( "specialratio('foo;') == 0.25" );
|
|
} catch (AFPException* excep) {
|
|
printf( "Exception: %s\n", excep->what() );
|
|
}
|
|
}
|
|
|
|
if (result) {
|
|
printf("Success!\n");
|
|
} else {
|
|
printf("OH NOES!\n");
|
|
}
|
|
}
|