mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-29 08:14:42 +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
30 lines
561 B
C++
30 lines
561 B
C++
#ifndef EXPRESSOR_H
|
|
#define EXPRESSOR_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <boost/noncopyable.hpp>
|
|
#include <boost/function.hpp>
|
|
|
|
#include "aftypes.h"
|
|
|
|
struct parser_grammar;
|
|
|
|
struct expressor : boost::noncopyable {
|
|
typedef boost::function<AFPData (std::vector<AFPData>)> func_t;
|
|
|
|
expressor();
|
|
~expressor();
|
|
|
|
AFPData evaluate(std::string const &expr) const;
|
|
|
|
void add_variable(std::string const &name, AFPData value);
|
|
void add_function(std::string const &name, func_t value);
|
|
|
|
private:
|
|
parser_grammar *grammar_;
|
|
};
|
|
|
|
#endif /* !EXPRESSOR_H */
|