diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-03-24 04:52:08 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-03-24 04:52:08 +0000 |
commit | d13d67a31c451ebd78ce708a4ef85803d429f158 (patch) | |
tree | 12228e3c829c72d40ca2e6da8cb7797fcda11e91 /ragel/cdgoto.cpp | |
parent | eafd7a3974e8605fd02794269db6114a3446e016 (diff) | |
download | ragel-tarball-d13d67a31c451ebd78ce708a4ef85803d429f158.tar.gz |
ragel-6.10HEADragel-6.10master
Diffstat (limited to 'ragel/cdgoto.cpp')
-rw-r--r-- | ragel/cdgoto.cpp | 56 |
1 files changed, 47 insertions, 9 deletions
diff --git a/ragel/cdgoto.cpp b/ragel/cdgoto.cpp index e434143..86b3d23 100644 --- a/ragel/cdgoto.cpp +++ b/ragel/cdgoto.cpp @@ -543,15 +543,32 @@ std::ostream &GotoCodeGen::FINISH_CASES() void GotoCodeGen::GOTO( ostream &ret, int gotoDest, bool inFinish ) { - ret << "{" << vCS() << " = " << gotoDest << "; " << - CTRL_FLOW() << "goto _again;}"; + ret << "{"; + + ret << vCS() << " = " << gotoDest << ";"; + + if ( inFinish && !noEnd ) + EOF_CHECK( ret ); + + ret << CTRL_FLOW() << "goto _again;"; + + ret << "}"; } void GotoCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << vCS() << " = ("; + ret << "{"; + + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); - ret << "); " << CTRL_FLOW() << "goto _again;}"; + ret << ");"; + + if ( inFinish && !noEnd ) + EOF_CHECK( ret ); + + ret << CTRL_FLOW() << "goto _again;"; + + ret << "}"; } void GotoCodeGen::CURS( ostream &ret, bool inFinish ) @@ -583,8 +600,16 @@ void GotoCodeGen::CALL( ostream &ret, int callDest, int targState, bool inFinish INLINE_LIST( ret, prePushExpr, 0, false, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << - callDest << "; " << CTRL_FLOW() << "goto _again;}"; + ret << "{"; + + ret << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << callDest << ";"; + + if ( inFinish && !noEnd ) + EOF_CHECK( ret ); + + ret << CTRL_FLOW() << "goto _again;"; + + ret << "}"; if ( prePushExpr != 0 ) ret << "}"; @@ -597,9 +622,18 @@ void GotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, INLINE_LIST( ret, prePushExpr, 0, false, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; + ret << "{"; + + ret << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, targState, inFinish, false ); - ret << "); " << CTRL_FLOW() << "goto _again;}"; + ret << ");"; + + if ( inFinish && !noEnd ) + EOF_CHECK( ret ); + + ret << CTRL_FLOW() << "goto _again;"; + + ret << "}"; if ( prePushExpr != 0 ) ret << "}"; @@ -615,7 +649,11 @@ void GotoCodeGen::RET( ostream &ret, bool inFinish ) ret << "}"; } - ret << CTRL_FLOW() << "goto _again;}"; + if ( inFinish && !noEnd ) + EOF_CHECK( ret ); + + ret << CTRL_FLOW() << "goto _again;"; + ret << "}"; } void GotoCodeGen::BREAK( ostream &ret, int targState, bool csForced ) |