00001 // This file is part of ff3d - http://www.freefem.org/ff3d 00002 // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino 00003 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2, or (at your option) 00007 // any later version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software Foundation, 00016 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 // $Id: FFLexer.hpp,v 1.7 2007/02/08 23:19:38 delpinux Exp $ 00019 00020 #include <Lexer.hpp> 00021 00022 #include <list> 00023 #include <ReferenceCounting.hpp> 00024 00025 #include <IdentifierSet.hpp> 00026 00027 #include <iostream> 00028 00029 #ifndef FFLEXER_HPP 00030 #define FFLEXER_HPP 00031 00038 class Variable; 00039 class FFLexer 00040 : public Lexer 00041 { 00042 private: 00046 int isKeyword (const std::string& word); 00047 00051 int isVariable(const std::string& word); 00052 00056 int isOption (const std::string& word); 00057 00059 IdentifierSet __optionsKeyWords; 00060 public: 00061 00062 00063 00069 static void define(KeyWordList& kw); 00070 00072 int yylex(); 00073 00074 enum Context { 00075 defaultContext, 00076 variationalContext 00077 }; 00078 00079 void switchToContext(const FFLexer::Context context); 00080 00082 FFLexer(std::istream& In, 00083 std::ostream& Out = std::cout); 00084 00086 ~FFLexer() 00087 { 00088 ; 00089 } 00090 }; 00091 00092 #endif // FFLEXER_HPP
1.5.6