00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
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