Cockatrice/libs/utility/include/utility/expression.h
Lukas Brübach 01378b8314 Turn things in common into separate libs.
Took 2 hours 27 minutes
2025-10-04 15:10:20 +02:00

28 lines
477 B
C++

#ifndef EXPRESSION_H
#define EXPRESSION_H
#include <QMap>
#include <QString>
#include <functional>
namespace peg
{
template <typename Annotation> struct AstBase;
struct EmptyType;
typedef AstBase<EmptyType> Ast;
} // namespace peg
class Expression
{
public:
double value;
explicit Expression(double initial = 0);
double parse(const QString &expr);
private:
double eval(const peg::Ast &ast);
QMap<QString, std::function<double(double)>> fns;
};
#endif