]> git.sven.stormbind.net Git - sven/vym.git/blob - parser.h
Import Upstream version 2.6.11
[sven/vym.git] / parser.h
1 #ifndef PARSER_H
2 #define PARSER_H
3
4 #include <QColor>
5 #include <QStringList>
6
7 enum ErrorLevel {NoError,Warning,Aborted};
8
9 class Command;
10 class TreeItem;
11
12 class Parser
13 {
14 public:
15     Parser();
16     void parseAtom (QString input);
17     QString getAtom();
18     QString getCommand();
19     QStringList getParameters();
20     int parCount();
21     QString errorMessage();
22     QString errorDescription();
23     ErrorLevel errorLevel();
24     void setError (ErrorLevel level,const QString &description);
25     void resetError();
26     bool checkParameters(TreeItem *selti);
27     bool checkParCount (const int &index);
28     bool checkParIsInt (const int &index);
29     bool checkParIsDouble (const int &index);
30     int parInt (bool &,const uint &index);
31     QString parString(bool &ok,const int &index);
32     bool parBool (bool &ok, const int &index);
33     QColor parColor (bool &ok, const int &index);
34     double parDouble (bool &ok, const int &index);
35
36     void setScript (const QString &);
37     QString getScript();
38     void execute();
39     bool next();
40
41     QStringList getCommands(); 
42
43 protected:
44     QStringList findParameters(const QString &s);
45     bool nextParenthesisContents(
46             const QString &s, 
47             int &leftParenthesis, 
48             int &rightParenthesis, 
49             QString &contents);
50
51 private:
52     void initParser();
53     void initAtom();
54
55     QString input;
56     QString atom;
57     QString com;
58     QStringList paramList;
59     int current;
60     QString script;
61
62     QString errMessage;
63     QString errDescription;
64     ErrorLevel errLevel;
65 };
66
67 #endif