Menu

[01711c]: / parser.h  Maximize  Restore  History

Download this file

68 lines (56 with data), 1.5 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef PARSER_H
#define PARSER_H
#include <QColor>
#include <QStringList>
enum ErrorLevel {NoError,Warning,Aborted};
class Command;
class TreeItem;
class Parser
{
public:
Parser();
void parseAtom (QString input);
QString getAtom();
QString getCommand();
QStringList getParameters();
int parCount();
QString errorMessage();
QString errorDescription();
ErrorLevel errorLevel();
void setError (ErrorLevel level,const QString &description);
void resetError();
bool checkParameters(TreeItem *selti);
bool checkParCount (const int &index);
bool checkParIsInt (const int &index);
bool checkParIsDouble (const int &index);
int parInt (bool &,const uint &index);
QString parString(bool &ok,const int &index);
bool parBool (bool &ok, const int &index);
QColor parColor (bool &ok, const int &index);
double parDouble (bool &ok, const int &index);
void setScript (const QString &);
QString getScript();
void execute();
bool next();
QStringList getCommands();
protected:
QStringList findParameters(const QString &s);
bool nextParenthesisContents(
const QString &s,
int &leftParenthesis,
int &rightParenthesis,
QString &contents);
private:
void initParser();
void initAtom();
QString input;
QString atom;
QString com;
QStringList paramList;
int current;
QString script;
QString errMessage;
QString errDescription;
ErrorLevel errLevel;
};
#endif