cppExpressionParser.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Filename: cppExpressionParser.h
  2. // Created by: drose (25Oct99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef CPPEXPRESSIONPARSER_H
  19. #define CPPEXPRESSIONPARSER_H
  20. #include "dtoolbase.h"
  21. #include "cppPreprocessor.h"
  22. class CPPExpression;
  23. class CPPScope;
  24. ///////////////////////////////////////////////////////////////////
  25. // Class : CPPExpressionParser
  26. // Description :
  27. ////////////////////////////////////////////////////////////////////
  28. class CPPExpressionParser : public CPPPreprocessor {
  29. public:
  30. CPPExpressionParser(CPPScope *current_scope, CPPScope *global_scope);
  31. ~CPPExpressionParser();
  32. bool parse_expr(const string &expr);
  33. bool parse_expr(const string &expr, const CPPPreprocessor &filepos);
  34. void output(ostream &out) const;
  35. CPPScope *_current_scope;
  36. CPPScope *_global_scope;
  37. CPPExpression *_expr;
  38. };
  39. inline ostream &
  40. operator << (ostream &out, const CPPExpressionParser &ep) {
  41. ep.output(out);
  42. return out;
  43. }
  44. #endif