00001 /* 00002 * File: scanner_dfa_writer.hh 00003 * $Id: scanner_dfa_writer.hh,v 1.5 2002/06/26 20:50:48 alec Exp $ 00004 * 00005 * Author: Alec Panovici (alecu@email.com) 00006 * 00007 * Comments: 00008 * 00009 * Revision history: 00010 * 00011 * $Log: scanner_dfa_writer.hh,v $ 00012 * Revision 1.5 2002/06/26 20:50:48 alec 00013 * g++ 3.x happy 00014 * 00015 * Revision 1.4 2002/06/23 23:30:11 alec 00016 * profile-based optimization stuff 00017 * 00018 * Revision 1.3 2002/05/27 03:03:51 alec 00019 * doc update 00020 * 00021 * Revision 1.2 2002/05/04 17:39:22 alec 00022 * the scanner works (slightly tested) 00023 * 00024 * Revision 1.1 2002/05/01 16:34:01 alec 00025 * *** empty log message *** 00026 * 00027 */ 00028 00029 00030 /* 00031 Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com) 00032 00033 This program is free software; you can redistribute it and/or modify 00034 it under the terms of the GNU General Public License as published by 00035 the Free Software Foundation; either version 2 of the License, or 00036 (at your option) any later version. 00037 00038 This program is distributed in the hope that it will be useful, 00039 but WITHOUT ANY WARRANTY; without even the implied warranty of 00040 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00041 GNU General Public License for more details. 00042 00043 You should have received a copy of the GNU General Public License 00044 along with this program; if not, write to the Free Software 00045 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00046 00047 */ 00048 00049 #ifndef __SCANNER_DFA_WRITER_HH__ 00050 #define __SCANNER_DFA_WRITER_HH__ 00051 00052 #include <fstream> 00053 #include <string> 00054 #include <vector> 00055 using namespace std; 00056 00057 00058 #include "debug.h" 00059 #include "writer.hh" 00060 00061 class ScannerDfaSpec; 00062 class BasicDfaSpec; 00063 class TokenSpec; 00064 class PropRegistry; 00065 class BasicDfaProfile; 00066 00070 class ScannerDfaWriter : public Writer 00071 { 00072 public: 00073 00074 ScannerDfaWriter (TokenSpec &tSpec_, PropRegistry ®istry_); 00075 00076 void writeScanner (ScannerDfaSpec &dfa); 00077 00078 protected: 00079 00080 void writeDfa (BasicDfaSpec &dfa, BasicDfaProfile &sdp); 00081 00090 int ScannerDfaWriter::writeCharCompare (vector<unsigned char> v, int i); 00091 00098 void writeExceptionCode (const string &what, const string &handlerName, 00099 bool isName = false); 00100 00101 private: 00102 00103 TokenSpec &tSpec; 00104 }; 00105 00106 #endif /* #ifndef __SCANNER_DFA_WRITER_HH__ */