condparser.h
Go to the documentation of this file.
1 #ifndef CONDPARSER_H
2 #define CONDPARSER_H
3 
4 /**
5  * Copyright (C) 1997-2015 by Dimitri van Heesch.
6  *
7  * Permission to use, copy, modify, and distribute this software and its
8  * documentation under the terms of the GNU General Public License is hereby
9  * granted. No representations are made about the suitability of this software
10  * for any purpose. It is provided "as is" without express or implied warranty.
11  * See the GNU General Public License for more details.
12  *
13  * Documents produced by Doxygen are derivative works derived from the
14  * input used in their production; they are not affected by this license.
15  *
16  * C++ Expression parser for EXTABLED_SETIONS in Doxygen
17  *
18  * Features used:
19  * Operators:
20  * && AND operator
21  * || OR operator
22  * ! NOT operator
23  */
24 
25 #include <qcstring.h>
26 
28 {
29  // public functions
30  public:
32  bool parse(const char *fileName,int lineNr,const char *expr);
33 
34  // enumerations
35  private:
36  enum TOKENTYPE
37  {
38  NOTHING = -1,
42  };
44  {
45  UNKNOWN_OP = -1,
46  AND = 1,
47  OR,
49  };
50 
51  // data
52  private:
53 
54  QCString m_err; //!< error state
55  QCString m_expr; //!< holds the expression
56  const char *m_e; //!< points to a character in expr
57 
58  QCString m_token; //!< holds the token
59  TOKENTYPE m_tokenType; //!< type of the token
60 
61  // private functions
62  private:
63  void getToken();
64 
65  bool parseLevel1();
66  bool parseLevel2();
67  bool parseLevel3();
68  bool parseVar();
69 
70  bool evalOperator(const int opId, bool lhs, bool rhs);
71  bool evalVariable(const char *varName);
72  int getOperatorId(const QCString &opName);
73 };
74 
75 #endif
76 
TOKENTYPE m_tokenType
type of the token
Definition: condparser.h:59
bool parseLevel2()
Definition: condparser.cpp:212
bool evalOperator(const int opId, bool lhs, bool rhs)
Definition: condparser.cpp:288
static QCString varName
bool parseVar()
Definition: condparser.cpp:257
QCString m_token
holds the token
Definition: condparser.h:58
fileName
Definition: dumpTree.py:9
bool parseLevel3()
Definition: condparser.cpp:233
bool parseLevel1()
Definition: condparser.cpp:194
void getToken()
Definition: condparser.cpp:129
QCString m_expr
holds the expression
Definition: condparser.h:55
bool evalVariable(const char *varName)
Definition: condparser.cpp:304
bool parse(const char *fileName, int lineNr, const char *expr)
Definition: condparser.cpp:34
QCString m_err
error state
Definition: condparser.h:54
const char * m_e
points to a character in expr
Definition: condparser.h:56
int getOperatorId(const QCString &opName)
Definition: condparser.cpp:112