CCIMXDesktop
 
Loading...
Searching...
No Matches
Parser.h
1#ifndef PARSER_H
2#define PARSER_H
3
4#include <QString>
5
6class TreeNodeBase;
7
12class Parser {
13public:
17 Parser() = default;
18
22 ~Parser() = default;
23
28 void setParserString(const QString& p);
29
34 QString parserString() const;
35
41
42private:
46 QString handle_expression;
47
51 int parse_pos { 0 };
52
57 QChar peekPos();
58
63 QChar getChar();
64
68 void skipIgnored();
69
74 TreeNodeBase* parseExpression();
75
80 TreeNodeBase* parseTerm();
81
86 TreeNodeBase* parseFactor();
87
92 TreeNodeBase* parseNumber();
93
98 QString parseIdentifier();
99};
100
101#endif // PARSER_H
The Parser class is responsible for parsing a mathematical expression string and converting it into a...
Definition Parser.h:12
TreeNodeBase * parse()
Parses the input string and returns the root of the resulting AST.
Definition Parser.cpp:15
QString parserString() const
Returns the current parser string.
Definition Parser.cpp:11
Parser()=default
Default constructor.
~Parser()=default
Default destructor.
void setParserString(const QString &p)
Sets the string to be parsed.
Definition Parser.cpp:6
Tree Node is expected to be like this!
Definition TreeNodeBase.h:7