-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathExpressionParser.h
More file actions
49 lines (37 loc) · 1.44 KB
/
ExpressionParser.h
File metadata and controls
49 lines (37 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "CustomExpression.h"
class ExpressionParser
{
public:
ExpressionParser()
: _expression(NULL)
{
}
private:
CustomExpression* _expression;
private:
bool IsDecimal(CStringW& str);
bool IsDecimal(wchar_t chr, bool& exponential);
bool IsDecimalZero(CStringW& str);
bool IsInteger(CStringW& str);
bool IsOperator(wchar_t s);
bool IsOperator(CStringW s);
bool IsFunctionName(wchar_t s);
bool ParseTree(CStringW s);
CustomFunction* ParseFunction(CStringW& s, int begin, int& fnBegin);
bool ParseArgumentList(CStringW s, CustomFunction* fn);
bool GetBrackets(CStringW expression, int& begin, int& end, CStringW openingSymbol = "(", CStringW closingSymbol = ")");
CStringW GetInnerString(CStringW& s, int begin, int end);
CExpressionPart* ParseExpressionPart(CStringW s);
bool ReadValue(CStringW s, int& position, CElement* element);
bool ReadOperation(CStringW s, int& position, CElement& element);
void ReplacePart(CStringW& s, int begin, int end);
bool ReplaceStringLiterals(CStringW& s, int& count);
bool ReplaceFieldNames(CStringW& s, int& count);
void ReplaceSubString(CStringW& s, int begin, int length, CStringW replacement);
void SetErrorMessage(CStringW msg) { _expression->SetErrorMessage(msg); }
void SetErrorPosition(int position) { _expression->SetErrorPosition(position); }
public:
bool Parse(CustomExpression* expression, CStringW s, bool useFields);
bool ReplaceParameterlessFunctions(CStringW& s);
};