preprocessor.hh

Go to the documentation of this file.
00001 /*
00002    The lestes compiler suite
00003    Copyright (C) 2002, 2003, 2004, 2005 Miroslav Tichy
00004    Copyright (C) 2002, 2003, 2004, 2005 Petr Zika
00005    Copyright (C) 2002, 2003, 2004, 2005 Vojtech Hala
00006    Copyright (C) 2002, 2003, 2004, 2005 Jiri Kosina
00007    Copyright (C) 2002, 2003, 2004, 2005 Pavel Sanda
00008    Copyright (C) 2002, 2003, 2004, 2005 Jan Zouhar
00009    Copyright (C) 2002, 2003, 2004, 2005 Rudolf Thomas
00010 
00011    This program is free software; you can redistribute it and/or modify
00012    it under the terms of the GNU General Public License as published by
00013    the Free Software Foundation; version 2 of the License.
00014 
00015    This program is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018    GNU General Public License for more details.
00019 
00020    See the full text of the GNU General Public License version 2, and
00021    the limitations in the file doc/LICENSE.
00022 
00023    By accepting the license the licensee waives any and all claims
00024    against the copyright holder(s) related in whole or in part to the
00025    work, its use, and/or the inability to use it.
00026  
00027  */
00028 #ifndef lestes__lang__cplus__lex___preprocessor_hh___included
00029 #define lestes__lang__cplus__lex___preprocessor_hh___included
00030 
00031 /*! \file
00032   \brief C++ preprocessor. 
00033   
00034   Declaration of preprocessor class representing the entire C++ preprocessor.
00035   \author pt
00036 */
00037 #include <lestes/common.hh>
00038 
00039 package(lestes);
00040 
00041 package(std);
00042 // forward declaration to avoid cycle
00043 class source_location;
00044 end_package(std);
00045 
00046 package(lang);
00047 package(cplus);
00048 package(lex);
00049 
00050 // forward declaration to avoid cycle
00051 class cpp_token;
00052 class evaluator;
00053 class string_joiner;
00054 class string_translator;
00055 class space_remover;
00056 class lex_literal;
00057 class file_system;
00058 class cpp_token;
00059 class token_value;
00060 
00061 /*!
00062   \brief C++ preprocessor.
00063  
00064   \todo pt The initialization interface is going to change.
00065   Represents the entire C++ preprocessor.
00066   Handles conversion from pp_token to cpp_token.
00067 */
00068 class preprocessor: public ::lestes::std::object {
00069 public:
00070         //! Returns the pragma flag.
00071         bool pragma_flag_get(void) const;
00072         //! Reads next token.
00073         ptr<cpp_token> read(void);
00074         //! Returns new instance.
00075         static ptr<preprocessor> create(const ptr<file_system> &a_fs, const lstring &file_name);
00076 protected:
00077         //! Creates the object.
00078         preprocessor(const ptr<file_system> &a_fs, const lstring &file_name);
00079         //! Marks the object.
00080         virtual void gc_mark(void);
00081 private:
00082         //! Classifies number.
00083         ptr<lex_literal> classify_number(const ptr<source_location> &loc, const ptr<token_value> &tv);
00084         //! The order of tokens in translation unit.
00085         ulint order;
00086         //! File system binding.
00087         srp<file_system> fs;
00088         //! Evaluator.
00089         srp<evaluator> eva;
00090         //! Whitespace remover.
00091         srp<space_remover> spr;
00092         //! String translator.
00093         srp<string_translator> str;
00094         //! String joiner.
00095         srp<string_joiner> stj;
00096         //! Hides copy constructor.
00097         preprocessor(const preprocessor &);
00098         //! Hides assignment operator.
00099         preprocessor &operator=(const preprocessor &);
00100 };
00101 
00102 end_package(lex);
00103 end_package(cplus);
00104 end_package(lang);
00105 end_package(lestes);
00106 
00107 #endif
00108 /* vim: set ft=lestes : */

Generated on Mon Feb 12 18:23:11 2007 for lestes by doxygen 1.5.1-20070107