From 66971b05b975d32b4eeff8b29a1352ed2769fb49 Mon Sep 17 00:00:00 2001 From: thurston Date: Sat, 28 Mar 2009 15:55:32 +0000 Subject: [PATCH] CS is in use on OpenSolaris, changed to vCS(). Changed EOFV() to vEOF(). The little v in front looks better than the big V on the end. git-svn-id: http://svn.complang.org/ragel/trunk@767 052ea7fc-9027-0410-9066-f65837a77df0 --- ragel/cdcodegen.cpp | 6 +++--- ragel/cdcodegen.h | 4 ++-- ragel/cdfflat.cpp | 20 +++++++++--------- ragel/cdfgoto.cpp | 16 +++++++-------- ragel/cdflat.cpp | 48 +++++++++++++++++++++---------------------- ragel/cdftable.cpp | 20 +++++++++--------- ragel/cdgoto.cpp | 36 ++++++++++++++++----------------- ragel/cdipgoto.cpp | 26 ++++++++++++------------ ragel/cdsplit.cpp | 12 +++++------ ragel/cdtable.cpp | 50 ++++++++++++++++++++++----------------------- ragel/cscodegen.cpp | 6 +++--- ragel/cscodegen.h | 4 ++-- ragel/csfflat.cpp | 20 +++++++++--------- ragel/csfgoto.cpp | 16 +++++++-------- ragel/csflat.cpp | 54 ++++++++++++++++++++++++------------------------- ragel/csftable.cpp | 20 +++++++++--------- ragel/csgoto.cpp | 36 ++++++++++++++++----------------- ragel/csipgoto.cpp | 26 ++++++++++++------------ ragel/cssplit.cpp | 12 +++++------ ragel/cstable.cpp | 50 ++++++++++++++++++++++----------------------- ragel/javacodegen.cpp | 56 +++++++++++++++++++++++++-------------------------- ragel/javacodegen.h | 4 ++-- ragel/rbxgoto.cpp | 32 ++++++++++++++--------------- ragel/rubycodegen.cpp | 8 ++++---- ragel/rubycodegen.h | 4 ++-- ragel/rubyfflat.cpp | 34 +++++++++++++++---------------- ragel/rubyflat.cpp | 52 +++++++++++++++++++++++------------------------ ragel/rubyftable.cpp | 34 +++++++++++++++---------------- ragel/rubytable.cpp | 52 +++++++++++++++++++++++------------------------ 29 files changed, 379 insertions(+), 379 deletions(-) diff --git a/ragel/cdcodegen.cpp b/ragel/cdcodegen.cpp index 01eb50d..a7d51be 100644 --- a/ragel/cdcodegen.cpp +++ b/ragel/cdcodegen.cpp @@ -183,7 +183,7 @@ string FsmCodeGen::PE() return ret.str(); } -string FsmCodeGen::EOFV() +string FsmCodeGen::vEOF() { ostringstream ret; if ( eofExpr == 0 ) @@ -196,7 +196,7 @@ string FsmCodeGen::EOFV() return ret.str(); } -string FsmCodeGen::CS() +string FsmCodeGen::vCS() { ostringstream ret; if ( csExpr == 0 ) @@ -556,7 +556,7 @@ void FsmCodeGen::writeInit() out << " {\n"; if ( !noCS ) - out << "\t" << CS() << " = " << START() << ";\n"; + out << "\t" << vCS() << " = " << START() << ";\n"; /* If there are any calls, then the stack top needs initialization. */ if ( redFsm->anyActionCalls() || redFsm->anyActionRets() ) diff --git a/ragel/cdcodegen.h b/ragel/cdcodegen.h index fe69cb2..23b2228 100644 --- a/ragel/cdcodegen.h +++ b/ragel/cdcodegen.h @@ -91,10 +91,10 @@ protected: string P(); string PE(); - string EOFV(); + string vEOF(); string ACCESS(); - string CS(); + string vCS(); string STACK(); string TOP(); string TOKSTART(); diff --git a/ragel/cdfflat.cpp b/ragel/cdfflat.cpp index 1617c2d..d2c1c78 100644 --- a/ragel/cdfflat.cpp +++ b/ragel/cdfflat.cpp @@ -276,7 +276,7 @@ void FFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -284,7 +284,7 @@ void FFlatCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " switch ( " << FSA() << "[" << CS() << "] ) {\n"; + " switch ( " << FSA() << "[" << vCS() << "] ) {\n"; FROM_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -300,10 +300,10 @@ void FFlatCodeGen::writeExec() out << "_eof_trans:\n"; if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n\n"; + " " << vCS() << " = " << TT() << "[_trans];\n\n"; if ( redFsm->anyRegActions() ) { out << @@ -323,7 +323,7 @@ void FFlatCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " switch ( " << TSA() << "[" << CS() << "] ) {\n"; + " switch ( " << TSA() << "[" << vCS() << "] ) {\n"; TO_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -333,7 +333,7 @@ void FFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -353,20 +353,20 @@ void FFlatCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " if ( " << ET() << "[" << CS() << "] > 0 ) {\n" - " _trans = " << ET() << "[" << CS() << "] - 1;\n" + " if ( " << ET() << "[" << vCS() << "] > 0 ) {\n" + " _trans = " << ET() << "[" << vCS() << "] - 1;\n" " goto _eof_trans;\n" " }\n"; } if ( redFsm->anyEofActions() ) { out << - " switch ( " << EA() << "[" << CS() << "] ) {\n"; + " switch ( " << EA() << "[" << vCS() << "] ) {\n"; EOF_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n"; diff --git a/ragel/cdfgoto.cpp b/ragel/cdfgoto.cpp index 7474533..3b229de 100644 --- a/ragel/cdfgoto.cpp +++ b/ragel/cdfgoto.cpp @@ -199,7 +199,7 @@ void FGotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -207,7 +207,7 @@ void FGotoCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " switch ( " << FSA() << "[" << CS() << "] ) {\n"; + " switch ( " << FSA() << "[" << vCS() << "] ) {\n"; FROM_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -215,7 +215,7 @@ void FGotoCodeGen::writeExec() } out << - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; STATE_GOTOS(); SWITCH_DEFAULT() << " }\n" @@ -230,7 +230,7 @@ void FGotoCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " switch ( " << TSA() << "[" << CS() << "] ) {\n"; + " switch ( " << TSA() << "[" << vCS() << "] ) {\n"; TO_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -240,7 +240,7 @@ void FGotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -260,12 +260,12 @@ void FGotoCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) { if ( st->eofTrans != 0 ) @@ -278,7 +278,7 @@ void FGotoCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << - " switch ( " << EA() << "[" << CS() << "] ) {\n"; + " switch ( " << EA() << "[" << vCS() << "] ) {\n"; EOF_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n"; diff --git a/ragel/cdflat.cpp b/ragel/cdflat.cpp index f171277..7fa2a9d 100644 --- a/ragel/cdflat.cpp +++ b/ragel/cdflat.cpp @@ -442,10 +442,10 @@ std::ostream &FlatCodeGen::TRANS_ACTIONS() void FlatCodeGen::LOCATE_TRANS() { out << - " _keys = " << ARR_OFF( K(), "(" + CS() + "<<1)" ) << ";\n" - " _inds = " << ARR_OFF( I(), IO() + "[" + CS() + "]" ) << ";\n" + " _keys = " << ARR_OFF( K(), "(" + vCS() + "<<1)" ) << ";\n" + " _inds = " << ARR_OFF( I(), IO() + "[" + vCS() + "]" ) << ";\n" "\n" - " _slen = " << SP() << "[" << CS() << "];\n" + " _slen = " << SP() << "[" << vCS() << "];\n" " _trans = _inds[ _slen > 0 && _keys[0] <=" << GET_WIDE_KEY() << " &&\n" " " << GET_WIDE_KEY() << " <= _keys[1] ?\n" " " << GET_WIDE_KEY() << " - _keys[0] : _slen ];\n" @@ -454,13 +454,13 @@ void FlatCodeGen::LOCATE_TRANS() void FlatCodeGen::GOTO( ostream &ret, int gotoDest, bool inFinish ) { - ret << "{" << CS() << " = " << gotoDest << "; " << + ret << "{" << vCS() << " = " << gotoDest << "; " << CTRL_FLOW() << "goto _again;}"; } void FlatCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << CS() << " = ("; + ret << "{" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); ret << "); " << CTRL_FLOW() << "goto _again;}"; } @@ -472,17 +472,17 @@ void FlatCodeGen::CURS( ostream &ret, bool inFinish ) void FlatCodeGen::TARGS( ostream &ret, bool inFinish, int targState ) { - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; } void FlatCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void FlatCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); ret << ");"; } @@ -494,7 +494,7 @@ void FlatCodeGen::CALL( ostream &ret, int callDest, int targState, bool inFinish INLINE_LIST( ret, prePushExpr, 0, false, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " << + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << callDest << "; " << CTRL_FLOW() << "goto _again;}"; if ( prePushExpr != 0 ) @@ -509,7 +509,7 @@ void FlatCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, INLINE_LIST( ret, prePushExpr, 0, false, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = ("; + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, targState, inFinish, false ); ret << "); " << CTRL_FLOW() << "goto _again;}"; @@ -520,7 +520,7 @@ void FlatCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, void FlatCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];"; + ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];"; if ( postPopExpr != 0 ) { ret << "{"; @@ -639,10 +639,10 @@ void FlatCodeGen::COND_TRANSLATE() " _widec = " << GET_KEY() << ";\n"; out << - " _keys = " << ARR_OFF( CK(), "(" + CS() + "<<1)" ) << ";\n" - " _conds = " << ARR_OFF( C(), CO() + "[" + CS() + "]" ) << ";\n" + " _keys = " << ARR_OFF( CK(), "(" + vCS() + "<<1)" ) << ";\n" + " _conds = " << ARR_OFF( C(), CO() + "[" + vCS() + "]" ) << ";\n" "\n" - " _slen = " << CSP() << "[" << CS() << "];\n" + " _slen = " << CSP() << "[" << vCS() << "];\n" " _cond = _slen > 0 && _keys[0] <=" << GET_WIDE_KEY() << " &&\n" " " << GET_WIDE_KEY() << " <= _keys[1] ?\n" " _conds[" << GET_WIDE_KEY() << " - _keys[0]] : 0;\n" @@ -724,7 +724,7 @@ void FlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -732,7 +732,7 @@ void FlatCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << ARR_OFF( A(), FSA() + "[" + CS() + "]" ) << ";\n" + " _acts = " << ARR_OFF( A(), FSA() + "[" + vCS() + "]" ) << ";\n" " _nacts = " << CAST(UINT()) << " *_acts++;\n" " while ( _nacts-- > 0 ) {\n" " switch ( *_acts++ ) {\n"; @@ -752,10 +752,10 @@ void FlatCodeGen::writeExec() out << "_eof_trans:\n"; if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n" + " " << vCS() << " = " << TT() << "[_trans];\n" "\n"; if ( redFsm->anyRegActions() ) { @@ -780,7 +780,7 @@ void FlatCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << ARR_OFF( A(), TSA() + "[" + CS() + "]" ) << ";\n" + " _acts = " << ARR_OFF( A(), TSA() + "[" + vCS() + "]" ) << ";\n" " _nacts = " << CAST(UINT()) << " *_acts++;\n" " while ( _nacts-- > 0 ) {\n" " switch ( *_acts++ ) {\n"; @@ -794,7 +794,7 @@ void FlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -814,13 +814,13 @@ void FlatCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " if ( " << ET() << "[" << CS() << "] > 0 ) {\n" - " _trans = " << ET() << "[" << CS() << "] - 1;\n" + " if ( " << ET() << "[" << vCS() << "] > 0 ) {\n" + " _trans = " << ET() << "[" << vCS() << "] - 1;\n" " goto _eof_trans;\n" " }\n"; } @@ -829,7 +829,7 @@ void FlatCodeGen::writeExec() out << " " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << POINTER() << "__acts = " << - ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n" + ARR_OFF( A(), EA() + "[" + vCS() + "]" ) << ";\n" " " << UINT() << " __nacts = " << CAST(UINT()) << " *__acts++;\n" " while ( __nacts-- > 0 ) {\n" " switch ( *__acts++ ) {\n"; diff --git a/ragel/cdftable.cpp b/ragel/cdftable.cpp index f21c781..cb5a4ff 100644 --- a/ragel/cdftable.cpp +++ b/ragel/cdftable.cpp @@ -322,7 +322,7 @@ void FTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -330,7 +330,7 @@ void FTabCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " switch ( " << FSA() << "[" << CS() << "] ) {\n"; + " switch ( " << FSA() << "[" << vCS() << "] ) {\n"; FROM_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -351,10 +351,10 @@ void FTabCodeGen::writeExec() out << "_eof_trans:\n"; if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n" + " " << vCS() << " = " << TT() << "[_trans];\n" "\n"; if ( redFsm->anyRegActions() ) { @@ -375,7 +375,7 @@ void FTabCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " switch ( " << TSA() << "[" << CS() << "] ) {\n"; + " switch ( " << TSA() << "[" << vCS() << "] ) {\n"; TO_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -385,7 +385,7 @@ void FTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -405,20 +405,20 @@ void FTabCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " if ( " << ET() << "[" << CS() << "] > 0 ) {\n" - " _trans = " << ET() << "[" << CS() << "] - 1;\n" + " if ( " << ET() << "[" << vCS() << "] > 0 ) {\n" + " _trans = " << ET() << "[" << vCS() << "] - 1;\n" " goto _eof_trans;\n" " }\n"; } if ( redFsm->anyEofActions() ) { out << - " switch ( " << EA() << "[" << CS() << "] ) {\n"; + " switch ( " << EA() << "[" << vCS() << "] ) {\n"; EOF_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n"; diff --git a/ragel/cdgoto.cpp b/ragel/cdgoto.cpp index a54ae0f..d6f6bdf 100644 --- a/ragel/cdgoto.cpp +++ b/ragel/cdgoto.cpp @@ -386,8 +386,8 @@ std::ostream &GotoCodeGen::TRANSITIONS() /* Destination state. */ if ( trans->action != 0 && trans->action->anyCurStateRef() ) - out << "_ps = " << CS() << ";"; - out << CS() << " = " << trans->targ->id << "; "; + out << "_ps = " << vCS() << ";"; + out << vCS() << " = " << trans->targ->id << "; "; if ( trans->action != 0 ) { /* Write out the transition func. */ @@ -543,13 +543,13 @@ std::ostream &GotoCodeGen::FINISH_CASES() void GotoCodeGen::GOTO( ostream &ret, int gotoDest, bool inFinish ) { - ret << "{" << CS() << " = " << gotoDest << "; " << + ret << "{" << vCS() << " = " << gotoDest << "; " << CTRL_FLOW() << "goto _again;}"; } void GotoCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << CS() << " = ("; + ret << "{" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); ret << "); " << CTRL_FLOW() << "goto _again;}"; } @@ -561,17 +561,17 @@ void GotoCodeGen::CURS( ostream &ret, bool inFinish ) void GotoCodeGen::TARGS( ostream &ret, bool inFinish, int targState ) { - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; } void GotoCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void GotoCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); ret << ");"; } @@ -583,7 +583,7 @@ void GotoCodeGen::CALL( ostream &ret, int callDest, int targState, bool inFinish INLINE_LIST( ret, prePushExpr, 0, false, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " << + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << callDest << "; " << CTRL_FLOW() << "goto _again;}"; if ( prePushExpr != 0 ) @@ -597,7 +597,7 @@ void GotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, INLINE_LIST( ret, prePushExpr, 0, false, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = ("; + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, targState, inFinish, false ); ret << "); " << CTRL_FLOW() << "goto _again;}"; @@ -607,7 +607,7 @@ void GotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, void GotoCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];"; + ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];"; if ( postPopExpr != 0 ) { ret << "{"; @@ -690,7 +690,7 @@ void GotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -698,7 +698,7 @@ void GotoCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << ARR_OFF( A(), FSA() + "[" + CS() + "]" ) << ";\n" + " _acts = " << ARR_OFF( A(), FSA() + "[" + vCS() + "]" ) << ";\n" " _nacts = " << CAST(UINT()) << " *_acts++;\n" " while ( _nacts-- > 0 ) {\n" " switch ( *_acts++ ) {\n"; @@ -710,7 +710,7 @@ void GotoCodeGen::writeExec() } out << - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; STATE_GOTOS(); SWITCH_DEFAULT() << " }\n" @@ -725,7 +725,7 @@ void GotoCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << ARR_OFF( A(), TSA() + "[" + CS() + "]" ) << ";\n" + " _acts = " << ARR_OFF( A(), TSA() + "[" + vCS() + "]" ) << ";\n" " _nacts = " << CAST(UINT()) << " *_acts++;\n" " while ( _nacts-- > 0 ) {\n" " switch ( *_acts++ ) {\n"; @@ -739,7 +739,7 @@ void GotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -759,12 +759,12 @@ void GotoCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) { if ( st->eofTrans != 0 ) @@ -779,7 +779,7 @@ void GotoCodeGen::writeExec() out << " " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << POINTER() << "__acts = " << - ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n" + ARR_OFF( A(), EA() + "[" + vCS() + "]" ) << ";\n" " " << UINT() << " __nacts = " << CAST(UINT()) << " *__acts++;\n" " while ( __nacts-- > 0 ) {\n" " switch ( *__acts++ ) {\n"; diff --git a/ragel/cdipgoto.cpp b/ragel/cdipgoto.cpp index d44c240..298bf36 100644 --- a/ragel/cdipgoto.cpp +++ b/ragel/cdipgoto.cpp @@ -60,7 +60,7 @@ void IpGotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targStat INLINE_LIST( ret, prePushExpr, 0, false, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << targState << "; " << CS() << " = ("; + ret << "{" << STACK() << "[" << TOP() << "++] = " << targState << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); ret << "); " << CTRL_FLOW() << "goto _again;}"; @@ -70,7 +70,7 @@ void IpGotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targStat void IpGotoCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];"; + ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];"; if ( postPopExpr != 0 ) { ret << "{"; @@ -83,19 +83,19 @@ void IpGotoCodeGen::RET( ostream &ret, bool inFinish ) void IpGotoCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << CS() << " = ("; + ret << "{" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); ret << "); " << CTRL_FLOW() << "goto _again;}"; } void IpGotoCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void IpGotoCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); ret << ");"; } @@ -115,7 +115,7 @@ void IpGotoCodeGen::BREAK( ostream &ret, int targState, bool csForced ) outLabelUsed = true; ret << "{" << P() << "++; "; if ( !csForced ) - ret << CS() << " = " << targState << "; "; + ret << vCS() << " = " << targState << "; "; ret << CTRL_FLOW() << "goto _out;}"; } @@ -137,7 +137,7 @@ bool IpGotoCodeGen::IN_TRANS_ACTIONS( RedStateAp *state ) /* If the action contains a next, then we must preload the current * state since the action may or may not set it. */ if ( trans->action->anyNextStmt() ) - out << " " << CS() << " = " << trans->targ->id << ";\n"; + out << " " << vCS() << " = " << trans->targ->id << ";\n"; /* Write each action in the list. */ for ( GenActionTable::Iter item = trans->action->key; item.lte(); item++ ) { @@ -224,7 +224,7 @@ void IpGotoCodeGen::STATE_GOTO_ERROR() /* Break out here. */ outLabelUsed = true; - out << CS() << " = " << state->id << ";\n"; + out << vCS() << " = " << state->id << ";\n"; out << " goto _out;\n"; } @@ -248,7 +248,7 @@ std::ostream &IpGotoCodeGen::EXIT_STATES() for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) { if ( st->outNeeded ) { testEofUsed = true; - out << " _test_eof" << st->id << ": " << CS() << " = " << + out << " _test_eof" << st->id << ": " << vCS() << " = " << st->id << "; goto _test_eof; \n"; } } @@ -393,7 +393,7 @@ void IpGotoCodeGen::writeExec() " goto _resume;\n" "\n" "_again:\n" - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; AGAIN_CASES() << " default: break;\n" " }\n" @@ -414,7 +414,7 @@ void IpGotoCodeGen::writeExec() } out << - " switch ( " << CS() << " )\n {\n"; + " switch ( " << vCS() << " )\n {\n"; STATE_GOTOS(); SWITCH_DEFAULT() << " }\n"; @@ -426,9 +426,9 @@ void IpGotoCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n" - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; FINISH_CASES(); SWITCH_DEFAULT() << " }\n" diff --git a/ragel/cdsplit.cpp b/ragel/cdsplit.cpp index 443e761..f494b73 100644 --- a/ragel/cdsplit.cpp +++ b/ragel/cdsplit.cpp @@ -155,7 +155,7 @@ std::ostream &SplitCodeGen::PART_TRANS( int partition ) /* If the action contains a next, then we must preload the current * state since the action may or may not set it. */ if ( trans->action->anyNextStmt() ) - out << " " << CS() << " = " << trans->targ->id << ";\n"; + out << " " << vCS() << " = " << trans->targ->id << ";\n"; /* Write each action in the list. */ for ( GenActionTable::Iter item = trans->action->key; item.lte(); item++ ) { @@ -174,7 +174,7 @@ std::ostream &SplitCodeGen::PART_TRANS( int partition ) if ( st->partitionBoundary ) { out << " pst" << st->id << ":\n" - " " << CS() << " = " << st->id << ";\n"; + " " << vCS() << " = " << st->id << ";\n"; if ( st->toStateAction != 0 ) { /* Remember that we wrote an action. Write every action in the list. */ @@ -197,7 +197,7 @@ std::ostream &SplitCodeGen::EXIT_STATES( int partition ) for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) { if ( st->partition == partition && st->outNeeded ) { outLabelUsed = true; - out << " _out" << st->id << ": " << CS() << " = " << + out << " _out" << st->id << ": " << vCS() << " = " << st->id << "; goto _out; \n"; } } @@ -230,7 +230,7 @@ std::ostream &SplitCodeGen::PARTITION( int partition ) " goto _resume;\n" "\n" "_again:\n" - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; AGAIN_CASES() << " default: break;\n" " }\n" @@ -254,7 +254,7 @@ std::ostream &SplitCodeGen::PARTITION( int partition ) } out << - " switch ( " << CS() << " )\n {\n"; + " switch ( " << vCS() << " )\n {\n"; STATE_GOTOS( partition ); SWITCH_DEFAULT() << " }\n"; @@ -413,7 +413,7 @@ void SplitCodeGen::writeExec() out << "_resume:\n"; out << - " switch ( " << PM() << "[" << CS() << "] ) {\n"; + " switch ( " << PM() << "[" << vCS() << "] ) {\n"; for ( int p = 0; p < redFsm->nParts; p++ ) { out << " case " << p << ":\n" diff --git a/ragel/cdtable.cpp b/ragel/cdtable.cpp index 4b455bc..827d3ad 100644 --- a/ragel/cdtable.cpp +++ b/ragel/cdtable.cpp @@ -614,10 +614,10 @@ std::ostream &TabCodeGen::TRANS_ACTIONS_WI() void TabCodeGen::LOCATE_TRANS() { out << - " _keys = " << ARR_OFF( K(), KO() + "[" + CS() + "]" ) << ";\n" - " _trans = " << IO() << "[" << CS() << "];\n" + " _keys = " << ARR_OFF( K(), KO() + "[" + vCS() + "]" ) << ";\n" + " _trans = " << IO() << "[" << vCS() << "];\n" "\n" - " _klen = " << SL() << "[" << CS() << "];\n" + " _klen = " << SL() << "[" << vCS() << "];\n" " if ( _klen > 0 ) {\n" " " << PTR_CONST() << WIDE_ALPH_TYPE() << POINTER() << "_lower = _keys;\n" " " << PTR_CONST() << WIDE_ALPH_TYPE() << POINTER() << "_mid;\n" @@ -640,7 +640,7 @@ void TabCodeGen::LOCATE_TRANS() " _trans += _klen;\n" " }\n" "\n" - " _klen = " << RL() << "[" << CS() << "];\n" + " _klen = " << RL() << "[" << vCS() << "];\n" " if ( _klen > 0 ) {\n" " " << PTR_CONST() << WIDE_ALPH_TYPE() << POINTER() << "_lower = _keys;\n" " " << PTR_CONST() << WIDE_ALPH_TYPE() << POINTER() << "_mid;\n" @@ -666,13 +666,13 @@ void TabCodeGen::LOCATE_TRANS() void TabCodeGen::GOTO( ostream &ret, int gotoDest, bool inFinish ) { - ret << "{" << CS() << " = " << gotoDest << "; " << + ret << "{" << vCS() << " = " << gotoDest << "; " << CTRL_FLOW() << "goto _again;}"; } void TabCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << CS() << " = ("; + ret << "{" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); ret << "); " << CTRL_FLOW() << "goto _again;}"; } @@ -684,17 +684,17 @@ void TabCodeGen::CURS( ostream &ret, bool inFinish ) void TabCodeGen::TARGS( ostream &ret, bool inFinish, int targState ) { - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; } void TabCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void TabCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish, false ); ret << ");"; } @@ -706,7 +706,7 @@ void TabCodeGen::CALL( ostream &ret, int callDest, int targState, bool inFinish INLINE_LIST( ret, prePushExpr, 0, false, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " << + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << callDest << "; " << CTRL_FLOW() << "goto _again;}"; if ( prePushExpr != 0 ) @@ -720,7 +720,7 @@ void TabCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, INLINE_LIST( ret, prePushExpr, 0, false, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = ("; + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, targState, inFinish, false ); ret << "); " << CTRL_FLOW() << "goto _again;}"; @@ -730,7 +730,7 @@ void TabCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targState, void TabCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "{" << CS() << " = " << STACK() << "[--" << + ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "]; "; if ( postPopExpr != 0 ) { @@ -873,8 +873,8 @@ void TabCodeGen::COND_TRANSLATE() { out << " _widec = " << GET_KEY() << ";\n" - " _klen = " << CL() << "[" << CS() << "];\n" - " _keys = " << ARR_OFF( CK(), "(" + CO() + "[" + CS() + "]*2)" ) << ";\n" + " _klen = " << CL() << "[" << vCS() << "];\n" + " _keys = " << ARR_OFF( CK(), "(" + CO() + "[" + vCS() + "]*2)" ) << ";\n" " if ( _klen > 0 ) {\n" " " << PTR_CONST() << WIDE_ALPH_TYPE() << POINTER() << "_lower = _keys;\n" " " << PTR_CONST() << WIDE_ALPH_TYPE() << POINTER() << "_mid;\n" @@ -889,7 +889,7 @@ void TabCodeGen::COND_TRANSLATE() " else if ( " << GET_WIDE_KEY() << " > _mid[1] )\n" " _lower = _mid + 2;\n" " else {\n" - " switch ( " << C() << "[" << CO() << "[" << CS() << "]" + " switch ( " << C() << "[" << CO() << "[" << vCS() << "]" " + ((_mid - _keys)>>1)] ) {\n"; for ( CondSpaceList::Iter csi = condSpaceList; csi.lte(); csi++ ) { @@ -964,7 +964,7 @@ void TabCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -972,7 +972,7 @@ void TabCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << ARR_OFF( A(), FSA() + "[" + CS() + "]" ) << ";\n" + " _acts = " << ARR_OFF( A(), FSA() + "[" + vCS() + "]" ) << ";\n" " _nacts = " << CAST(UINT()) << " *_acts++;\n" " while ( _nacts-- > 0 ) {\n" " switch ( *_acts++ ) {\n"; @@ -997,10 +997,10 @@ void TabCodeGen::writeExec() out << "_eof_trans:\n"; if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n" + " " << vCS() << " = " << TT() << "[_trans];\n" "\n"; if ( redFsm->anyRegActions() ) { @@ -1025,7 +1025,7 @@ void TabCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << ARR_OFF( A(), TSA() + "[" + CS() + "]" ) << ";\n" + " _acts = " << ARR_OFF( A(), TSA() + "[" + vCS() + "]" ) << ";\n" " _nacts = " << CAST(UINT()) << " *_acts++;\n" " while ( _nacts-- > 0 ) {\n" " switch ( *_acts++ ) {\n"; @@ -1039,7 +1039,7 @@ void TabCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -1059,13 +1059,13 @@ void TabCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " if ( " << ET() << "[" << CS() << "] > 0 ) {\n" - " _trans = " << ET() << "[" << CS() << "] - 1;\n" + " if ( " << ET() << "[" << vCS() << "] > 0 ) {\n" + " _trans = " << ET() << "[" << vCS() << "] - 1;\n" " goto _eof_trans;\n" " }\n"; } @@ -1074,7 +1074,7 @@ void TabCodeGen::writeExec() out << " " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << POINTER() << "__acts = " << - ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n" + ARR_OFF( A(), EA() + "[" + vCS() + "]" ) << ";\n" " " << UINT() << " __nacts = " << CAST(UINT()) << " *__acts++;\n" " while ( __nacts-- > 0 ) {\n" " switch ( *__acts++ ) {\n"; diff --git a/ragel/cscodegen.cpp b/ragel/cscodegen.cpp index 5527236..fe1c64a 100644 --- a/ragel/cscodegen.cpp +++ b/ragel/cscodegen.cpp @@ -188,7 +188,7 @@ string CSharpFsmCodeGen::PE() return ret.str(); } -string CSharpFsmCodeGen::EOFV() +string CSharpFsmCodeGen::vEOF() { ostringstream ret; if ( eofExpr == 0 ) @@ -201,7 +201,7 @@ string CSharpFsmCodeGen::EOFV() return ret.str(); } -string CSharpFsmCodeGen::CS() +string CSharpFsmCodeGen::vCS() { ostringstream ret; if ( csExpr == 0 ) @@ -567,7 +567,7 @@ void CSharpFsmCodeGen::writeInit() out << " {\n"; if ( !noCS ) - out << "\t" << CS() << " = " << START() << ";\n"; + out << "\t" << vCS() << " = " << START() << ";\n"; /* If there are any calls, then the stack top needs initialization. */ if ( redFsm->anyActionCalls() || redFsm->anyActionRets() ) diff --git a/ragel/cscodegen.h b/ragel/cscodegen.h index bcc2653..0471ea9 100644 --- a/ragel/cscodegen.h +++ b/ragel/cscodegen.h @@ -92,10 +92,10 @@ protected: string P(); string PE(); - string EOFV(); + string vEOF(); string ACCESS(); - string CS(); + string vCS(); string STACK(); string TOP(); string TOKSTART(); diff --git a/ragel/csfflat.cpp b/ragel/csfflat.cpp index 0b9778a..f504eb2 100644 --- a/ragel/csfflat.cpp +++ b/ragel/csfflat.cpp @@ -280,7 +280,7 @@ void CSharpFFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -288,7 +288,7 @@ void CSharpFFlatCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " switch ( " << FSA() << "[" << CS() << "] ) {\n"; + " switch ( " << FSA() << "[" << vCS() << "] ) {\n"; FROM_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -304,10 +304,10 @@ void CSharpFFlatCodeGen::writeExec() out << "_eof_trans:\n"; if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n\n"; + " " << vCS() << " = " << TT() << "[_trans];\n\n"; if ( redFsm->anyRegActions() ) { out << @@ -327,7 +327,7 @@ void CSharpFFlatCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " switch ( " << TSA() << "[" << CS() << "] ) {\n"; + " switch ( " << TSA() << "[" << vCS() << "] ) {\n"; TO_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -337,7 +337,7 @@ void CSharpFFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -357,21 +357,21 @@ void CSharpFFlatCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " if ( " << ET() << "[" << CS() << "] > 0 ) {\n" + " if ( " << ET() << "[" << vCS() << "] > 0 ) {\n" " _trans = " << CAST(transType) << " (" << ET() << - "[" << CS() << "] - 1);\n" + "[" << vCS() << "] - 1);\n" " goto _eof_trans;\n" " }\n"; } if ( redFsm->anyEofActions() ) { out << - " switch ( " << EA() << "[" << CS() << "] ) {\n"; + " switch ( " << EA() << "[" << vCS() << "] ) {\n"; EOF_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n"; diff --git a/ragel/csfgoto.cpp b/ragel/csfgoto.cpp index 0f9cee6..5a26424 100644 --- a/ragel/csfgoto.cpp +++ b/ragel/csfgoto.cpp @@ -199,7 +199,7 @@ void CSharpFGotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -207,7 +207,7 @@ void CSharpFGotoCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " switch ( " << FSA() << "[" << CS() << "] ) {\n"; + " switch ( " << FSA() << "[" << vCS() << "] ) {\n"; FROM_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -215,7 +215,7 @@ void CSharpFGotoCodeGen::writeExec() } out << - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; STATE_GOTOS(); SWITCH_DEFAULT() << " }\n" @@ -230,7 +230,7 @@ void CSharpFGotoCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " switch ( " << TSA() << "[" << CS() << "] ) {\n"; + " switch ( " << TSA() << "[" << vCS() << "] ) {\n"; TO_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -240,7 +240,7 @@ void CSharpFGotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -260,12 +260,12 @@ void CSharpFGotoCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) { if ( st->eofTrans != 0 ) @@ -278,7 +278,7 @@ void CSharpFGotoCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << - " switch ( " << EA() << "[" << CS() << "] ) {\n"; + " switch ( " << EA() << "[" << vCS() << "] ) {\n"; EOF_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n"; diff --git a/ragel/csflat.cpp b/ragel/csflat.cpp index dc64cdd..3762839 100644 --- a/ragel/csflat.cpp +++ b/ragel/csflat.cpp @@ -442,10 +442,10 @@ std::ostream &CSharpFlatCodeGen::TRANS_ACTIONS() void CSharpFlatCodeGen::LOCATE_TRANS() { out << - " _keys = " << CS() << "<<1;\n" - " _inds = " << IO() << "[" << CS() << "];\n" + " _keys = " << vCS() << "<<1;\n" + " _inds = " << IO() << "[" << vCS() << "];\n" "\n" - " _slen = " << SP() << "[" << CS() << "];\n" + " _slen = " << SP() << "[" << vCS() << "];\n" " _trans = " << I() << "[_inds + (\n" " _slen > 0 && " << K() << "[_keys] <=" << GET_WIDE_KEY() << " &&\n" " " << GET_WIDE_KEY() << " <= " << K() <<"[_keys+1] ?\n" @@ -455,13 +455,13 @@ void CSharpFlatCodeGen::LOCATE_TRANS() void CSharpFlatCodeGen::GOTO( ostream &ret, int gotoDest, bool inFinish ) { - ret << "{" << CS() << " = " << gotoDest << "; " << + ret << "{" << vCS() << " = " << gotoDest << "; " << CTRL_FLOW() << "goto _again;}"; } void CSharpFlatCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << CS() << " = ("; + ret << "{" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << "); " << CTRL_FLOW() << "goto _again;}"; } @@ -473,17 +473,17 @@ void CSharpFlatCodeGen::CURS( ostream &ret, bool inFinish ) void CSharpFlatCodeGen::TARGS( ostream &ret, bool inFinish, int targState ) { - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; } void CSharpFlatCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void CSharpFlatCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << ");"; } @@ -495,7 +495,7 @@ void CSharpFlatCodeGen::CALL( ostream &ret, int callDest, int targState, bool in INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " << + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << callDest << "; " << CTRL_FLOW() << "goto _again;}"; if ( prePushExpr != 0 ) @@ -510,7 +510,7 @@ void CSharpFlatCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targ INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = ("; + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, targState, inFinish ); ret << "); " << CTRL_FLOW() << "goto _again;}"; @@ -521,7 +521,7 @@ void CSharpFlatCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targ void CSharpFlatCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];"; + ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];"; if ( postPopExpr != 0 ) { ret << "{"; @@ -640,12 +640,12 @@ void CSharpFlatCodeGen::COND_TRANSLATE() " _widec = " << GET_KEY() << ";\n"; out << - " _keys = " << CS() << "<<1;\n" - " _conds = " << CO() << "[" << CS() << "];\n" -// " _keys = " << ARR_OFF( CK(), "(" + CS() + "<<1)" ) << ";\n" -// " _conds = " << ARR_OFF( C(), CO() + "[" + CS() + "]" ) << ";\n" + " _keys = " << vCS() << "<<1;\n" + " _conds = " << CO() << "[" << vCS() << "];\n" +// " _keys = " << ARR_OFF( CK(), "(" + vCS() + "<<1)" ) << ";\n" +// " _conds = " << ARR_OFF( C(), CO() + "[" + vCS() + "]" ) << ";\n" "\n" - " _slen = " << CSP() << "[" << CS() << "];\n" + " _slen = " << CSP() << "[" << vCS() << "];\n" " if (_slen > 0 && " << CK() << "[_keys] <=" << GET_WIDE_KEY() << " &&\n" " " << GET_WIDE_KEY() << " <= " << CK() << "[_keys+1])\n" @@ -657,7 +657,7 @@ void CSharpFlatCodeGen::COND_TRANSLATE() /* XXX This version of the code doesn't work because Mono is weird. Works * fine in Microsoft's csc, even though the bug report filed claimed it * didn't. - " _slen = " << CSP() << "[" << CS() << "];\n" + " _slen = " << CSP() << "[" << vCS() << "];\n" " _cond = _slen > 0 && " << CK() << "[_keys] <=" << GET_WIDE_KEY() << " &&\n" " " << GET_WIDE_KEY() << " <= " << CK() << "[_keys+1] ?\n" @@ -745,7 +745,7 @@ void CSharpFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -753,7 +753,7 @@ void CSharpFlatCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << FSA() << "[" << CS() << "];\n" + " _acts = " << FSA() << "[" << vCS() << "];\n" " _nacts = " << A() << "[_acts++];\n" " while ( _nacts-- > 0 ) {\n" " switch ( " << A() << "[_acts++] ) {\n"; @@ -773,10 +773,10 @@ void CSharpFlatCodeGen::writeExec() out << "_eof_trans:\n"; if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n" + " " << vCS() << " = " << TT() << "[_trans];\n" "\n"; if ( redFsm->anyRegActions() ) { @@ -801,7 +801,7 @@ void CSharpFlatCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << TSA() << "[" << CS() << "];\n" + " _acts = " << TSA() << "[" << vCS() << "];\n" " _nacts = " << A() << "[_acts++];\n" " while ( _nacts-- > 0 ) {\n" " switch ( " << A() << "[_acts++] ) {\n"; @@ -815,7 +815,7 @@ void CSharpFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -835,14 +835,14 @@ void CSharpFlatCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " if ( " << ET() << "[" << CS() << "] > 0 ) {\n" + " if ( " << ET() << "[" << vCS() << "] > 0 ) {\n" " _trans = " << CAST(transType) << " (" << ET() << - "[" << CS() << "] - 1);\n" + "[" << vCS() << "] - 1);\n" " goto _eof_trans;\n" " }\n"; } @@ -851,7 +851,7 @@ void CSharpFlatCodeGen::writeExec() out << " " << PTR_CONST() << ARRAY_TYPE(redFsm->maxActArrItem) << POINTER() << "__acts = " << - EA() << "[" << CS() << "];\n" + EA() << "[" << vCS() << "];\n" " " << UINT() << " __nacts = " << CAST(UINT()) << " " << A() << "[__acts++];\n" " while ( __nacts-- > 0 ) {\n" diff --git a/ragel/csftable.cpp b/ragel/csftable.cpp index 32dc19d..44378e8 100644 --- a/ragel/csftable.cpp +++ b/ragel/csftable.cpp @@ -323,7 +323,7 @@ void CSharpFTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -331,7 +331,7 @@ void CSharpFTabCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " switch ( " << FSA() << "[" << CS() << "] ) {\n"; + " switch ( " << FSA() << "[" << vCS() << "] ) {\n"; FROM_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -352,10 +352,10 @@ void CSharpFTabCodeGen::writeExec() out << "_eof_trans:\n"; if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n" + " " << vCS() << " = " << TT() << "[_trans];\n" "\n"; if ( redFsm->anyRegActions() ) { @@ -376,7 +376,7 @@ void CSharpFTabCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " switch ( " << TSA() << "[" << CS() << "] ) {\n"; + " switch ( " << TSA() << "[" << vCS() << "] ) {\n"; TO_STATE_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n" @@ -386,7 +386,7 @@ void CSharpFTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -406,21 +406,21 @@ void CSharpFTabCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " if ( " << ET() << "[" << CS() << "] > 0 ) {\n" + " if ( " << ET() << "[" << vCS() << "] > 0 ) {\n" " _trans = " << CAST(transType) << " (" << ET() << - "[" << CS() << "] - 1);\n" + "[" << vCS() << "] - 1);\n" " goto _eof_trans;\n" " }\n"; } if ( redFsm->anyEofActions() ) { out << - " switch ( " << EA() << "[" << CS() << "] ) {\n"; + " switch ( " << EA() << "[" << vCS() << "] ) {\n"; EOF_ACTION_SWITCH(); SWITCH_DEFAULT() << " }\n"; diff --git a/ragel/csgoto.cpp b/ragel/csgoto.cpp index 9f695db..4bb2ec1 100644 --- a/ragel/csgoto.cpp +++ b/ragel/csgoto.cpp @@ -386,8 +386,8 @@ std::ostream &CSharpGotoCodeGen::TRANSITIONS() /* Destination state. */ if ( trans->action != 0 && trans->action->anyCurStateRef() ) - out << "_ps = " << CS() << ";"; - out << CS() << " = " << trans->targ->id << "; "; + out << "_ps = " << vCS() << ";"; + out << vCS() << " = " << trans->targ->id << "; "; if ( trans->action != 0 ) { /* Write out the transition func. */ @@ -543,13 +543,13 @@ std::ostream &CSharpGotoCodeGen::FINISH_CASES() void CSharpGotoCodeGen::GOTO( ostream &ret, int gotoDest, bool inFinish ) { - ret << "{" << CS() << " = " << gotoDest << "; " << + ret << "{" << vCS() << " = " << gotoDest << "; " << CTRL_FLOW() << "goto _again;}"; } void CSharpGotoCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << CS() << " = ("; + ret << "{" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << "); " << CTRL_FLOW() << "goto _again;}"; } @@ -561,17 +561,17 @@ void CSharpGotoCodeGen::CURS( ostream &ret, bool inFinish ) void CSharpGotoCodeGen::TARGS( ostream &ret, bool inFinish, int targState ) { - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; } void CSharpGotoCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void CSharpGotoCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << ");"; } @@ -583,7 +583,7 @@ void CSharpGotoCodeGen::CALL( ostream &ret, int callDest, int targState, bool in INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " << + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << callDest << "; " << CTRL_FLOW() << "goto _again;}"; if ( prePushExpr != 0 ) @@ -597,7 +597,7 @@ void CSharpGotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targ INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = ("; + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, targState, inFinish ); ret << "); " << CTRL_FLOW() << "goto _again;}"; @@ -607,7 +607,7 @@ void CSharpGotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targ void CSharpGotoCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];"; + ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];"; if ( postPopExpr != 0 ) { ret << "{"; @@ -690,7 +690,7 @@ void CSharpGotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -698,7 +698,7 @@ void CSharpGotoCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << FSA() << "[" << CS() << "];\n" + " _acts = " << FSA() << "[" << vCS() << "];\n" " _nacts = " << A() << "[_acts++];\n" " while ( _nacts-- > 0 ) {\n" " switch ( " << A() << "[_acts++] ) {\n"; @@ -710,7 +710,7 @@ void CSharpGotoCodeGen::writeExec() } out << - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; STATE_GOTOS(); SWITCH_DEFAULT() << " }\n" @@ -725,7 +725,7 @@ void CSharpGotoCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << TSA() << "[" << CS() << "];\n" + " _acts = " << TSA() << "[" << vCS() << "];\n" " _nacts = " << A() << "[_acts++];\n" " while ( _nacts-- > 0 ) {\n" " switch ( " << A() << "[_acts++] ) {\n"; @@ -739,7 +739,7 @@ void CSharpGotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -759,12 +759,12 @@ void CSharpGotoCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) { if ( st->eofTrans != 0 ) @@ -778,7 +778,7 @@ void CSharpGotoCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << " " << ARRAY_TYPE(redFsm->maxActionLoc) << " __acts = " << - EA() << "[" << CS() << "];\n" + EA() << "[" << vCS() << "];\n" " " << ARRAY_TYPE(redFsm->maxActArrItem) << " __nacts = " << A() << "[__acts++];\n" " while ( __nacts-- > 0 ) {\n" diff --git a/ragel/csipgoto.cpp b/ragel/csipgoto.cpp index 26d3cd4..0e3168a 100644 --- a/ragel/csipgoto.cpp +++ b/ragel/csipgoto.cpp @@ -60,7 +60,7 @@ void CSharpIpGotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int ta INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << targState << "; " << CS() << " = ("; + ret << "{" << STACK() << "[" << TOP() << "++] = " << targState << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << "); " << CTRL_FLOW() << "goto _again;}"; @@ -70,7 +70,7 @@ void CSharpIpGotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int ta void CSharpIpGotoCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];"; + ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];"; if ( postPopExpr != 0 ) { ret << "{"; @@ -83,19 +83,19 @@ void CSharpIpGotoCodeGen::RET( ostream &ret, bool inFinish ) void CSharpIpGotoCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << CS() << " = ("; + ret << "{" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << "); " << CTRL_FLOW() << "goto _again;}"; } void CSharpIpGotoCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void CSharpIpGotoCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << ");"; } @@ -115,7 +115,7 @@ void CSharpIpGotoCodeGen::BREAK( ostream &ret, int targState ) /* FIXME: If this code generator is made active then BREAK generation * needs to check csForced. */ outLabelUsed = true; - ret << "{" << P() << "++; " << CS() << " = " << targState << + ret << "{" << P() << "++; " << vCS() << " = " << targState << "; " << CTRL_FLOW() << "goto _out;}"; } @@ -137,7 +137,7 @@ bool CSharpIpGotoCodeGen::IN_TRANS_ACTIONS( RedStateAp *state ) /* If the action contains a next, then we must preload the current * state since the action may or may not set it. */ if ( trans->action->anyNextStmt() ) - out << " " << CS() << " = " << trans->targ->id << ";\n"; + out << " " << vCS() << " = " << trans->targ->id << ";\n"; /* Write each action in the list. */ for ( GenActionTable::Iter item = trans->action->key; item.lte(); item++ ) @@ -218,7 +218,7 @@ void CSharpIpGotoCodeGen::STATE_GOTO_ERROR() /* Break out here. */ outLabelUsed = true; - out << CS() << " = " << state->id << ";\n"; + out << vCS() << " = " << state->id << ";\n"; out << " goto _out;\n"; } @@ -242,7 +242,7 @@ std::ostream &CSharpIpGotoCodeGen::EXIT_STATES() for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) { if ( st->outNeeded ) { testEofUsed = true; - out << " _test_eof" << st->id << ": " << CS() << " = " << + out << " _test_eof" << st->id << ": " << vCS() << " = " << st->id << "; goto _test_eof; \n"; } } @@ -387,7 +387,7 @@ void CSharpIpGotoCodeGen::writeExec() " goto _resume;\n" "\n" "_again:\n" - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; AGAIN_CASES() << " default: break;\n" " }\n" @@ -408,7 +408,7 @@ void CSharpIpGotoCodeGen::writeExec() } out << - " switch ( " << CS() << " )\n {\n"; + " switch ( " << vCS() << " )\n {\n"; STATE_GOTOS(); SWITCH_DEFAULT() << " }\n"; @@ -420,9 +420,9 @@ void CSharpIpGotoCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n" - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; FINISH_CASES(); SWITCH_DEFAULT() << " }\n" diff --git a/ragel/cssplit.cpp b/ragel/cssplit.cpp index c485b95..8c7464f 100644 --- a/ragel/cssplit.cpp +++ b/ragel/cssplit.cpp @@ -151,7 +151,7 @@ std::ostream &CSharpSplitCodeGen::PART_TRANS( int partition ) /* If the action contains a next, then we must preload the current * state since the action may or may not set it. */ if ( trans->action->anyNextStmt() ) - out << " " << CS() << " = " << trans->targ->id << ";\n"; + out << " " << vCS() << " = " << trans->targ->id << ";\n"; /* Write each action in the list. */ for ( GenActionTable::Iter item = trans->action->key; item.lte(); item++ ) @@ -168,7 +168,7 @@ std::ostream &CSharpSplitCodeGen::PART_TRANS( int partition ) if ( st->partitionBoundary ) { out << " pst" << st->id << ":\n" - " " << CS() << " = " << st->id << ";\n"; + " " << vCS() << " = " << st->id << ";\n"; if ( st->toStateAction != 0 ) { /* Remember that we wrote an action. Write every action in the list. */ @@ -189,7 +189,7 @@ std::ostream &CSharpSplitCodeGen::EXIT_STATES( int partition ) for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) { if ( st->partition == partition && st->outNeeded ) { outLabelUsed = true; - out << " _out" << st->id << ": " << CS() << " = " << + out << " _out" << st->id << ": " << vCS() << " = " << st->id << "; goto _out; \n"; } } @@ -222,7 +222,7 @@ std::ostream &CSharpSplitCodeGen::PARTITION( int partition ) " goto _resume;\n" "\n" "_again:\n" - " switch ( " << CS() << " ) {\n"; + " switch ( " << vCS() << " ) {\n"; AGAIN_CASES() << " default: break;\n" " }\n" @@ -246,7 +246,7 @@ std::ostream &CSharpSplitCodeGen::PARTITION( int partition ) } out << - " switch ( " << CS() << " )\n {\n"; + " switch ( " << vCS() << " )\n {\n"; STATE_GOTOS( partition ); SWITCH_DEFAULT() << " }\n"; @@ -405,7 +405,7 @@ void CSharpSplitCodeGen::writeExec() out << "_resume:\n"; out << - " switch ( " << PM() << "[" << CS() << "] ) {\n"; + " switch ( " << PM() << "[" << vCS() << "] ) {\n"; for ( int p = 0; p < redFsm->nParts; p++ ) { out << " case " << p << ":\n" diff --git a/ragel/cstable.cpp b/ragel/cstable.cpp index 1193be3..cde4ba9 100644 --- a/ragel/cstable.cpp +++ b/ragel/cstable.cpp @@ -610,13 +610,13 @@ std::ostream &CSharpTabCodeGen::TRANS_ACTIONS_WI() void CSharpTabCodeGen::GOTO( ostream &ret, int gotoDest, bool inFinish ) { - ret << "{" << CS() << " = " << gotoDest << "; " << + ret << "{" << vCS() << " = " << gotoDest << "; " << CTRL_FLOW() << "goto _again;}"; } void CSharpTabCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << CS() << " = ("; + ret << "{" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << "); " << CTRL_FLOW() << "goto _again;}"; } @@ -628,17 +628,17 @@ void CSharpTabCodeGen::CURS( ostream &ret, bool inFinish ) void CSharpTabCodeGen::TARGS( ostream &ret, bool inFinish, int targState ) { - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; } void CSharpTabCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void CSharpTabCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << ");"; } @@ -650,7 +650,7 @@ void CSharpTabCodeGen::CALL( ostream &ret, int callDest, int targState, bool inF INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " << + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << callDest << "; " << CTRL_FLOW() << "goto _again;}"; if ( prePushExpr != 0 ) @@ -664,7 +664,7 @@ void CSharpTabCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targS INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = ("; + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, targState, inFinish ); ret << "); " << CTRL_FLOW() << "goto _again;}"; @@ -674,7 +674,7 @@ void CSharpTabCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targS void CSharpTabCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "{" << CS() << " = " << STACK() << "[--" << + ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "]; "; if ( postPopExpr != 0 ) { @@ -816,10 +816,10 @@ void CSharpTabCodeGen::writeData() void CSharpTabCodeGen::LOCATE_TRANS() { out << - " _keys = " << KO() + "[" + CS() + "]" << ";\n" - " _trans = " << CAST(transType) << IO() << "[" << CS() << "];\n" + " _keys = " << KO() + "[" + vCS() + "]" << ";\n" + " _trans = " << CAST(transType) << IO() << "[" << vCS() << "];\n" "\n" - " _klen = " << SL() << "[" << CS() << "];\n" + " _klen = " << SL() << "[" << vCS() << "];\n" " if ( _klen > 0 ) {\n" " " << signedKeysType << " _lower = _keys;\n" " " << signedKeysType << " _mid;\n" @@ -844,7 +844,7 @@ void CSharpTabCodeGen::LOCATE_TRANS() " _trans += " << CAST(transType) << " _klen;\n" " }\n" "\n" - " _klen = " << RL() << "[" << CS() << "];\n" + " _klen = " << RL() << "[" << vCS() << "];\n" " if ( _klen > 0 ) {\n" " " << signedKeysType << " _lower = _keys;\n" " " << signedKeysType << " _mid;\n" @@ -874,8 +874,8 @@ void CSharpTabCodeGen::COND_TRANSLATE() { out << " _widec = " << GET_KEY() << ";\n" - " _klen = " << CL() << "[" << CS() << "];\n" - " _keys = " << CAST(keysType) << " ("<< CO() << "[" << CS() << "]*2);\n" + " _klen = " << CL() << "[" << vCS() << "];\n" + " _keys = " << CAST(keysType) << " ("<< CO() << "[" << vCS() << "]*2);\n" " if ( _klen > 0 ) {\n" " " << signedKeysType << " _lower = _keys;\n" " " << signedKeysType << " _mid;\n" @@ -892,7 +892,7 @@ void CSharpTabCodeGen::COND_TRANSLATE() " else if ( " << GET_WIDE_KEY() << " > " << CK() << "[_mid+1] )\n" " _lower = " << CAST(signedKeysType) << " (_mid + 2);\n" " else {\n" - " switch ( " << C() << "[" << CO() << "[" << CS() << "]" + " switch ( " << C() << "[" << CO() << "[" << vCS() << "]" " + ((_mid - _keys)>>1)] ) {\n"; for ( CondSpaceList::Iter csi = condSpaceList; csi.lte(); csi++ ) { @@ -968,7 +968,7 @@ void CSharpTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -976,7 +976,7 @@ void CSharpTabCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << FSA() << "[" + CS() + "]" << ";\n" + " _acts = " << FSA() << "[" + vCS() + "]" << ";\n" " _nacts = " << A() << "[_acts++];\n" " while ( _nacts-- > 0 ) {\n" " switch ( " << A() << "[_acts++] ) {\n"; @@ -1001,10 +1001,10 @@ void CSharpTabCodeGen::writeExec() out << "_eof_trans:\n"; if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n" + " " << vCS() << " = " << TT() << "[_trans];\n" "\n"; if ( redFsm->anyRegActions() ) { @@ -1029,7 +1029,7 @@ void CSharpTabCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << TSA() << "[" << CS() << "]" << ";\n" + " _acts = " << TSA() << "[" << vCS() << "]" << ";\n" " _nacts = " << A() << "[_acts++];\n" " while ( _nacts-- > 0 ) {\n" " switch ( " << A() << "[_acts++] ) {\n"; @@ -1043,7 +1043,7 @@ void CSharpTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n" " goto _out;\n"; } @@ -1063,14 +1063,14 @@ void CSharpTabCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " if ( " << ET() << "[" << CS() << "] > 0 ) {\n" + " if ( " << ET() << "[" << vCS() << "] > 0 ) {\n" " _trans = " << CAST(transType) << " (" << ET() << - "[" << CS() << "] - 1);\n" + "[" << vCS() << "] - 1);\n" " goto _eof_trans;\n" " }\n"; } @@ -1078,7 +1078,7 @@ void CSharpTabCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << " " << actsType << " __acts = " << - EA() << "[" << CS() << "]" << ";\n" + EA() << "[" << vCS() << "]" << ";\n" " " << nactsType << " __nacts = " << A() << "[__acts++];\n" " while ( __nacts-- > 0 ) {\n" diff --git a/ragel/javacodegen.cpp b/ragel/javacodegen.cpp index 1ae48a4..a04dc31 100644 --- a/ragel/javacodegen.cpp +++ b/ragel/javacodegen.cpp @@ -77,13 +77,13 @@ void JavaTabCodeGen::genLineDirective( ostream &out ) void JavaTabCodeGen::GOTO( ostream &ret, int gotoDest, bool inFinish ) { - ret << "{" << CS() << " = " << gotoDest << "; _goto_targ = " << _again << "; " << + ret << "{" << vCS() << " = " << gotoDest << "; _goto_targ = " << _again << "; " << CTRL_FLOW() << "continue _goto;}"; } void JavaTabCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "{" << CS() << " = ("; + ret << "{" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << "); _goto_targ = " << _again << "; " << CTRL_FLOW() << "continue _goto;}"; } @@ -95,7 +95,7 @@ void JavaTabCodeGen::CALL( ostream &ret, int callDest, int targState, bool inFin INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " << + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << callDest << "; _goto_targ = " << _again << "; " << CTRL_FLOW() << "continue _goto;}"; if ( prePushExpr != 0 ) @@ -109,7 +109,7 @@ void JavaTabCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targSta INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = ("; + ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, targState, inFinish ); ret << "); _goto_targ = " << _again << "; " << CTRL_FLOW() << "continue _goto;}"; @@ -119,7 +119,7 @@ void JavaTabCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targSta void JavaTabCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];"; + ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];"; if ( postPopExpr != 0 ) { ret << "{"; @@ -138,12 +138,12 @@ void JavaTabCodeGen::BREAK( ostream &ret, int targState ) void JavaTabCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void JavaTabCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << ");"; } @@ -196,7 +196,7 @@ void JavaTabCodeGen::INLINE_LIST( ostream &ret, GenInlineList *inlineList, ret << "(_ps)"; break; case GenInlineItem::Targs: - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; break; case GenInlineItem::Entry: ret << item->targState->id; @@ -285,8 +285,8 @@ void JavaTabCodeGen::COND_TRANSLATE() { out << " _widec = " << GET_KEY() << ";\n" - " _keys = " << CO() << "[" << CS() << "]*2\n;" - " _klen = " << CL() << "[" << CS() << "];\n" + " _keys = " << CO() << "[" << vCS() << "]*2\n;" + " _klen = " << CL() << "[" << vCS() << "];\n" " if ( _klen > 0 ) {\n" " int _lower = _keys\n;" " int _mid;\n" @@ -301,7 +301,7 @@ void JavaTabCodeGen::COND_TRANSLATE() " else if ( " << GET_WIDE_KEY() << " > " << CK() << "[_mid+1] )\n" " _lower = _mid + 2;\n" " else {\n" - " switch ( " << C() << "[" << CO() << "[" << CS() << "]" + " switch ( " << C() << "[" << CO() << "[" << vCS() << "]" " + ((_mid - _keys)>>1)] ) {\n" ; @@ -337,9 +337,9 @@ void JavaTabCodeGen::LOCATE_TRANS() { out << " _match: do {\n" - " _keys = " << KO() << "[" << CS() << "]" << ";\n" - " _trans = " << IO() << "[" << CS() << "];\n" - " _klen = " << SL() << "[" << CS() << "];\n" + " _keys = " << KO() << "[" << vCS() << "]" << ";\n" + " _trans = " << IO() << "[" << vCS() << "];\n" + " _klen = " << SL() << "[" << vCS() << "];\n" " if ( _klen > 0 ) {\n" " int _lower = _keys;\n" " int _mid;\n" @@ -362,7 +362,7 @@ void JavaTabCodeGen::LOCATE_TRANS() " _trans += _klen;\n" " }\n" "\n" - " _klen = " << RL() << "[" << CS() << "];\n" + " _klen = " << RL() << "[" << vCS() << "];\n" " if ( _klen > 0 ) {\n" " int _lower = _keys;\n" " int _mid;\n" @@ -1036,7 +1036,7 @@ void JavaTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if ( " << CS() << " == " << redFsm->errState->id << " ) {\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " ) {\n" " _goto_targ = " << _out << ";\n" " continue _goto;\n" " }\n"; @@ -1046,7 +1046,7 @@ void JavaTabCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << FSA() << "[" << CS() << "]" << ";\n" + " _acts = " << FSA() << "[" << vCS() << "]" << ";\n" " _nacts = " << CAST("int") << " " << A() << "[_acts++];\n" " while ( _nacts-- > 0 ) {\n" " switch ( " << A() << "[_acts++] ) {\n"; @@ -1068,10 +1068,10 @@ void JavaTabCodeGen::writeExec() out << "case " << _eof_trans << ":\n"; if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n" + " " << vCS() << " = " << TT() << "[_trans];\n" "\n"; if ( redFsm->anyRegActions() ) { @@ -1093,7 +1093,7 @@ void JavaTabCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << TSA() << "[" << CS() << "]" << ";\n" + " _acts = " << TSA() << "[" << vCS() << "]" << ";\n" " _nacts = " << CAST("int") << " " << A() << "[_acts++];\n" " while ( _nacts-- > 0 ) {\n" " switch ( " << A() << "[_acts++] ) {\n"; @@ -1105,7 +1105,7 @@ void JavaTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if ( " << CS() << " == " << redFsm->errState->id << " ) {\n" + " if ( " << vCS() << " == " << redFsm->errState->id << " ) {\n" " _goto_targ = " << _out << ";\n" " continue _goto;\n" " }\n"; @@ -1129,13 +1129,13 @@ void JavaTabCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if ( " << P() << " == " << EOFV() << " )\n" + " if ( " << P() << " == " << vEOF() << " )\n" " {\n"; if ( redFsm->anyEofTrans() ) { out << - " if ( " << ET() << "[" << CS() << "] > 0 ) {\n" - " _trans = " << ET() << "[" << CS() << "] - 1;\n" + " if ( " << ET() << "[" << vCS() << "] > 0 ) {\n" + " _trans = " << ET() << "[" << vCS() << "] - 1;\n" " _goto_targ = " << _eof_trans << ";\n" " continue _goto;\n" " }\n"; @@ -1143,7 +1143,7 @@ void JavaTabCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << - " int __acts = " << EA() << "[" << CS() << "]" << ";\n" + " int __acts = " << EA() << "[" << vCS() << "]" << ";\n" " int __nacts = " << CAST("int") << " " << A() << "[__acts++];\n" " while ( __nacts-- > 0 ) {\n" " switch ( " << A() << "[__acts++] ) {\n"; @@ -1363,7 +1363,7 @@ string JavaTabCodeGen::PE() return ret.str(); } -string JavaTabCodeGen::EOFV() +string JavaTabCodeGen::vEOF() { ostringstream ret; if ( eofExpr == 0 ) @@ -1376,7 +1376,7 @@ string JavaTabCodeGen::EOFV() return ret.str(); } -string JavaTabCodeGen::CS() +string JavaTabCodeGen::vCS() { ostringstream ret; if ( csExpr == 0 ) @@ -1626,7 +1626,7 @@ void JavaTabCodeGen::writeInit() out << " {\n"; if ( !noCS ) - out << "\t" << CS() << " = " << START() << ";\n"; + out << "\t" << vCS() << " = " << START() << ";\n"; /* If there are any calls, then the stack top needs initialization. */ if ( redFsm->anyActionCalls() || redFsm->anyActionRets() ) diff --git a/ragel/javacodegen.h b/ragel/javacodegen.h index 21bf739..06914c9 100644 --- a/ragel/javacodegen.h +++ b/ragel/javacodegen.h @@ -130,9 +130,9 @@ public: string P(); string PE(); - string EOFV(); + string vEOF(); - string CS(); + string vCS(); string STACK(); string TOP(); string TOKSTART(); diff --git a/ragel/rbxgoto.cpp b/ragel/rbxgoto.cpp index dc9c6f8..c54cb00 100644 --- a/ragel/rbxgoto.cpp +++ b/ragel/rbxgoto.cpp @@ -408,8 +408,8 @@ std::ostream &RbxGotoCodeGen::TRANSITIONS() /* Destination state. */ if ( trans->action != 0 && trans->action->anyCurStateRef() ) - out << "_ps = " << CS() << "'n"; - out << CS() << " = " << trans->targ->id << "\n"; + out << "_ps = " << vCS() << "'n"; + out << vCS() << " = " << trans->targ->id << "\n"; if ( trans->action != 0 ) { /* Write out the transition func. */ @@ -567,14 +567,14 @@ std::ostream &RbxGotoCodeGen::FINISH_CASES() void RbxGotoCodeGen::GOTO( ostream &ret, int gotoDest, bool inFinish ) { - ret << "begin\n" << CS() << " = " << gotoDest << " "; + ret << "begin\n" << vCS() << " = " << gotoDest << " "; rbxGoto(ret, "_again") << "\nend\n"; } void RbxGotoCodeGen::GOTO_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << "begin\n" << CS() << " = ("; + ret << "begin\n" << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << ")"; rbxGoto(ret, "_again") << @@ -588,17 +588,17 @@ void RbxGotoCodeGen::CURS( ostream &ret, bool inFinish ) void RbxGotoCodeGen::TARGS( ostream &ret, bool inFinish, int targState ) { - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; } void RbxGotoCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void RbxGotoCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << ");"; } @@ -611,7 +611,7 @@ void RbxGotoCodeGen::CALL( ostream &ret, int callDest, int targState, bool inFin } ret << "begin\n" - << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " << + << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " << callDest << "; "; rbxGoto(ret, "_again") << "\nend\n"; @@ -627,7 +627,7 @@ void RbxGotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targSta INLINE_LIST( ret, prePushExpr, 0, false ); } - ret << "begin\n" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = ("; + ret << "begin\n" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, targState, inFinish ); ret << "); "; rbxGoto(ret, "_again") << @@ -639,7 +639,7 @@ void RbxGotoCodeGen::CALL_EXPR( ostream &ret, GenInlineItem *ilItem, int targSta void RbxGotoCodeGen::RET( ostream &ret, bool inFinish ) { - ret << "begin\n" << CS() << " = " << STACK() << "[--" << TOP() << "]; " ; + ret << "begin\n" << vCS() << " = " << STACK() << "[--" << TOP() << "]; " ; if ( postPopExpr != 0 ) { ret << "{"; @@ -728,7 +728,7 @@ void RbxGotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n"; + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"; rbxGoto(out << " ", "_out") << "\n" << " end\n"; } @@ -738,7 +738,7 @@ void RbxGotoCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << ARR_OFF( A(), FSA() + "[" + CS() + "]" ) << ";\n" + " _acts = " << ARR_OFF( A(), FSA() + "[" + vCS() + "]" ) << ";\n" " _nacts = " << " *_acts++;\n" " while ( _nacts-- > 0 ) {\n" " switch ( *_acts++ ) {\n"; @@ -750,7 +750,7 @@ void RbxGotoCodeGen::writeExec() } out << - " case ( " << CS() << " )\n"; + " case ( " << vCS() << " )\n"; STATE_GOTOS(); out << " end # case\n" @@ -766,7 +766,7 @@ void RbxGotoCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << ARR_OFF( A(), TSA() + "[" + CS() + "]" ) << ";\n" + " _acts = " << ARR_OFF( A(), TSA() + "[" + vCS() + "]" ) << ";\n" " _nacts = " << " *_acts++;\n" " while ( _nacts-- > 0 ) {\n" " switch ( *_acts++ ) {\n"; @@ -780,7 +780,7 @@ void RbxGotoCodeGen::writeExec() if ( redFsm->errState != 0 ) { outLabelUsed = true; out << - " if ( " << CS() << " == " << redFsm->errState->id << " )\n"; + " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"; rbxGoto(out << " ", "_out") << "\n" << " end" << "\n"; } @@ -809,7 +809,7 @@ void RbxGotoCodeGen::writeEOF() out << " {\n" " _acts = " << - ARR_OFF( A(), EA() + "[" + CS() + "]" ) << ";\n" + ARR_OFF( A(), EA() + "[" + vCS() + "]" ) << ";\n" " " << " _nacts = " << " *_acts++;\n" " while ( _nacts-- > 0 ) {\n" " switch ( *_acts++ ) {\n"; diff --git a/ragel/rubycodegen.cpp b/ragel/rubycodegen.cpp index 9de8193..3e61fe8 100644 --- a/ragel/rubycodegen.cpp +++ b/ragel/rubycodegen.cpp @@ -157,7 +157,7 @@ string RubyCodeGen::PE() return ret.str(); } -string RubyCodeGen::EOFV() +string RubyCodeGen::vEOF() { ostringstream ret; if ( eofExpr == 0 ) @@ -170,7 +170,7 @@ string RubyCodeGen::EOFV() return ret.str(); } -string RubyCodeGen::CS() +string RubyCodeGen::vCS() { ostringstream ret; if ( csExpr == 0 ) @@ -536,7 +536,7 @@ void RubyCodeGen::INLINE_LIST( ostream &ret, GenInlineList *inlineList, ret << "(_ps)"; break; case GenInlineItem::Targs: - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; break; case GenInlineItem::Entry: ret << item->targState->id; @@ -775,7 +775,7 @@ void RubyCodeGen::writeInit() out << " " << PE() << " ||= " << DATA() << ".length\n"; if ( !noCS ) - out << " " << CS() << " = " << START() << "\n"; + out << " " << vCS() << " = " << START() << "\n"; /* If there are any calls, then the stack top needs initialization. */ if ( redFsm->anyActionCalls() || redFsm->anyActionRets() ) diff --git a/ragel/rubycodegen.h b/ragel/rubycodegen.h index d7e34e5..4e3a30d 100644 --- a/ragel/rubycodegen.h +++ b/ragel/rubycodegen.h @@ -99,9 +99,9 @@ public: string P(); string PE(); - string EOFV(); + string vEOF(); - string CS(); + string vCS(); string TOP(); string STACK(); string ACT(); diff --git a/ragel/rubyfflat.cpp b/ragel/rubyfflat.cpp index a206eec..53c7896 100644 --- a/ragel/rubyfflat.cpp +++ b/ragel/rubyfflat.cpp @@ -26,7 +26,7 @@ void RubyFFlatCodeGen::GOTO( ostream &out, int gotoDest, bool inFinish ) { out << " begin\n" - " " << CS() << " = " << gotoDest << "\n" + " " << vCS() << " = " << gotoDest << "\n" " _goto_level = _again\n" " next\n" " end\n"; @@ -36,7 +36,7 @@ void RubyFFlatCodeGen::GOTO_EXPR( ostream &out, GenInlineItem *ilItem, bool inFi { out << " begin\n" - " " << CS() << " = ("; + " " << vCS() << " = ("; INLINE_LIST( out, ilItem->children, 0, inFinish ); out << ")\n"; out << @@ -54,9 +54,9 @@ void RubyFFlatCodeGen::CALL( ostream &out, int callDest, int targState, bool inF out << " begin\n" - " " << STACK() << "[" << TOP() << "] = " << CS() << "\n" + " " << STACK() << "[" << TOP() << "] = " << vCS() << "\n" " " << TOP() << "+= 1\n" - " " << CS() << " = " << callDest << "\n" + " " << vCS() << " = " << callDest << "\n" " _goto_level = _again\n" " next\n" " end\n"; @@ -75,9 +75,9 @@ void RubyFFlatCodeGen::CALL_EXPR(ostream &out, GenInlineItem *ilItem, out << " begin\n" - " " << STACK() << "[" << TOP() << "] = " << CS() << "\n" + " " << STACK() << "[" << TOP() << "] = " << vCS() << "\n" " " << TOP() << " += 1\n" - " " << CS() << " = ("; + " " << vCS() << " = ("; INLINE_LIST( out, ilItem->children, targState, inFinish ); out << ")\n"; @@ -95,7 +95,7 @@ void RubyFFlatCodeGen::RET( ostream &out, bool inFinish ) out << " begin\n" " " << TOP() << " -= 1\n" - " " << CS() << " = " << STACK() << "[" << TOP() << "]\n"; + " " << vCS() << " = " << STACK() << "[" << TOP() << "]\n"; if ( postPopExpr != 0 ) { out << "begin\n"; @@ -357,7 +357,7 @@ void RubyFFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if " << CS() << " == " << redFsm->errState->id << "\n" + " if " << vCS() << " == " << redFsm->errState->id << "\n" " _goto_level = _out\n" " next\n" " end\n"; @@ -370,7 +370,7 @@ void RubyFFlatCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " case " << FSA() << "[" << CS() << "] \n"; + " case " << FSA() << "[" << vCS() << "] \n"; FROM_STATE_ACTION_SWITCH() << " end\n"; } @@ -387,9 +387,9 @@ void RubyFFlatCodeGen::writeExec() } if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << "\n"; + out << " _ps = " << vCS() << "\n"; - out << " " << CS() << " = " << TT() << "[_trans]\n"; + out << " " << vCS() << " = " << TT() << "[_trans]\n"; if ( redFsm->anyRegActions() ) { /* break _again */ @@ -408,7 +408,7 @@ void RubyFFlatCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " case " << TSA() << "[" << CS() << "] \n"; + " case " << TSA() << "[" << vCS() << "] \n"; TO_STATE_ACTION_SWITCH() << " end\n" "\n"; @@ -416,7 +416,7 @@ void RubyFFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if " << CS() << " == " << redFsm->errState->id << "\n" + " if " << vCS() << " == " << redFsm->errState->id << "\n" " _goto_level = _out\n" " next\n" " end\n"; @@ -444,12 +444,12 @@ void RubyFFlatCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if " << P() << " == " << EOFV() << "\n"; + " if " << P() << " == " << vEOF() << "\n"; if ( redFsm->anyEofTrans() ) { out << - " if " << ET() << "[" << CS() << "] > 0\n" - " _trans = " << ET() << "[" << CS() << "] - 1;\n" + " if " << ET() << "[" << vCS() << "] > 0\n" + " _trans = " << ET() << "[" << vCS() << "] - 1;\n" " _goto_level = _eof_trans\n" " next;\n" " end\n"; @@ -457,7 +457,7 @@ void RubyFFlatCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << - " case " << EA() << "[" << CS() << "]\n"; + " case " << EA() << "[" << vCS() << "]\n"; EOF_ACTION_SWITCH() << " end\n"; } diff --git a/ragel/rubyflat.cpp b/ragel/rubyflat.cpp index 4688fcc..6cf7e45 100644 --- a/ragel/rubyflat.cpp +++ b/ragel/rubyflat.cpp @@ -276,9 +276,9 @@ std::ostream &RubyFlatCodeGen::TRANS_ACTIONS() void RubyFlatCodeGen::LOCATE_TRANS() { out << - " _keys = " << CS() << " << 1\n" - " _inds = " << IO() << "[" << CS() << "]\n" - " _slen = " << SP() << "[" << CS() << "]\n" + " _keys = " << vCS() << " << 1\n" + " _inds = " << IO() << "[" << vCS() << "]\n" + " _slen = " << SP() << "[" << vCS() << "]\n" " _trans = if ( _slen > 0 && \n" " " << K() << "[_keys] <= " << GET_WIDE_KEY() << " && \n" " " << GET_WIDE_KEY() << " <= " << K() << "[_keys + 1] \n" @@ -310,9 +310,9 @@ void RubyFlatCodeGen::COND_TRANSLATE() { out << " _widec = " << GET_KEY() << "\n" - " _keys = " << CS() << " << 1\n" - " _conds = " << CO() << "[" << CS() << "]\n" - " _slen = " << CSP() << "[" << CS() << "]\n" + " _keys = " << vCS() << " << 1\n" + " _conds = " << CO() << "[" << vCS() << "]\n" + " _slen = " << CSP() << "[" << vCS() << "]\n" " _cond = if ( _slen > 0 && \n" " " << CK() << "[_keys] <= " << GET_WIDE_KEY() << " &&\n" " " << GET_WIDE_KEY() << " <= " << CK() << "[_keys + 1]\n" @@ -406,7 +406,7 @@ void RubyFlatCodeGen::GOTO( ostream &out, int gotoDest, bool inFinish ) { out << " begin\n" - " " << CS() << " = " << gotoDest << "\n" + " " << vCS() << " = " << gotoDest << "\n" " _trigger_goto = true\n" " _goto_level = _again\n" " break\n" @@ -422,9 +422,9 @@ void RubyFlatCodeGen::CALL( ostream &out, int callDest, int targState, bool inFi out << " begin\n" - " " << STACK() << "[" << TOP() << "] = " << CS() << "\n" + " " << STACK() << "[" << TOP() << "] = " << vCS() << "\n" " " << TOP() << "+= 1\n" - " " << CS() << " = " << callDest << "\n" + " " << vCS() << " = " << callDest << "\n" " _trigger_goto = true\n" " _goto_level = _again\n" " break\n" @@ -443,9 +443,9 @@ void RubyFlatCodeGen::CALL_EXPR(ostream &out, GenInlineItem *ilItem, int targSta out << " begin\n" - " " << STACK() << "[" << TOP() << "] = " << CS() << "\n" + " " << STACK() << "[" << TOP() << "] = " << vCS() << "\n" " " << TOP() << " += 1\n" - " " << CS() << " = ("; + " " << vCS() << " = ("; INLINE_LIST( out, ilItem->children, targState, inFinish ); out << ")\n"; @@ -464,7 +464,7 @@ void RubyFlatCodeGen::RET( ostream &out, bool inFinish ) out << " begin\n" " " << TOP() << " -= 1\n" - " " << CS() << " = " << STACK() << "[" << TOP() << "]\n"; + " " << vCS() << " = " << STACK() << "[" << TOP() << "]\n"; if ( postPopExpr != 0 ) { out << "begin\n"; @@ -481,14 +481,14 @@ void RubyFlatCodeGen::RET( ostream &out, bool inFinish ) void RubyFlatCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void RubyFlatCodeGen::GOTO_EXPR( ostream &out, GenInlineItem *ilItem, bool inFinish ) { out << " begin\n" - " " << CS() << " = ("; + " " << vCS() << " = ("; INLINE_LIST( out, ilItem->children, 0, inFinish ); out << ")\n"; out << @@ -500,7 +500,7 @@ void RubyFlatCodeGen::GOTO_EXPR( ostream &out, GenInlineItem *ilItem, bool inFin void RubyFlatCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << ");"; } @@ -513,7 +513,7 @@ void RubyFlatCodeGen::CURS( ostream &ret, bool inFinish ) void RubyFlatCodeGen::TARGS( ostream &ret, bool inFinish, int targState ) { - ret << "(" << CS() << ")"; + ret << "(" << vCS() << ")"; } void RubyFlatCodeGen::BREAK( ostream &out, int targState ) @@ -695,7 +695,7 @@ void RubyFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if " << CS() << " == " << redFsm->errState->id << "\n" + " if " << vCS() << " == " << redFsm->errState->id << "\n" " _goto_level = _out\n" " next\n" " end\n"; @@ -708,7 +708,7 @@ void RubyFlatCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << FSA() << "[" << CS() << "]\n" + " _acts = " << FSA() << "[" << vCS() << "]\n" " _nacts = " << A() << "[_acts]\n" " _acts += 1\n" " while _nacts > 0\n" @@ -736,9 +736,9 @@ void RubyFlatCodeGen::writeExec() } if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << "\n"; + out << " _ps = " << vCS() << "\n"; - out << " " << CS() << " = " << TT() << "[_trans]\n"; + out << " " << vCS() << " = " << TT() << "[_trans]\n"; if ( redFsm->anyRegActions() ) { out << @@ -767,7 +767,7 @@ void RubyFlatCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << TSA() << "[" << CS() << "]\n" + " _acts = " << TSA() << "[" << vCS() << "]\n" " _nacts = " << A() << "[_acts]\n" " _acts += 1\n" " while _nacts > 0\n" @@ -784,7 +784,7 @@ void RubyFlatCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if " << CS() << " == " << redFsm->errState->id << "\n" + " if " << vCS() << " == " << redFsm->errState->id << "\n" " _goto_level = _out\n" " next\n" " end\n"; @@ -812,12 +812,12 @@ void RubyFlatCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if " << P() << " == " << EOFV() << "\n"; + " if " << P() << " == " << vEOF() << "\n"; if ( redFsm->anyEofTrans() ) { out << - " if " << ET() << "[" << CS() << "] > 0\n" - " _trans = " << ET() << "[" << CS() << "] - 1;\n" + " if " << ET() << "[" << vCS() << "] > 0\n" + " _trans = " << ET() << "[" << vCS() << "] - 1;\n" " _goto_level = _eof_trans\n" " next;\n" " end\n"; @@ -826,7 +826,7 @@ void RubyFlatCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << " begin\n" - " __acts = " << EA() << "[" << CS() << "]\n" + " __acts = " << EA() << "[" << vCS() << "]\n" " __nacts = " << A() << "[__acts]\n" << " __acts += 1\n" " while ( __nacts > 0 ) \n" diff --git a/ragel/rubyftable.cpp b/ragel/rubyftable.cpp index 2d95fc5..b90ffa7 100644 --- a/ragel/rubyftable.cpp +++ b/ragel/rubyftable.cpp @@ -37,7 +37,7 @@ void RubyFTabCodeGen::GOTO( ostream &out, int gotoDest, bool inFinish ) { out << " begin\n" - " " << CS() << " = " << gotoDest << "\n" + " " << vCS() << " = " << gotoDest << "\n" " _goto_level = _again\n" " next\n" " end\n"; @@ -47,7 +47,7 @@ void RubyFTabCodeGen::GOTO_EXPR( ostream &out, GenInlineItem *ilItem, bool inFin { out << " begin\n" - " " << CS() << " = ("; + " " << vCS() << " = ("; INLINE_LIST( out, ilItem->children, 0, inFinish ); out << ")\n"; out << @@ -65,9 +65,9 @@ void RubyFTabCodeGen::CALL( ostream &out, int callDest, int targState, bool inFi out << " begin\n" - " " << STACK() << "[" << TOP() << "] = " << CS() << "\n" + " " << STACK() << "[" << TOP() << "] = " << vCS() << "\n" " " << TOP() << "+= 1\n" - " " << CS() << " = " << callDest << "\n" + " " << vCS() << " = " << callDest << "\n" " _goto_level = _again\n" " next\n" " end\n"; @@ -86,9 +86,9 @@ void RubyFTabCodeGen::CALL_EXPR(ostream &out, GenInlineItem *ilItem, out << " begin\n" - " " << STACK() << "[" << TOP() << "] = " << CS() << "\n" + " " << STACK() << "[" << TOP() << "] = " << vCS() << "\n" " " << TOP() << " += 1\n" - " " << CS() << " = ("; + " " << vCS() << " = ("; INLINE_LIST( out, ilItem->children, targState, inFinish ); out << ")\n"; @@ -106,7 +106,7 @@ void RubyFTabCodeGen::RET( ostream &out, bool inFinish ) out << " begin\n" " " << TOP() << " -= 1\n" - " " << CS() << " = " << STACK() << "[" << TOP() << "]\n"; + " " << vCS() << " = " << STACK() << "[" << TOP() << "]\n"; if ( postPopExpr != 0 ) { out << "begin\n"; @@ -396,7 +396,7 @@ void RubyFTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if " << CS() << " == " << redFsm->errState->id << "\n" + " if " << vCS() << " == " << redFsm->errState->id << "\n" " _goto_level = _out\n" " next\n" " end\n"; @@ -409,7 +409,7 @@ void RubyFTabCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " case " << FSA() << "[" << CS() << "] \n"; + " case " << FSA() << "[" << vCS() << "] \n"; FROM_STATE_ACTION_SWITCH() << " end # from state action switch \n" "\n"; @@ -430,10 +430,10 @@ void RubyFTabCodeGen::writeExec() } if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << ";\n"; + out << " _ps = " << vCS() << ";\n"; out << - " " << CS() << " = " << TT() << "[_trans];\n" + " " << vCS() << " = " << TT() << "[_trans];\n" "\n"; if ( redFsm->anyRegActions() ) { @@ -454,7 +454,7 @@ void RubyFTabCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " case " << TSA() << "[" << CS() << "] \n"; + " case " << TSA() << "[" << vCS() << "] \n"; TO_STATE_ACTION_SWITCH() << " end\n" "\n"; @@ -462,7 +462,7 @@ void RubyFTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if " << CS() << " == " << redFsm->errState->id << "\n" + " if " << vCS() << " == " << redFsm->errState->id << "\n" " _goto_level = _out\n" " next\n" " end\n"; @@ -490,12 +490,12 @@ void RubyFTabCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if " << P() << " == " << EOFV() << "\n"; + " if " << P() << " == " << vEOF() << "\n"; if ( redFsm->anyEofTrans() ) { out << - " if " << ET() << "[" << CS() << "] > 0\n" - " _trans = " << ET() << "[" << CS() << "] - 1;\n" + " if " << ET() << "[" << vCS() << "] > 0\n" + " _trans = " << ET() << "[" << vCS() << "] - 1;\n" " _goto_level = _eof_trans\n" " next;\n" " end\n"; @@ -504,7 +504,7 @@ void RubyFTabCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << " begin\n" - " case ( " << EA() << "[" << CS() << "] )\n"; + " case ( " << EA() << "[" << vCS() << "] )\n"; EOF_ACTION_SWITCH() << " end\n" " end\n"; diff --git a/ragel/rubytable.cpp b/ragel/rubytable.cpp index 653d738..eb5dfd5 100644 --- a/ragel/rubytable.cpp +++ b/ragel/rubytable.cpp @@ -39,7 +39,7 @@ void RubyTabCodeGen::GOTO( ostream &out, int gotoDest, bool inFinish ) { out << " begin\n" - " " << CS() << " = " << gotoDest << "\n" + " " << vCS() << " = " << gotoDest << "\n" " _trigger_goto = true\n" " _goto_level = _again\n" " break\n" @@ -50,7 +50,7 @@ void RubyTabCodeGen::GOTO_EXPR( ostream &out, GenInlineItem *ilItem, bool inFini { out << " begin\n" - " " << CS() << " = ("; + " " << vCS() << " = ("; INLINE_LIST( out, ilItem->children, 0, inFinish ); out << ")\n"; out << @@ -69,9 +69,9 @@ void RubyTabCodeGen::CALL( ostream &out, int callDest, int targState, bool inFin out << " begin\n" - " " << STACK() << "[" << TOP() << "] = " << CS() << "\n" + " " << STACK() << "[" << TOP() << "] = " << vCS() << "\n" " " << TOP() << "+= 1\n" - " " << CS() << " = " << callDest << "\n" + " " << vCS() << " = " << callDest << "\n" " _trigger_goto = true\n" " _goto_level = _again\n" " break\n" @@ -90,9 +90,9 @@ void RubyTabCodeGen::CALL_EXPR(ostream &out, GenInlineItem *ilItem, int targStat out << " begin\n" - " " << STACK() << "[" << TOP() << "] = " << CS() << "\n" + " " << STACK() << "[" << TOP() << "] = " << vCS() << "\n" " " << TOP() << " += 1\n" - " " << CS() << " = ("; + " " << vCS() << " = ("; INLINE_LIST( out, ilItem->children, targState, inFinish ); out << ")\n"; @@ -111,7 +111,7 @@ void RubyTabCodeGen::RET( ostream &out, bool inFinish ) out << " begin\n" " " << TOP() << " -= 1\n" - " " << CS() << " = " << STACK() << "[" << TOP() << "]\n"; + " " << vCS() << " = " << STACK() << "[" << TOP() << "]\n"; if ( postPopExpr != 0 ) { out << "begin\n"; @@ -141,8 +141,8 @@ void RubyTabCodeGen::COND_TRANSLATE() { out << " _widec = " << GET_KEY() << "\n" - " _keys = " << CO() << "[" << CS() << "]*2\n" - " _klen = " << CL() << "[" << CS() << "]\n" + " _keys = " << CO() << "[" << vCS() << "]*2\n" + " _klen = " << CL() << "[" << vCS() << "]\n" " if _klen > 0\n" " _lower = _keys\n" " _upper = _keys + (_klen<<1) - 2\n" @@ -154,7 +154,7 @@ void RubyTabCodeGen::COND_TRANSLATE() " elsif " << GET_WIDE_KEY() << " > " << CK() << "[_mid+1]\n" " _lower = _mid + 2\n" " else\n" - " case " << C() << "[" << CO() << "[" << CS() << "]" + " case " << C() << "[" << CO() << "[" << vCS() << "]" " + ((_mid - _keys)>>1)]\n"; for ( CondSpaceList::Iter csi = condSpaceList; csi.lte(); csi++ ) { @@ -182,9 +182,9 @@ void RubyTabCodeGen::COND_TRANSLATE() void RubyTabCodeGen::LOCATE_TRANS() { out << - " _keys = " << KO() << "[" << CS() << "]\n" - " _trans = " << IO() << "[" << CS() << "]\n" - " _klen = " << SL() << "[" << CS() << "]\n" + " _keys = " << KO() << "[" << vCS() << "]\n" + " _trans = " << IO() << "[" << vCS() << "]\n" + " _klen = " << SL() << "[" << vCS() << "]\n" " _break_match = false\n" " \n" " begin\n" @@ -211,7 +211,7 @@ void RubyTabCodeGen::LOCATE_TRANS() " _trans += _klen\n" " end" "\n" - " _klen = " << RL() << "[" << CS() << "]\n" + " _klen = " << RL() << "[" << vCS() << "]\n" " if _klen > 0\n" " _lower = _keys\n" " _upper = _keys + (_klen << 1) - 2\n" @@ -273,7 +273,7 @@ void RubyTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if " << CS() << " == " << redFsm->errState->id << "\n" + " if " << vCS() << " == " << redFsm->errState->id << "\n" " _goto_level = _out\n" " next\n" " end\n"; @@ -286,7 +286,7 @@ void RubyTabCodeGen::writeExec() if ( redFsm->anyFromStateActions() ) { out << - " _acts = " << FSA() << "[" << CS() << "]\n" + " _acts = " << FSA() << "[" << vCS() << "]\n" " _nacts = " << A() << "[_acts]\n" " _acts += 1\n" " while _nacts > 0\n" @@ -317,9 +317,9 @@ void RubyTabCodeGen::writeExec() } if ( redFsm->anyRegCurStateRef() ) - out << " _ps = " << CS() << "\n"; + out << " _ps = " << vCS() << "\n"; - out << " " << CS() << " = " << TT() << "[_trans]\n"; + out << " " << vCS() << " = " << TT() << "[_trans]\n"; if ( redFsm->anyRegActions() ) { out << @@ -348,7 +348,7 @@ void RubyTabCodeGen::writeExec() if ( redFsm->anyToStateActions() ) { out << - " _acts = " << TSA() << "[" << CS() << "]\n" + " _acts = " << TSA() << "[" << vCS() << "]\n" " _nacts = " << A() << "[_acts]\n" " _acts += 1\n" " while _nacts > 0\n" @@ -366,7 +366,7 @@ void RubyTabCodeGen::writeExec() if ( redFsm->errState != 0 ) { out << - " if " << CS() << " == " << redFsm->errState->id << "\n" + " if " << vCS() << " == " << redFsm->errState->id << "\n" " _goto_level = _out\n" " next\n" " end\n"; @@ -394,12 +394,12 @@ void RubyTabCodeGen::writeExec() if ( redFsm->anyEofTrans() || redFsm->anyEofActions() ) { out << - " if " << P() << " == " << EOFV() << "\n"; + " if " << P() << " == " << vEOF() << "\n"; if ( redFsm->anyEofTrans() ) { out << - " if " << ET() << "[" << CS() << "] > 0\n" - " _trans = " << ET() << "[" << CS() << "] - 1;\n" + " if " << ET() << "[" << vCS() << "] > 0\n" + " _trans = " << ET() << "[" << vCS() << "] - 1;\n" " _goto_level = _eof_trans\n" " next;\n" " end\n"; @@ -407,7 +407,7 @@ void RubyTabCodeGen::writeExec() if ( redFsm->anyEofActions() ) { out << - " __acts = " << EA() << "[" << CS() << "]\n" + " __acts = " << EA() << "[" << vCS() << "]\n" " __nacts = " << " " << A() << "[__acts]\n" " __acts += 1\n" " while __nacts > 0\n" @@ -509,12 +509,12 @@ std::ostream &RubyTabCodeGen::ACTION_SWITCH() void RubyTabCodeGen::NEXT( ostream &ret, int nextDest, bool inFinish ) { - ret << CS() << " = " << nextDest << ";"; + ret << vCS() << " = " << nextDest << ";"; } void RubyTabCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish ) { - ret << CS() << " = ("; + ret << vCS() << " = ("; INLINE_LIST( ret, ilItem->children, 0, inFinish ); ret << ");"; } -- 2.7.4