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__syn__prefixer_hh__included 00029 #define lestes__lang__cplus__syn__prefixer_hh__included 00030 00031 #include <lestes/common.hh> 00032 #include <lestes/lang/cplus/syn/token.hh> 00033 00034 package(lestes); 00035 package(lang); 00036 package(cplus); 00037 package(lex); 00038 class preprocessor; 00039 end_package(lex); 00040 package(syn); 00041 00042 class prefixer { 00043 public: 00044 typedef ::lestes::lang::cplus::lex::preprocessor preprocessor; 00045 00046 //! handles user hints (prefixes): they are stored in the user_hint field of the returned token 00047 static ptr<bison_token> yylex(); 00048 00049 enum mode_type { 00050 PREFIX_OFF, 00051 PREFIX_ON 00052 }; 00053 00054 static void init( mode_type, ptr<preprocessor> ); 00055 static mode_type mode_get(); 00056 protected: 00057 //! used internally to actually call the lex scanner 00058 static ptr<bison_token> internal_yylex(); 00059 //! given ucn_string, returns corresponding hint; when the string is not a valid prefix, HINT_NONE is returned 00060 static bison_token::hint_type prefix2hint( const ucn_string & ); 00061 private: 00062 //! Do no allow instantiating this class. 00063 prefixer(); 00064 //! Hide copy-constructor. 00065 prefixer( const prefixer & ); 00066 static mode_type mode; 00067 static ptr<preprocessor> pp; 00068 }; 00069 00070 end_package(syn); 00071 end_package(cplus); 00072 end_package(lang); 00073 end_package(lestes); 00074 00075 #endif // lestes__lang__cplus__syn__prefixer_hh__included
1.5.1-20070107