Blame src/condparser.h

Packit Service 50c9f2
#ifndef CONDPARSER_H
Packit Service 50c9f2
#define CONDPARSER_H
Packit Service 50c9f2
Packit Service 50c9f2
/**
Packit Service 50c9f2
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Permission to use, copy, modify, and distribute this software and its
Packit Service 50c9f2
 * documentation under the terms of the GNU General Public License is hereby 
Packit Service 50c9f2
 * granted. No representations are made about the suitability of this software 
Packit Service 50c9f2
 * for any purpose. It is provided "as is" without express or implied warranty.
Packit Service 50c9f2
 * See the GNU General Public License for more details.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Documents produced by Doxygen are derivative works derived from the
Packit Service 50c9f2
 * input used in their production; they are not affected by this license.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * C++ Expression parser for EXTABLED_SETIONS in Doxygen
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Features used:
Packit Service 50c9f2
 *     Operators:
Packit Service 50c9f2
 *         &&    AND operator
Packit Service 50c9f2
 *         ||    OR  operator
Packit Service 50c9f2
 *         !     NOT operator
Packit Service 50c9f2
 */
Packit Service 50c9f2
Packit Service 50c9f2
#include <qcstring.h>
Packit Service 50c9f2
Packit Service 50c9f2
class CondParser
Packit Service 50c9f2
{
Packit Service 50c9f2
  // public functions
Packit Service 50c9f2
  public:
Packit Service 50c9f2
    CondParser() : m_e(0), m_tokenType(NOTHING) {}
Packit Service 50c9f2
    bool parse(const char *fileName,int lineNr,const char *expr);
Packit Service 50c9f2
Packit Service 50c9f2
    // enumerations
Packit Service 50c9f2
  private:
Packit Service 50c9f2
    enum TOKENTYPE
Packit Service 50c9f2
    {
Packit Service 50c9f2
      NOTHING = -1,
Packit Service 50c9f2
      DELIMITER,
Packit Service 50c9f2
      VARIABLE,
Packit Service 50c9f2
      UNKNOWN
Packit Service 50c9f2
    };
Packit Service 50c9f2
    enum OPERATOR_ID
Packit Service 50c9f2
    {
Packit Service 50c9f2
      UNKNOWN_OP = -1,
Packit Service 50c9f2
      AND = 1,
Packit Service 50c9f2
      OR,
Packit Service 50c9f2
      NOT
Packit Service 50c9f2
    };
Packit Service 50c9f2
Packit Service 50c9f2
    // data
Packit Service 50c9f2
  private:
Packit Service 50c9f2
Packit Service 50c9f2
    QCString m_err;                 //!< error state
Packit Service 50c9f2
    QCString m_expr;                //!< holds the expression
Packit Service 50c9f2
    const char *m_e;                //!< points to a character in expr
Packit Service 50c9f2
Packit Service 50c9f2
    QCString m_token;               //!< holds the token
Packit Service 50c9f2
    TOKENTYPE m_tokenType;          //!< type of the token
Packit Service 50c9f2
Packit Service 50c9f2
    // private functions
Packit Service 50c9f2
  private:
Packit Service 50c9f2
    void getToken();
Packit Service 50c9f2
Packit Service 50c9f2
    bool parseLevel1();
Packit Service 50c9f2
    bool parseLevel2();
Packit Service 50c9f2
    bool parseLevel3();
Packit Service 50c9f2
    bool parseVar();
Packit Service 50c9f2
Packit Service 50c9f2
    bool evalOperator(const int opId, bool lhs, bool rhs);
Packit Service 50c9f2
    bool evalVariable(const char *varName);
Packit Service 50c9f2
    int getOperatorId(const QCString &opName);
Packit Service 50c9f2
};
Packit Service 50c9f2
Packit Service 50c9f2
#endif
Packit Service 50c9f2