Files
ppsspp/math/expression_parser.h
T
Unknown W. Brackets c53dbbf341 Add really basic float support to expr parser.
Requires update to consumers, though (even just a stub returning 0.)
2013-11-17 01:33:24 -08:00

29 lines
943 B
C++

#pragma once
#include "../base/basictypes.h"
#include <vector>
typedef std::pair<uint32,uint32> ExpressionPair;
typedef std::vector<ExpressionPair> PostfixExpression;
enum ExpressionType
{
EXPR_TYPE_UINT = 0,
EXPR_TYPE_FLOAT = 2,
};
class IExpressionFunctions
{
public:
virtual bool parseReference(char* str, uint32& referenceIndex) = 0;
virtual bool parseSymbol(char* str, uint32& symbolValue) = 0;
virtual uint32 getReferenceValue(uint32 referenceIndex) = 0;
virtual ExpressionType getReferenceType(uint32 referenceIndex) = 0;
virtual bool getMemoryValue(uint32 address, int size, uint32& dest, char* error) = 0;
};
bool initPostfixExpression(const char* infix, IExpressionFunctions* funcs, PostfixExpression& dest);
bool parsePostfixExpression(PostfixExpression& exp, IExpressionFunctions* funcs, uint32& dest);
bool parseExpression(const char* exp, IExpressionFunctions* funcs, uint32& dest);
const char* getExpressionError();