Alien-SmokeQt

 view release on metacpan or  search on metacpan

generator/parser/rpp/pp-engine.h  view on Meta::CPAN

  int _M_skipping[MAX_LEVEL];
  int _M_true_test[MAX_LEVEL];
  int iflevel;
  int nextToken;
  bool haveNextToken;
  bool hideNext;
  bool hadGuardCandidate, checkGuardEnd;
  IndexedString guardCandidate;

  union {
    long token_value;
    unsigned long token_uvalue;
  };
  IndexedString token_text;

  enum TOKEN_TYPE
  {
    TOKENS_START = 1000,
    TOKEN_NUMBER,
    TOKEN_UNUMBER,
    TOKEN_IDENTIFIER,
    TOKEN_DEFINED,
    TOKEN_LT_LT,
    TOKEN_LT_EQ,
    TOKEN_GT_GT,
    TOKEN_GT_EQ,
    TOKEN_EQ_EQ,
    TOKEN_NOT_EQ,
    TOKEN_OR_OR,
    TOKEN_AND_AND,
    TOKENS_END
  };

public:
  pp(Preprocessor* preprocessor);
  ~pp();

  Preprocessor* preprocessor();

  enum StringType { File, Data };

  ///@todo Remove
  inline QString currentFileNameString () const { return m_files.top().str(); }
  
  inline IndexedString currentFileName () const { return m_files.top(); }

  Value eval_expression (Stream& input);

  /** Read file @p fileName and preprocess
   *  Currently the file is expected to be utf8-encoded. */
  PreprocessedContents processFile(const QString& fileName);

  /** Preprocess @p fileName with content @p data. Do not actually open file @p fileName
   *  Currently the file is expected to be utf8-encoded. */
  PreprocessedContents processFile(const QString& fileName, const QByteArray& data);

  void operator () (Stream& input, Stream& output);

  void checkMarkNeeded(Stream& input, Stream& output);

  bool hideNextMacro() const;
  void setHideNextMacro(bool hideNext);

  Environment* environment() const;
  // once set, belongs to the engine
  void setEnvironment(Environment* env);

  const QList<Problem*>& problems() const;
  void problemEncountered(Problem *problem);

  //Returns a hash-value computed from all until currently open branching-conditions and their decisions(like #ifdef's)
  uint branchingHash() const;
  
private:
  void processFileInternal(const QString& fileName, const QByteArray& fileContent, PreprocessedContents& result);

  int skipping() const;
  bool test_if_level();

  void createProblem(Stream& input, const QString& description);
  
  void skip(Stream& input, Stream& output, bool outputText = true);

  Value eval_primary(Stream& input);

  Value eval_multiplicative(Stream& input);

  Value eval_additive(Stream& input);

  Value eval_shift(Stream& input);

  Value eval_relational(Stream& input);

  Value eval_equality(Stream& input);

  Value eval_and(Stream& input);

  Value eval_xor(Stream& input);

  Value eval_or(Stream& input);

  Value eval_logical_and(Stream& input);

  Value eval_logical_or(Stream& input);

  Value eval_constant_expression(Stream& input);

  void handle_directive(uint directive, Stream& input, Stream& output);

  void handle_include(bool skip_current_path, Stream& input, Stream& output);

  void handle_define(Stream& input);

  void handle_if(Stream& input);

  void handle_else(int sourceLine);

  void handle_elif(Stream& input);

  void handle_endif(Stream& input, Stream& output);

  void handle_ifdef(bool check_undefined, Stream& input);



( run in 0.347 second using v1.01-cache-2.11-cpan-71847e10f99 )