In the variable statement changed the name "curstate" to "cs" (the default
[external/ragel.git] / ragel / xmlcodegen.cpp
1 /*
2  *  Copyright 2005-2007 Adrian Thurston <thurston@cs.queensu.ca>
3  */
4
5 /*  This file is part of Ragel.
6  *
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.
11  * 
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.
16  * 
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 
20  */
21
22
23 #include "ragel.h"
24 #include "xmlcodegen.h"
25 #include "parsedata.h"
26 #include "fsmgraph.h"
27 #include <string.h>
28
29 using namespace std;
30
31 XMLCodeGen::XMLCodeGen( char *fsmName, ParseData *pd, FsmAp *fsm, 
32                 std::ostream &out )
33 :
34         fsmName(fsmName),
35         pd(pd),
36         fsm(fsm),
37         out(out),
38         nextActionTableId(0)
39 {
40 }
41
42
43 void XMLCodeGen::writeActionList()
44 {
45         /* Determine which actions to write. */
46         int nextActionId = 0;
47         for ( ActionList::Iter act = pd->actionList; act.lte(); act++ ) {
48                 if ( act->numRefs() > 0 || act->numCondRefs > 0 )
49                         act->actionId = nextActionId++;
50         }
51
52         /* Write the list. */
53         out << "    <action_list length=\"" << nextActionId << "\">\n";
54         for ( ActionList::Iter act = pd->actionList; act.lte(); act++ ) {
55                 if ( act->actionId >= 0 )
56                         writeAction( act );
57         }
58         out << "    </action_list>\n";
59 }
60
61 void XMLCodeGen::writeActionTableList()
62 {
63         /* Must first order the action tables based on their id. */
64         int numTables = nextActionTableId;
65         RedActionTable **tables = new RedActionTable*[numTables];
66         for ( ActionTableMap::Iter at = actionTableMap; at.lte(); at++ )
67                 tables[at->id] = at;
68
69         out << "    <action_table_list length=\"" << numTables << "\">\n";
70         for ( int t = 0; t < numTables; t++ ) {
71                 out << "      <action_table id=\"" << t << "\" length=\"" << 
72                                 tables[t]->key.length() << "\">";
73                 for ( ActionTable::Iter atel = tables[t]->key; atel.lte(); atel++ ) {
74                         out << atel->value->actionId;
75                         if ( ! atel.last() )
76                                 out << " ";
77                 }
78                 out << "</action_table>\n";
79         }
80         out << "    </action_table_list>\n";
81
82         delete[] tables;
83 }
84
85 void XMLCodeGen::reduceActionTables()
86 {
87         /* Reduce the actions tables to a set. */
88         for ( StateList::Iter st = fsm->stateList; st.lte(); st++ ) {
89                 RedActionTable *actionTable = 0;
90
91                 /* Reduce To State Actions. */
92                 if ( st->toStateActionTable.length() > 0 ) {
93                         if ( actionTableMap.insert( st->toStateActionTable, &actionTable ) )
94                                 actionTable->id = nextActionTableId++;
95                 }
96
97                 /* Reduce From State Actions. */
98                 if ( st->fromStateActionTable.length() > 0 ) {
99                         if ( actionTableMap.insert( st->fromStateActionTable, &actionTable ) )
100                                 actionTable->id = nextActionTableId++;
101                 }
102
103                 /* Reduce EOF actions. */
104                 if ( st->eofActionTable.length() > 0 ) {
105                         if ( actionTableMap.insert( st->eofActionTable, &actionTable ) )
106                                 actionTable->id = nextActionTableId++;
107                 }
108
109                 /* Loop the transitions and reduce their actions. */
110                 for ( TransList::Iter trans = st->outList; trans.lte(); trans++ ) {
111                         if ( trans->actionTable.length() > 0 ) {
112                                 if ( actionTableMap.insert( trans->actionTable, &actionTable ) )
113                                         actionTable->id = nextActionTableId++;
114                         }
115                 }
116         }
117 }
118
119 void XMLCodeGen::appendTrans( TransListVect &outList, Key lowKey, 
120                 Key highKey, TransAp *trans )
121 {
122         if ( trans->toState != 0 || trans->actionTable.length() > 0 )
123                 outList.append( TransEl( lowKey, highKey, trans ) );
124 }
125
126 void XMLCodeGen::writeKey( Key key )
127 {
128         if ( keyOps->isSigned )
129                 out << key.getVal();
130         else
131                 out << (unsigned long) key.getVal();
132 }
133
134 void XMLCodeGen::writeTrans( Key lowKey, Key highKey, TransAp *trans )
135 {
136         /* First reduce the action. */
137         RedActionTable *actionTable = 0;
138         if ( trans->actionTable.length() > 0 )
139                 actionTable = actionTableMap.find( trans->actionTable );
140
141         /* Write the transition. */
142         out << "        <t>";
143         writeKey( lowKey );
144         out << " ";
145         writeKey( highKey );
146
147         if ( trans->toState != 0 )
148                 out << " " << trans->toState->alg.stateNum;
149         else
150                 out << " x";
151
152         if ( actionTable != 0 )
153                 out << " " << actionTable->id;
154         else
155                 out << " x";
156         out << "</t>\n";
157 }
158
159 void XMLCodeGen::writeTransList( StateAp *state )
160 {
161         TransListVect outList;
162
163         /* If there is only are no ranges the task is simple. */
164         if ( state->outList.length() > 0 ) {
165                 /* Loop each source range. */
166                 for ( TransList::Iter trans = state->outList; trans.lte(); trans++ ) {
167                         /* Reduce the transition. If it reduced to anything then add it. */
168                         appendTrans( outList, trans->lowKey, trans->highKey, trans );
169                 }
170         }
171
172         out << "      <trans_list length=\"" << outList.length() << "\">\n";
173         for ( TransListVect::Iter tvi = outList; tvi.lte(); tvi++ )
174                 writeTrans( tvi->lowKey, tvi->highKey, tvi->value );
175         out << "      </trans_list>\n";
176 }
177
178 void XMLCodeGen::writeLmSwitch( InlineItem *item )
179 {
180         LongestMatch *longestMatch = item->longestMatch;
181
182         out << "<lm_switch";
183         if ( longestMatch->lmSwitchHandlesError )
184                 out << " handles_error=\"t\"";
185         out << ">\n";
186         
187         for ( LmPartList::Iter lmi = *longestMatch->longestMatchList; lmi.lte(); lmi++ ) {
188                 if ( lmi->inLmSelect && lmi->action != 0 ) {
189                         /* Open the action. Write it with the context that sets up _p 
190                          * when doing control flow changes from inside the machine. */
191                         out << "      <sub_action id=\"" << lmi->longestMatchId << "\">";
192                         writeInlineList( lmi->action->inlineList, item );
193                         out << "</sub_action>\n";
194                 }
195         }
196
197         out << "    </lm_switch><exec><get_tokend></get_tokend></exec>";
198 }
199
200 void XMLCodeGen::writeText( InlineItem *item )
201 {
202         if ( item->prev == 0 || item->prev->type != InlineItem::Text )
203                 out << "<text>";
204         xmlEscapeHost( out, item->data, strlen(item->data) );
205         if ( item->next == 0 || item->next->type != InlineItem::Text )
206                 out << "</text>";
207 }
208
209 bool isLmItem( InlineItem *context )
210 {
211         return context != 0 && (
212                 context->type == InlineItem::LmOnLast ||
213                 context->type == InlineItem::LmOnNext ||
214                 context->type == InlineItem::LmOnLagBehind ||
215                 context->type == InlineItem::LmSwitch );
216 }
217
218 void XMLCodeGen::writeCtrlFlow( InlineItem *item, InlineItem *context )
219 {
220         if ( isLmItem( context ) ) {
221                 out << "<sub_action>";
222                 out << "<exec><get_tokend></get_tokend></exec>";
223         }
224
225         switch ( item->type ) {
226         case InlineItem::Goto:
227                 writeGoto( item, context );
228                 break;
229         case InlineItem::GotoExpr:
230                 writeGotoExpr( item, context );
231                 break;
232         case InlineItem::Call:
233                 writeCall( item, context );
234                 break;
235         case InlineItem::CallExpr:
236                 writeCallExpr( item, context );
237                 break;
238         case InlineItem::Next:
239                 writeNext( item, context );
240                 break;
241         case InlineItem::NextExpr:
242                 writeNextExpr( item, context );
243                 break;
244         case InlineItem::Break:
245                 out << "<break></break>";
246                 break;
247         case InlineItem::Ret: 
248                 out << "<ret></ret>";
249                 break;
250         default: break;
251         }
252
253         if ( isLmItem( context ) )
254                 out << "</sub_action>";
255 }
256
257 void XMLCodeGen::writePtrMod( InlineItem *item, InlineItem *context )
258 {
259         if ( isLmItem( context ) ) {
260                 switch ( item->type ) {
261                 case InlineItem::Hold:
262                         out << "<holdte></holdte>";
263                         break;
264                 case InlineItem::Exec:
265                         writeActionExecTE( item );
266                         break;
267                 default: break;
268                 }
269         }
270         else {
271                 switch ( item->type ) {
272                 case InlineItem::Hold:
273                         out << "<hold></hold>";
274                         break;
275                 case InlineItem::Exec:
276                         writeActionExec( item );
277                         break;
278                 default: break;
279                 }
280         }
281 }
282
283
284 void XMLCodeGen::writeGoto( InlineItem *item, InlineItem *context )
285 {
286         if ( pd->generatingSectionSubset )
287                 out << "<goto>-1</goto>";
288         else {
289                 EntryMapEl *targ = fsm->entryPoints.find( item->nameTarg->id );
290                 out << "<goto>" << targ->value->alg.stateNum << "</goto>";
291         }
292 }
293
294 void XMLCodeGen::writeCall( InlineItem *item, InlineItem *context )
295 {
296         if ( pd->generatingSectionSubset )
297                 out << "<call>-1</call>";
298         else {
299                 EntryMapEl *targ = fsm->entryPoints.find( item->nameTarg->id );
300                 out << "<call>" << targ->value->alg.stateNum << "</call>";
301         }
302 }
303
304 void XMLCodeGen::writeNext( InlineItem *item, InlineItem *context )
305 {
306         if ( pd->generatingSectionSubset )
307                 out << "<next>-1</next>";
308         else {
309                 EntryMapEl *targ = fsm->entryPoints.find( item->nameTarg->id );
310                 out << "<next>" << targ->value->alg.stateNum << "</next>";
311         }
312 }
313
314 void XMLCodeGen::writeGotoExpr( InlineItem *item, InlineItem *context )
315 {
316         out << "<goto_expr>";
317         writeInlineList( item->children, 0 );
318         out << "</goto_expr>";
319 }
320
321 void XMLCodeGen::writeCallExpr( InlineItem *item, InlineItem *context )
322 {
323         out << "<call_expr>";
324         writeInlineList( item->children, 0 );
325         out << "</call_expr>";
326 }
327
328 void XMLCodeGen::writeNextExpr( InlineItem *item, InlineItem *context )
329 {
330         out << "<next_expr>";
331         writeInlineList( item->children, 0 );
332         out << "</next_expr>";
333 }
334
335 void XMLCodeGen::writeEntry( InlineItem * item )
336 {
337         if ( pd->generatingSectionSubset )
338                 out << "<entry>-1</entry>";
339         else {
340                 EntryMapEl *targ = fsm->entryPoints.find( item->nameTarg->id );
341                 out << "<entry>" << targ->value->alg.stateNum << "</entry>";
342         }
343 }
344
345 void XMLCodeGen::writeActionExec( InlineItem *item )
346 {
347         out << "<exec>";
348         writeInlineList( item->children, 0 );
349         out << "</exec>";
350 }
351
352 void XMLCodeGen::writeActionExecTE( InlineItem *item )
353 {
354         out << "<execte>";
355         writeInlineList( item->children, 0 );
356         out << "</execte>";
357 }
358
359 void XMLCodeGen::writeLmOnLast( InlineItem *item )
360 {
361         out << "<set_tokend>1</set_tokend>";
362         if ( item->longestMatchPart->action != 0 ) {
363                 out << "<sub_action>";
364                 writeInlineList( item->longestMatchPart->action->inlineList, item );
365                 out << "</sub_action>";
366         }
367         out << "<exec><get_tokend></get_tokend></exec>";
368 }
369
370 void XMLCodeGen::writeLmOnNext( InlineItem *item )
371 {
372         out << "<set_tokend>0</set_tokend>";
373         if ( item->longestMatchPart->action != 0 ) {
374                 out << "<sub_action>";
375                 writeInlineList( item->longestMatchPart->action->inlineList, item );
376                 out << "</sub_action>";
377         }
378         out << "<exec><get_tokend></get_tokend></exec>";
379 }
380
381 void XMLCodeGen::writeLmOnLagBehind( InlineItem *item )
382 {
383         if ( item->longestMatchPart->action != 0 ) {
384                 out << "<sub_action>";
385                 writeInlineList( item->longestMatchPart->action->inlineList, item );
386                 out << "</sub_action>";
387         }
388         out << "<exec><get_tokend></get_tokend></exec>";
389 }
390
391
392 void XMLCodeGen::writeInlineList( InlineList *inlineList, InlineItem *context )
393 {
394         for ( InlineList::Iter item = *inlineList; item.lte(); item++ ) {
395                 switch ( item->type ) {
396                 case InlineItem::Text:
397                         writeText( item );
398                         break;
399                 case InlineItem::Goto: case InlineItem::GotoExpr:
400                 case InlineItem::Call: case InlineItem::CallExpr:
401                 case InlineItem::Next: case InlineItem::NextExpr:
402                 case InlineItem::Break: case InlineItem::Ret: 
403                         writeCtrlFlow( item, context );
404                         break;
405                 case InlineItem::PChar:
406                         out << "<pchar></pchar>";
407                         break;
408                 case InlineItem::Char: 
409                         out << "<char></char>";
410                         break;
411                 case InlineItem::Curs: 
412                         out << "<curs></curs>";
413                         break;
414                 case InlineItem::Targs: 
415                         out << "<targs></targs>";
416                         break;
417                 case InlineItem::Entry:
418                         writeEntry( item );
419                         break;
420
421                 case InlineItem::Hold:
422                 case InlineItem::Exec:
423                         writePtrMod( item, context );
424                         break;
425
426                 case InlineItem::LmSwitch: 
427                         writeLmSwitch( item );
428                         break;
429                 case InlineItem::LmSetActId:
430                         out << "<set_act>" << 
431                                         item->longestMatchPart->longestMatchId << 
432                                         "</set_act>";
433                         break;
434                 case InlineItem::LmSetTokEnd:
435                         out << "<set_tokend>1</set_tokend>";
436                         break;
437                 case InlineItem::LmOnLast:
438                         writeLmOnLast( item );
439                         break;
440                 case InlineItem::LmOnNext:
441                         writeLmOnNext( item );
442                         break;
443                 case InlineItem::LmOnLagBehind:
444                         writeLmOnLagBehind( item );
445                         break;
446                 case InlineItem::LmInitAct:
447                         out << "<init_act></init_act>";
448                         break;
449                 case InlineItem::LmInitTokStart:
450                         out << "<init_tokstart></init_tokstart>";
451                         break;
452                 case InlineItem::LmSetTokStart:
453                         out << "<set_tokstart></set_tokstart>";
454                         break;
455                 }
456         }
457 }
458
459 void XMLCodeGen::writeAction( Action *action )
460 {
461         out << "      <action id=\"" << action->actionId << "\"";
462         if ( action->name != 0 ) 
463                 out << " name=\"" << action->name << "\"";
464         out << " line=\"" << action->loc.line << "\" col=\"" << action->loc.col << "\">";
465         writeInlineList( action->inlineList, 0 );
466         out << "</action>\n";
467 }
468
469 void xmlEscapeHost( std::ostream &out, char *data, long len )
470 {
471         char *end = data + len;
472         while ( data != end ) {
473                 switch ( *data ) {
474                 case '<': out << "&lt;"; break;
475                 case '>': out << "&gt;"; break;
476                 case '&': out << "&amp;"; break;
477                 default: out << *data; break;
478                 }
479                 data += 1;
480         }
481 }
482
483 void XMLCodeGen::writeStateActions( StateAp *state )
484 {
485         RedActionTable *toStateActions = 0;
486         if ( state->toStateActionTable.length() > 0 )
487                 toStateActions = actionTableMap.find( state->toStateActionTable );
488
489         RedActionTable *fromStateActions = 0;
490         if ( state->fromStateActionTable.length() > 0 )
491                 fromStateActions = actionTableMap.find( state->fromStateActionTable );
492
493         RedActionTable *eofActions = 0;
494         if ( state->eofActionTable.length() > 0 )
495                 eofActions = actionTableMap.find( state->eofActionTable );
496         
497         if ( toStateActions != 0 || fromStateActions != 0 || eofActions != 0 ) {
498                 out << "      <state_actions>";
499                 if ( toStateActions != 0 )
500                         out << toStateActions->id;
501                 else
502                         out << "x";
503
504                 if ( fromStateActions != 0 )
505                         out << " " << fromStateActions->id;
506                 else
507                         out << " x";
508
509                 if ( eofActions != 0 )
510                         out << " " << eofActions->id;
511                 else
512                         out << " x"; out << "</state_actions>\n";
513         }
514 }
515
516 void XMLCodeGen::writeStateConditions( StateAp *state )
517 {
518         if ( state->stateCondList.length() > 0 ) {
519                 out << "      <cond_list length=\"" << state->stateCondList.length() << "\">\n";
520                 for ( StateCondList::Iter scdi = state->stateCondList; scdi.lte(); scdi++ ) {
521                         out << "        <c>";
522                         writeKey( scdi->lowKey );
523                         out << " ";
524                         writeKey( scdi->highKey );
525                         out << " ";
526                         out << scdi->condSpace->condSpaceId;
527                         out << "</c>\n";
528                 }
529                 out << "      </cond_list>\n";
530         }
531 }
532
533 void XMLCodeGen::writeStateList()
534 {
535         /* Write the list of states. */
536         out << "    <state_list length=\"" << fsm->stateList.length() << "\">\n";
537         for ( StateList::Iter st = fsm->stateList; st.lte(); st++ ) {
538                 out << "      <state id=\"" << st->alg.stateNum << "\"";
539                 if ( st->isFinState() )
540                         out << " final=\"t\"";
541                 out << ">\n";
542
543                 writeStateActions( st );
544                 writeStateConditions( st );
545                 writeTransList( st );
546
547                 out << "      </state>\n";
548
549                 if ( !st.last() )
550                         out << "\n";
551         }
552         out << "    </state_list>\n";
553 }
554
555 bool XMLCodeGen::writeNameInst( NameInst *nameInst )
556 {
557         bool written = false;
558         if ( nameInst->parent != 0 )
559                 written = writeNameInst( nameInst->parent );
560         
561         if ( nameInst->name != 0 ) {
562                 if ( written )
563                         out << '_';
564                 out << nameInst->name;
565                 written = true;
566         }
567
568         return written;
569 }
570
571 void XMLCodeGen::writeEntryPoints()
572 {
573         /* List of entry points other than start state. */
574         if ( fsm->entryPoints.length() > 0 || pd->lmRequiresErrorState ) {
575                 out << "    <entry_points";
576                 if ( pd->lmRequiresErrorState )
577                         out << " error=\"t\"";
578                 out << ">\n";
579                 for ( EntryMap::Iter en = fsm->entryPoints; en.lte(); en++ ) {
580                         /* Get the name instantiation from nameIndex. */
581                         NameInst *nameInst = pd->nameIndex[en->key];
582                         StateAp *state = en->value;
583                         out << "      <entry name=\"";
584                         writeNameInst( nameInst );
585                         out << "\">" << state->alg.stateNum << "</entry>\n";
586                 }
587                 out << "    </entry_points>\n";
588         }
589 }
590
591 void XMLCodeGen::writeMachine()
592 {
593         /* Open the machine. */
594         out << "  <machine>\n"; 
595         
596         /* Action tables. */
597         reduceActionTables();
598
599         writeActionList();
600         writeActionTableList();
601         writeConditions();
602
603         /* Start state. */
604         out << "    <start_state>" << fsm->startState->alg.stateNum << 
605                         "</start_state>\n";
606         
607         /* Error state. */
608         if ( fsm->errState != 0 ) {
609                 out << "    <error_state>" << fsm->errState->alg.stateNum << 
610                         "</error_state>\n";
611         }
612
613         writeEntryPoints();
614         writeStateList();
615
616         out << "  </machine>\n";
617 }
618
619
620 void XMLCodeGen::writeConditions()
621 {
622         if ( condData->condSpaceMap.length() > 0 ) {
623                 long nextCondSpaceId = 0;
624                 for ( CondSpaceMap::Iter cs = condData->condSpaceMap; cs.lte(); cs++ )
625                         cs->condSpaceId = nextCondSpaceId++;
626
627                 out << "    <cond_space_list length=\"" << condData->condSpaceMap.length() << "\">\n";
628                 for ( CondSpaceMap::Iter cs = condData->condSpaceMap; cs.lte(); cs++ ) {
629                         out << "      <cond_space id=\"" << cs->condSpaceId << 
630                                 "\" length=\"" << cs->condSet.length() << "\">";
631                         writeKey( cs->baseKey );
632                         for ( CondSet::Iter csi = cs->condSet; csi.lte(); csi++ )
633                                 out << " " << (*csi)->actionId;
634                         out << "</cond_space>\n";
635                 }
636                 out << "    </cond_space_list>\n";
637         }
638 }
639
640 void XMLCodeGen::writeExports()
641 {
642         if ( pd->exportList.length() > 0 ) {
643                 out << "  <exports>\n";
644                 for ( ExportList::Iter exp = pd->exportList; exp.lte(); exp++ ) {
645                         out << "    <ex name=\"" << exp->name << "\">";
646                         writeKey( exp->key );
647                         out << "</ex>\n";
648                 }
649                 out << "  </exports>\n";
650         }
651 }
652
653 void XMLCodeGen::writeXML()
654 {
655         /* Open the definition. */
656         out << "<ragel_def name=\"" << fsmName << "\">\n";
657
658         /* Alphabet type. */
659         out << "  <alphtype>" << 
660                 (keyOps->alphType - hostLang->hostTypes) << "</alphtype>\n";
661         
662         /* Getkey expression. */
663         if ( pd->getKeyExpr != 0 ) {
664                 out << "  <getkey>";
665                 writeInlineList( pd->getKeyExpr, 0 );
666                 out << "</getkey>\n";
667         }
668
669         /* Access expression. */
670         if ( pd->accessExpr != 0 ) {
671                 out << "  <access>";
672                 writeInlineList( pd->accessExpr, 0 );
673                 out << "</access>\n";
674         }
675
676         /*
677          * Variable expressions.
678          */
679
680         if ( pd->pExpr != 0 ) {
681                 out << "  <p_expr>";
682                 writeInlineList( pd->pExpr, 0 );
683                 out << "</p_expr>\n";
684         }
685         
686         if ( pd->peExpr != 0 ) {
687                 out << "  <pe_expr>";
688                 writeInlineList( pd->peExpr, 0 );
689                 out << "</pe_expr>\n";
690         }
691         
692         if ( pd->csExpr != 0 ) {
693                 out << "  <cs_expr>";
694                 writeInlineList( pd->csExpr, 0 );
695                 out << "</cs_expr>\n";
696         }
697         
698         if ( pd->topExpr != 0 ) {
699                 out << "  <top_expr>";
700                 writeInlineList( pd->topExpr, 0 );
701                 out << "</top_expr>\n";
702         }
703         
704         if ( pd->stackExpr != 0 ) {
705                 out << "  <stack_expr>";
706                 writeInlineList( pd->stackExpr, 0 );
707                 out << "</stack_expr>\n";
708         }
709         
710         if ( pd->actExpr != 0 ) {
711                 out << "  <act_expr>";
712                 writeInlineList( pd->actExpr, 0 );
713                 out << "</act_expr>\n";
714         }
715         
716         if ( pd->tokstartExpr != 0 ) {
717                 out << "  <tokstart_expr>";
718                 writeInlineList( pd->tokstartExpr, 0 );
719                 out << "</tokstart_expr>\n";
720         }
721         
722         if ( pd->tokendExpr != 0 ) {
723                 out << "  <tokend_expr>";
724                 writeInlineList( pd->tokendExpr, 0 );
725                 out << "</tokend_expr>\n";
726         }
727         
728         writeExports();
729         
730         writeMachine();
731
732         out <<
733                 "</ragel_def>\n";
734 }
735