00001 /* 00002 * Copyright 2007 Martin von Gagern 00003 * 00004 * 00005 * This file is part of mqn2mps. 00006 * 00007 * mqn2mps is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * mqn2mps is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 00022 #ifndef LEXER_HH 00023 #define LEXER_HH 00024 00025 #undef yyFlexLexer 00026 #include <FlexLexer.h> 00027 00028 /** 00029 * @file lexer.hh 00030 * Interface of class yy::lexer. 00031 * Although the lexer implementation in lexer.cc is generated by flex, 00032 * this header file is not generated automatically. 00033 */ 00034 00035 /** 00036 * @file lexer.lex 00037 * Lexical token recognition for input file. 00038 * These token definitions are used to generate lexer.cc. 00039 */ 00040 00041 /** 00042 * @file lexer.cc 00043 * Generated yy::lexer implementation. 00044 * This lexer is generated by flex, using the token definitions from 00045 * lexer.yy. 00046 */ 00047 00048 namespace yy { 00049 00050 /** 00051 * A lexical scanner for the input file format. 00052 * 00053 * The lexer reads characters from an input stream and groups them 00054 * to tokens, which are handed to yy::parser to be matched against 00055 * the input grammar. A token is described using a regular 00056 * expression. The lexer is the place where whitespace is stripped 00057 * from the input (except in string literals). 00058 * 00059 * This lexer was generated from lexer.lex using flex. 00060 */ 00061 class lexer : public yyFlexLexer { 00062 private: 00063 00064 /** 00065 * Reference to the driver. 00066 * Used for error reporting. 00067 */ 00068 driver& theDriver; 00069 00070 public: 00071 /** 00072 * Constructor. 00073 * 00074 * @param d the driver, used for error reporting. 00075 * @param in input stream from which tokens are read. 00076 * @param out output stream for error messages. 00077 */ 00078 lexer(driver& d, std::istream* in = 0, std::ostream* out = 0); 00079 00080 /** 00081 * Destructor. 00082 */ 00083 virtual ~lexer(); 00084 00085 /** 00086 * Read next token from input. 00087 * This is the most important part of the lexer. It is called 00088 * repeatedly by the parser through driver::scan to read the next 00089 * token from the input. 00090 * 00091 * @param[out] yylval the value of the token. 00092 * @param[out] yylloc the location of the token. 00093 * @return the type code of the token. 00094 */ 00095 parser::token_type yylex(parser::semantic_type* yylval, 00096 parser::location_type* yylloc); 00097 /** 00098 * Error handler. 00099 * 00100 * Error messages are forwarded to driver::error, which takes care 00101 * of printing them. 00102 * 00103 * @param msg a message describing the error. 00104 */ 00105 virtual void LexerError(const char* msg); 00106 }; 00107 00108 } 00109 00110 /** 00111 * @struct yy_buffer_state 00112 * Generated structure used by yy::lexer. 00113 */ 00114 00115 /** 00116 * @struct yy_trans_info 00117 * Generated structure used by yy::lexer. 00118 */ 00119 00120 #endif // ifndef LEXER_HH
1.6.0