Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

basic_dfa_spec.hh

Go to the documentation of this file.
00001 /*
00002  *  File:       basic_dfa_spec.hh
00003  *              $Id: basic_dfa_spec.hh,v 1.5 2002/06/26 20:45:36 alec Exp $
00004  *
00005  *  Author:     Alec Panovici (alecu@email.com)
00006  * 
00007  *  Comments:
00008  *
00009  *  Revision history:
00010  *
00011  *  $Log: basic_dfa_spec.hh,v $
00012  *  Revision 1.5  2002/06/26 20:45:36  alec
00013  *  g++ 3.x happy
00014  *
00015  *  Revision 1.4  2002/05/27 02:58:35  alec
00016  *  doc update
00017  *
00018  *  Revision 1.3  2002/05/01 16:32:14  alec
00019  *  dfa ok. huh !
00020  *
00021  *  Revision 1.2  2002/05/01 09:18:26  alec
00022  *  - vBitset fixes
00023  *  - FOLLOWPOS written (not tested yet)
00024  *
00025  *  Revision 1.1  2002/04/30 16:26:38  alec
00026  *  my big endian will eat your little endian
00027  *
00028  */
00029 
00030 
00031 /*
00032   Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com)
00033 
00034   This program is free software; you can redistribute it and/or modify
00035   it under the terms of the GNU General Public License as published by
00036   the Free Software Foundation; either version 2 of the License, or
00037   (at your option) any later version.
00038 
00039   This program is distributed in the hope that it will be useful,
00040   but WITHOUT ANY WARRANTY; without even the implied warranty of
00041   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00042   GNU General Public License for more details.
00043 
00044   You should have received a copy of the GNU General Public License
00045   along with this program; if not, write to the Free Software
00046   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00047 
00048  */
00049 
00050 #ifndef __BASIC_DFA_SPEC_HH__
00051 #define __BASIC_DFA_SPEC_HH__
00052 
00053 #include <vector>
00054 #include <string>
00055 using namespace std;
00056 
00057 #include "debug.h"
00058 
00065 class BasicDfaSpec
00066 {
00067 public:
00068 
00072   typedef struct t_Transition
00073   {
00077     unsigned char on;
00078 
00082     unsigned int to;
00083 
00084     t_Transition () {}
00085     t_Transition (unsigned char on_, unsigned int to_) :
00086       on(on_), to(to_)
00087     {}
00088     
00089   } Transition;
00090   
00094   typedef struct t_State
00095   {
00096 
00097     t_State () : isFinal(false), tokId(0)
00098     {}
00099     
00100     void addTransition (unsigned char on, unsigned int to)
00101     {
00102       transitions.push_back(Transition(on, to));
00103     }
00104 
00105 #ifdef DEBUG
00106     void dump (ostream &os);
00107 #endif
00108     
00114     vector<Transition> transitions;
00115     
00119     bool isFinal;
00120 
00125     int tokId;
00126   } State;
00127 
00132   BasicDfaSpec (const string &name_) : name(name_) {}
00133 
00134 #ifdef DEBUG
00135   void dump (ostream &os);
00136 #endif
00137 
00141   string name;
00142 
00147   vector<State> states;
00148 };
00149 
00150 #endif /* #ifndef __BASIC_DFA_SPEC_HH__ */

Generated at Tue Jul 9 21:05:43 2002 for CppCC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001