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___taboo_macros_hh___included 00029 #define lestes__lang__cplus__lex___taboo_macros_hh___included 00030 00031 /*! \file 00032 \brief Taboo macros. 00033 00034 Declaration of taboo_macros class representing set of disallowed macros. 00035 \author pt 00036 */ 00037 00038 #include <lestes/common.hh> 00039 #include <lestes/std/set.hh> 00040 #include <lestes/std/map.hh> 00041 00042 package(lestes); 00043 package(lang); 00044 package(cplus); 00045 package(lex); 00046 00047 // forward declaration to avoid cycle 00048 class macro; 00049 00050 /*! 00051 \brief Set of taboo macros. 00052 00053 Represents a set of macros, which shall not be expanded. 00054 The set is constant and extending it creates a new set. 00055 */ 00056 class taboo_macros: public ::lestes::std::object { 00057 public: 00058 // TODO pt remove 00059 ucn_string names_get(void) const; 00060 //! Tests macro membership. 00061 bool contains(const ptr<macro> &a_macro) const; 00062 //! Returns new set with added macro. 00063 ptr<taboo_macros> extend(const ptr<macro> &a_macro) const; 00064 //! Returns empty set. 00065 static ptr<taboo_macros> create(void); 00066 protected: 00067 //! Creates empty set. 00068 taboo_macros(void); 00069 //! Marks the object. 00070 virtual void gc_mark(void); 00071 private: 00072 //! Creates a copy of the object with added macro. 00073 taboo_macros(const ptr<taboo_macros> ©, const ptr<macro> &a_macro); 00074 //! Type of set of macros. 00075 typedef ::lestes::std::set< srp<macro> > taboo_type; 00076 //! Type of auxiliary map for sharing newly created instances. 00077 typedef ::lestes::std::map< srp<macro>, srp<taboo_macros> > shared_type; 00078 //! Set of taboo macros. 00079 srp<taboo_type> taboo; 00080 //! Internal map to remember objects created by extend. 00081 mutable srp<shared_type> shared; 00082 //! Internal shared empty instance. 00083 static ptr<taboo_macros> empty_instance; 00084 }; 00085 00086 end_package(lex); 00087 end_package(cplus); 00088 end_package(lang); 00089 end_package(lestes); 00090 00091 #endif 00092 /* vim: set ft=lestes : */
1.5.1-20070107