2 * Copyright 2005-2007 Adrian Thurston <thurston@complang.org>
5 /* This file is part of Ragel.
7 * Ragel is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * Ragel is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Ragel; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "parsedata.h"
39 public AvlTreeEl<RedActionTable>
41 RedActionTable( const ActionTable &key )
47 const ActionTable &getKey()
54 typedef AvlTree<RedActionTable, ActionTable, CmpActionTable> ActionTableMap;
65 lowKey = trans->lowKey;
66 highKey = trans->highKey;
70 NextRedTrans( TransAp *t ) {
84 XMLCodeGen( char *fsmName, ParseData *pd, FsmAp *fsm,
85 std::ostream &out, XmlParser &xmlParser );
90 void appendTrans( TransListVect &outList, Key lowKey, Key highKey, TransAp *trans );
91 void writeStateActions( StateAp *state );
92 void writeStateList();
93 void writeStateConditions( StateAp *state );
95 void writeKey( Key key );
96 void writeText( InlineItem *item );
97 void writeGoto( InlineItem *item );
98 void writeGotoExpr( InlineItem *item );
99 void writeCall( InlineItem *item );
100 void writeCallExpr( InlineItem *item );
101 void writeNext( InlineItem *item );
102 void writeNextExpr( InlineItem *item );
103 void writeEntry( InlineItem *item );
104 void writeLmOnLast( InlineItem *item );
105 void writeLmOnNext( InlineItem *item );
106 void writeLmOnLagBehind( InlineItem *item );
109 bool writeNameInst( NameInst *nameInst );
110 void writeEntryPoints();
111 void writeConditions();
112 void writeInlineList( InlineList *inlineList );
113 void writeActionList();
114 void writeActionTableList();
115 void reduceTrans( TransAp *trans );
116 void reduceActionTables();
117 void writeTransList( StateAp *state );
118 void writeEofTrans( StateAp *state );
119 void writeTrans( Key lowKey, Key highKey, TransAp *defTrans );
120 void writeAction( Action *action );
121 void writeLmSwitch( InlineItem *item );
123 void writeActionExec( InlineItem *item );
125 void makeGenInlineList( GenInlineList *outList, InlineList *inList );
126 void makeKey( GenInlineList *outList, Key key );
127 void makeText( GenInlineList *outList, InlineItem *item );
128 void makeLmOnLast( GenInlineList *outList, InlineItem *item );
129 void makeLmOnNext( GenInlineList *outList, InlineItem *item );
130 void makeLmOnLagBehind( GenInlineList *outList, InlineItem *item );
131 void makeActionExec( GenInlineList *outList, InlineItem *item );
132 void makeLmSwitch( GenInlineList *outList, InlineItem *item );
133 void makeSetTokend( GenInlineList *outList, long offset );
134 void makeSetAct( GenInlineList *outList, long lmId );
135 void makeSubList( GenInlineList *outList, InlineList *inlineList,
136 GenInlineItem::Type type );
137 void makeTargetItem( GenInlineList *outList, long targetId, GenInlineItem::Type type );
138 void makeExecGetTokend( GenInlineList *outList );
141 void makeActionList();
142 void makeAction( Action *action );
143 void makeActionTableList();
144 void makeConditions();
145 void makeEntryPoints();
146 bool makeNameInst( std::string &out, NameInst *nameInst );
147 void makeStateList();
149 void makeStateActions( StateAp *state );
150 void makeEofTrans( StateAp *state );
151 void makeStateConditions( StateAp *state );
152 void makeTransList( StateAp *state );
153 void makeTrans( Key lowKey, Key highKey, TransAp *trans );
159 XmlParser &xmlParser;
161 ActionTableMap actionTableMap;
162 int nextActionTableId;
166 #endif /* _XMLDOTGEN_H */