00001 /* 00002 * File: dfa_generator.cc 00003 * $Id: dfa_generator.cc,v 1.2 2002/05/04 17:39:22 alec Exp $ 00004 * 00005 * Author: Alec Panoviciu (alecu@email.com) 00006 * 00007 * Comments: 00008 * 00009 * Revision history: 00010 * 00011 * $Log: dfa_generator.cc,v $ 00012 * Revision 1.2 2002/05/04 17:39:22 alec 00013 * the scanner works (slightly tested) 00014 * 00015 * Revision 1.1 2002/04/30 16:26:38 alec 00016 * my big endian will eat your little endian 00017 * 00018 */ 00019 00020 /* 00021 Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com) 00022 00023 This program is free software; you can redistribute it and/or modify 00024 it under the terms of the GNU General Public License as published by 00025 the Free Software Foundation; either version 2 of the License, or 00026 (at your option) any later version. 00027 00028 This program is distributed in the hope that it will be useful, 00029 but WITHOUT ANY WARRANTY; without even the implied warranty of 00030 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00031 GNU General Public License for more details. 00032 00033 You should have received a copy of the GNU General Public License 00034 along with this program; if not, write to the Free Software 00035 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00036 00037 */ 00038 00039 00040 #include "dfa_generator.hh" 00041 #include "scanner_dfa_spec.hh" 00042 #include "scanner_spec.hh" 00043 #include "basic_dfa_generator.hh" 00044 00045 ScannerDfaSpec& DfaGenerator::createScannerDfa (PropRegistry ®istry, 00046 ScannerSpec &scanner, 00047 ITokenSpec &tokens) 00048 { 00049 ScannerDfaSpec &dfa = *new ScannerDfaSpec(scanner.className, 00050 scanner.preambleCode, 00051 scanner.userCode, 00052 scanner.inheritance); 00053 00054 BasicDfaGenerator bdg(tokens, registry); 00055 00056 for (int i = 0; i < scanner.states.size(); i++) 00057 dfa.addBasicDfa(bdg.createBasicDfa(scanner.states[i])); 00058 00059 return dfa; 00060 }