cppExpressionParser.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file cppExpressionParser.h
  10. * @author drose
  11. * @date 1999-10-25
  12. */
  13. #ifndef CPPEXPRESSIONPARSER_H
  14. #define CPPEXPRESSIONPARSER_H
  15. #include "dtoolbase.h"
  16. #include "cppPreprocessor.h"
  17. class CPPExpression;
  18. class CPPScope;
  19. /**
  20. *
  21. */
  22. class CPPExpressionParser : public CPPPreprocessor {
  23. public:
  24. CPPExpressionParser(CPPScope *current_scope, CPPScope *global_scope);
  25. ~CPPExpressionParser();
  26. bool parse_expr(const string &expr);
  27. bool parse_expr(const string &expr, const CPPPreprocessor &filepos);
  28. void output(ostream &out) const;
  29. CPPScope *_current_scope;
  30. CPPScope *_global_scope;
  31. CPPExpression *_expr;
  32. };
  33. inline ostream &
  34. operator << (ostream &out, const CPPExpressionParser &ep) {
  35. ep.output(out);
  36. return out;
  37. }
  38. #endif