From: thurston Date: Wed, 8 Oct 2008 18:27:39 +0000 (+0000) Subject: Started working on the direct construction of the backend inline item lists. X-Git-Tag: 2.0_alpha~97 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bbae9420a0743358b48e47324dc4169312a4dab0;p=external%2Fragel.git Started working on the direct construction of the backend inline item lists. git-svn-id: http://svn.complang.org/ragel/trunk@489 052ea7fc-9027-0410-9066-f65837a77df0 --- diff --git a/ragel/main.cpp b/ragel/main.cpp index b5c026c..705c12a 100644 --- a/ragel/main.cpp +++ b/ragel/main.cpp @@ -499,8 +499,8 @@ void process( const char *inputFileName, const char *intermed ) xmlParser.init(); /* Write the machines, then the surrounding code. */ - writeMachines( *xmlOutFile, hostData.str(), inputFileName, xmlParser ); - //generate( *xmlOutFile, hostData.str(), inputFileName, xmlParser ); + //writeMachines( *xmlOutFile, hostData.str(), inputFileName, xmlParser ); + generate( *xmlOutFile, hostData.str(), inputFileName, xmlParser ); /* Close the input and the intermediate file. */ delete xmlOutFile; diff --git a/ragel/xmlcodegen.cpp b/ragel/xmlcodegen.cpp index e197e07..ee0ee5e 100644 --- a/ragel/xmlcodegen.cpp +++ b/ragel/xmlcodegen.cpp @@ -448,14 +448,38 @@ void XMLCodeGen::makeKey( GenInlineList *outList, Key key ) void XMLCodeGen::makeText( GenInlineList *outList, InlineItem *item ) { + GenInlineItem *inlineItem = new GenInlineItem( GenInputLoc(), GenInlineItem::Text ); + inlineItem->data = item->data; + + outList->append( inlineItem ); } void XMLCodeGen::makeGoto( GenInlineList *outList, InlineItem *item ) { + long targetState; + if ( pd->generatingSectionSubset ) + targetState = -1; + else { + EntryMapEl *targ = fsm->entryPoints.find( item->nameTarg->id ); + targetState = targ->value->alg.stateNum; + } + + /* Make the item. */ + GenInlineItem *inlineItem = new GenInlineItem( GenInputLoc(), GenInlineItem::Goto ); + inlineItem->targId = targetState; + outList->append( inlineItem ); } void XMLCodeGen::makeGotoExpr( GenInlineList *outList, InlineItem *item ) { + /* Fill the sub list. */ + GenInlineList *subList = new GenInlineList; + makeGenInlineList( subList, item->children ); + + /* Make the item. */ + GenInlineItem *inlineItem = new GenInlineItem( GenInputLoc(), GenInlineItem::GotoExpr ); + inlineItem->children = subList; + outList->append( inlineItem ); } void XMLCodeGen::makeCall( GenInlineList *outList, InlineItem *item )