ExpressionParser.h
// ExpressionParser.h
//
// Author David Barrett-Lennard
// (C)opyright Cedanet Pty Ltd 2006
#pragma once
#ifndef Ceda_cxMacroExpander_ExpressionParser_H
#define Ceda_cxMacroExpander_ExpressionParser_H
#include "cxMacroExpander.h"
#include "ParserBase.h"
#include "LSLiteral.h"
#include "Ceda/cxUtils/xstring.h"
namespace ceda
{
/*
An ExpressionParser assumes the text to be parsed takes up a single buffer in memory - defined by
a SubString. There is no support for macro expansion - it is assumed that macros have already been
expanded.
*/
///////////////////////////////////////////////////////////////////////////////////////////////////
// ExpressionParser
class cxMacroExpander_API ExpressionParser : public ParserBase
{
public:
bool ParseBool(bool allowDataLoss = false);
int8 ParseInt8(bool allowDataLoss = false);
int16 ParseInt16(bool allowDataLoss = false);
int32 ParseInt32(bool allowDataLoss = false);
int64 ParseInt64(bool allowDataLoss = false);
uint8 ParseUInt8(bool allowDataLoss = false);
uint16 ParseUInt16(bool allowDataLoss = false);
uint32 ParseUInt32(bool allowDataLoss = false);
uint64 ParseUInt64(bool allowDataLoss = false);
float32 ParseFloat32(bool allowDataLoss = false);
float64 ParseFloat64(bool allowDataLoss = false);
xchar ParseChar(bool allowDataLoss = false);
xstring ParseString(bool allowDataLoss = false);
float64 ParseFloat64Arg();
void ParseExpression(LSLiteral& literal);
void UnsafeParseExpression(LSLiteral& literal);
void ParseAssignmentExpression(LSLiteral& literal);
void ParseConditionalExpression(LSLiteral& literal);
void ParseLogicalOrExpression(LSLiteral& literal);
void ParseLogicalAndExpression(LSLiteral& literal);
void ParseBitwiseOrExpression(LSLiteral& literal);
void ParseBitwiseExOrExpression(LSLiteral& literal);
void ParseBitwiseAndExpression(LSLiteral& literal);
void ParseEqualityExpression(LSLiteral& literal);
void ParseRelationalExpression(LSLiteral& literal);
void ParseShiftExpression(LSLiteral& literal);
void ParseAdditiveExpression(LSLiteral& literal);
void ParseMultiplicativeExpression(LSLiteral& literal);
void ParsePowerExpression(LSLiteral& literal);
void ParseUnaryExpression(LSLiteral& literal);
void ParsePostFixExpression(LSLiteral& literal);
void ParsePrimaryExpression(LSLiteral& literal);
void ParseLiteralInBrackets(LSLiteral& literal);
void ParsePrimaryIdentifierExpression(LSLiteral& literal);
bool GetFilenameAndLineNumberAtCurrentPosition(xstring& filename, ssize_t& lineNumber) const;
};
} // namespace ceda
#endif // include guard