return ret.str();
}
-string FsmCodeGen::EOFV()
+string FsmCodeGen::vEOF()
{
ostringstream ret;
if ( eofExpr == 0 )
return ret.str();
}
-string FsmCodeGen::CS()
+string FsmCodeGen::vCS()
{
ostringstream ret;
if ( csExpr == 0 )
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() )
string P();
string PE();
- string EOFV();
+ string vEOF();
string ACCESS();
- string CS();
+ string vCS();
string STACK();
string TOP();
string TOKSTART();
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
if ( redFsm->anyFromStateActions() ) {
out <<
- " switch ( " << FSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << FSA() << "[" << vCS() << "] ) {\n";
FROM_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
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 <<
if ( redFsm->anyToStateActions() ) {
out <<
- " switch ( " << TSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << TSA() << "[" << vCS() << "] ) {\n";
TO_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
if ( redFsm->anyFromStateActions() ) {
out <<
- " switch ( " << FSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << FSA() << "[" << vCS() << "] ) {\n";
FROM_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
}
out <<
- " switch ( " << CS() << " ) {\n";
+ " switch ( " << vCS() << " ) {\n";
STATE_GOTOS();
SWITCH_DEFAULT() <<
" }\n"
if ( redFsm->anyToStateActions() ) {
out <<
- " switch ( " << TSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << TSA() << "[" << vCS() << "] ) {\n";
TO_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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 )
if ( redFsm->anyEofActions() ) {
out <<
- " switch ( " << EA() << "[" << CS() << "] ) {\n";
+ " switch ( " << EA() << "[" << vCS() << "] ) {\n";
EOF_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n";
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"
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;}";
}
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 << ");";
}
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 )
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;}";
void FlatCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];";
+ ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];";
if ( postPopExpr != 0 ) {
ret << "{";
" _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"
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
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() ) {
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";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
}
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";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
if ( redFsm->anyFromStateActions() ) {
out <<
- " switch ( " << FSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << FSA() << "[" << vCS() << "] ) {\n";
FROM_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
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() ) {
if ( redFsm->anyToStateActions() ) {
out <<
- " switch ( " << TSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << TSA() << "[" << vCS() << "] ) {\n";
TO_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
/* 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. */
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;}";
}
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 << ");";
}
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 )
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;}";
void GotoCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];";
+ ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];";
if ( postPopExpr != 0 ) {
ret << "{";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
}
out <<
- " switch ( " << CS() << " ) {\n";
+ " switch ( " << vCS() << " ) {\n";
STATE_GOTOS();
SWITCH_DEFAULT() <<
" }\n"
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";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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 )
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";
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;}";
void IpGotoCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];";
+ ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];";
if ( postPopExpr != 0 ) {
ret << "{";
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 << ");";
}
outLabelUsed = true;
ret << "{" << P() << "++; ";
if ( !csForced )
- ret << CS() << " = " << targState << "; ";
+ ret << vCS() << " = " << targState << "; ";
ret << CTRL_FLOW() << "goto _out;}";
}
/* 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++ ) {
/* Break out here. */
outLabelUsed = true;
- out << CS() << " = " << state->id << ";\n";
+ out << vCS() << " = " << state->id << ";\n";
out << " goto _out;\n";
}
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";
}
}
" goto _resume;\n"
"\n"
"_again:\n"
- " switch ( " << CS() << " ) {\n";
+ " switch ( " << vCS() << " ) {\n";
AGAIN_CASES() <<
" default: break;\n"
" }\n"
}
out <<
- " switch ( " << CS() << " )\n {\n";
+ " switch ( " << vCS() << " )\n {\n";
STATE_GOTOS();
SWITCH_DEFAULT() <<
" }\n";
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"
/* 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++ ) {
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. */
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";
}
}
" goto _resume;\n"
"\n"
"_again:\n"
- " switch ( " << CS() << " ) {\n";
+ " switch ( " << vCS() << " ) {\n";
AGAIN_CASES() <<
" default: break;\n"
" }\n"
}
out <<
- " switch ( " << CS() << " )\n {\n";
+ " switch ( " << vCS() << " )\n {\n";
STATE_GOTOS( partition );
SWITCH_DEFAULT() <<
" }\n";
out << "_resume:\n";
out <<
- " switch ( " << PM() << "[" << CS() << "] ) {\n";
+ " switch ( " << PM() << "[" << vCS() << "] ) {\n";
for ( int p = 0; p < redFsm->nParts; p++ ) {
out <<
" case " << p << ":\n"
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"
" _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"
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;}";
}
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 << ");";
}
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 )
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;}";
void TabCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "{" << CS() << " = " << STACK() << "[--" <<
+ ret << "{" << vCS() << " = " << STACK() << "[--" <<
TOP() << "]; ";
if ( postPopExpr != 0 ) {
{
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"
" 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++ ) {
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
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() ) {
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";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
}
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";
return ret.str();
}
-string CSharpFsmCodeGen::EOFV()
+string CSharpFsmCodeGen::vEOF()
{
ostringstream ret;
if ( eofExpr == 0 )
return ret.str();
}
-string CSharpFsmCodeGen::CS()
+string CSharpFsmCodeGen::vCS()
{
ostringstream ret;
if ( csExpr == 0 )
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() )
string P();
string PE();
- string EOFV();
+ string vEOF();
string ACCESS();
- string CS();
+ string vCS();
string STACK();
string TOP();
string TOKSTART();
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
if ( redFsm->anyFromStateActions() ) {
out <<
- " switch ( " << FSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << FSA() << "[" << vCS() << "] ) {\n";
FROM_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
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 <<
if ( redFsm->anyToStateActions() ) {
out <<
- " switch ( " << TSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << TSA() << "[" << vCS() << "] ) {\n";
TO_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
if ( redFsm->anyFromStateActions() ) {
out <<
- " switch ( " << FSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << FSA() << "[" << vCS() << "] ) {\n";
FROM_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
}
out <<
- " switch ( " << CS() << " ) {\n";
+ " switch ( " << vCS() << " ) {\n";
STATE_GOTOS();
SWITCH_DEFAULT() <<
" }\n"
if ( redFsm->anyToStateActions() ) {
out <<
- " switch ( " << TSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << TSA() << "[" << vCS() << "] ) {\n";
TO_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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 )
if ( redFsm->anyEofActions() ) {
out <<
- " switch ( " << EA() << "[" << CS() << "] ) {\n";
+ " switch ( " << EA() << "[" << vCS() << "] ) {\n";
EOF_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n";
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"
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;}";
}
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 << ");";
}
INLINE_LIST( ret, prePushExpr, 0, false );
}
- ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " <<
+ ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " <<
callDest << "; " << CTRL_FLOW() << "goto _again;}";
if ( prePushExpr != 0 )
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;}";
void CSharpFlatCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];";
+ ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];";
if ( postPopExpr != 0 ) {
ret << "{";
" _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"
/* 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"
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
if ( redFsm->anyFromStateActions() ) {
out <<
- " _acts = " << FSA() << "[" << CS() << "];\n"
+ " _acts = " << FSA() << "[" << vCS() << "];\n"
" _nacts = " << A() << "[_acts++];\n"
" while ( _nacts-- > 0 ) {\n"
" switch ( " << A() << "[_acts++] ) {\n";
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() ) {
if ( redFsm->anyToStateActions() ) {
out <<
- " _acts = " << TSA() << "[" << CS() << "];\n"
+ " _acts = " << TSA() << "[" << vCS() << "];\n"
" _nacts = " << A() << "[_acts++];\n"
" while ( _nacts-- > 0 ) {\n"
" switch ( " << A() << "[_acts++] ) {\n";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
}
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"
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
if ( redFsm->anyFromStateActions() ) {
out <<
- " switch ( " << FSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << FSA() << "[" << vCS() << "] ) {\n";
FROM_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
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() ) {
if ( redFsm->anyToStateActions() ) {
out <<
- " switch ( " << TSA() << "[" << CS() << "] ) {\n";
+ " switch ( " << TSA() << "[" << vCS() << "] ) {\n";
TO_STATE_ACTION_SWITCH();
SWITCH_DEFAULT() <<
" }\n"
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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";
/* 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. */
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;}";
}
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 << ");";
}
INLINE_LIST( ret, prePushExpr, 0, false );
}
- ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " <<
+ ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " <<
callDest << "; " << CTRL_FLOW() << "goto _again;}";
if ( prePushExpr != 0 )
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;}";
void CSharpGotoCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];";
+ ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];";
if ( postPopExpr != 0 ) {
ret << "{";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
if ( redFsm->anyFromStateActions() ) {
out <<
- " _acts = " << FSA() << "[" << CS() << "];\n"
+ " _acts = " << FSA() << "[" << vCS() << "];\n"
" _nacts = " << A() << "[_acts++];\n"
" while ( _nacts-- > 0 ) {\n"
" switch ( " << A() << "[_acts++] ) {\n";
}
out <<
- " switch ( " << CS() << " ) {\n";
+ " switch ( " << vCS() << " ) {\n";
STATE_GOTOS();
SWITCH_DEFAULT() <<
" }\n"
if ( redFsm->anyToStateActions() ) {
out <<
- " _acts = " << TSA() << "[" << CS() << "];\n"
+ " _acts = " << TSA() << "[" << vCS() << "];\n"
" _nacts = " << A() << "[_acts++];\n"
" while ( _nacts-- > 0 ) {\n"
" switch ( " << A() << "[_acts++] ) {\n";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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 )
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"
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;}";
void CSharpIpGotoCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];";
+ ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];";
if ( postPopExpr != 0 ) {
ret << "{";
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 << ");";
}
/* 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;}";
}
/* 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++ )
/* Break out here. */
outLabelUsed = true;
- out << CS() << " = " << state->id << ";\n";
+ out << vCS() << " = " << state->id << ";\n";
out << " goto _out;\n";
}
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";
}
}
" goto _resume;\n"
"\n"
"_again:\n"
- " switch ( " << CS() << " ) {\n";
+ " switch ( " << vCS() << " ) {\n";
AGAIN_CASES() <<
" default: break;\n"
" }\n"
}
out <<
- " switch ( " << CS() << " )\n {\n";
+ " switch ( " << vCS() << " )\n {\n";
STATE_GOTOS();
SWITCH_DEFAULT() <<
" }\n";
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"
/* 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++ )
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. */
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";
}
}
" goto _resume;\n"
"\n"
"_again:\n"
- " switch ( " << CS() << " ) {\n";
+ " switch ( " << vCS() << " ) {\n";
AGAIN_CASES() <<
" default: break;\n"
" }\n"
}
out <<
- " switch ( " << CS() << " )\n {\n";
+ " switch ( " << vCS() << " )\n {\n";
STATE_GOTOS( partition );
SWITCH_DEFAULT() <<
" }\n";
out << "_resume:\n";
out <<
- " switch ( " << PM() << "[" << CS() << "] ) {\n";
+ " switch ( " << PM() << "[" << vCS() << "] ) {\n";
for ( int p = 0; p < redFsm->nParts; p++ ) {
out <<
" case " << p << ":\n"
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;}";
}
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 << ");";
}
INLINE_LIST( ret, prePushExpr, 0, false );
}
- ret << "{" << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " <<
+ ret << "{" << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " <<
callDest << "; " << CTRL_FLOW() << "goto _again;}";
if ( prePushExpr != 0 )
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;}";
void CSharpTabCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "{" << CS() << " = " << STACK() << "[--" <<
+ ret << "{" << vCS() << " = " << STACK() << "[--" <<
TOP() << "]; ";
if ( postPopExpr != 0 ) {
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"
" _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"
{
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"
" 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++ ) {
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
if ( redFsm->anyFromStateActions() ) {
out <<
- " _acts = " << FSA() << "[" + CS() + "]" << ";\n"
+ " _acts = " << FSA() << "[" + vCS() + "]" << ";\n"
" _nacts = " << A() << "[_acts++];\n"
" while ( _nacts-- > 0 ) {\n"
" switch ( " << A() << "[_acts++] ) {\n";
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() ) {
if ( redFsm->anyToStateActions() ) {
out <<
- " _acts = " << TSA() << "[" << CS() << "]" << ";\n"
+ " _acts = " << TSA() << "[" << vCS() << "]" << ";\n"
" _nacts = " << A() << "[_acts++];\n"
" while ( _nacts-- > 0 ) {\n"
" switch ( " << A() << "[_acts++] ) {\n";
if ( redFsm->errState != 0 ) {
outLabelUsed = true;
out <<
- " if ( " << CS() << " == " << redFsm->errState->id << " )\n"
+ " if ( " << vCS() << " == " << redFsm->errState->id << " )\n"
" goto _out;\n";
}
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 <<
" " << actsType << " __acts = " <<
- EA() << "[" << CS() << "]" << ";\n"
+ EA() << "[" << vCS() << "]" << ";\n"
" " << nactsType << " __nacts = " <<
A() << "[__acts++];\n"
" while ( __nacts-- > 0 ) {\n"
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;}";
}
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 )
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;}";
void JavaTabCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "{" << CS() << " = " << STACK() << "[--" << TOP() << "];";
+ ret << "{" << vCS() << " = " << STACK() << "[--" << TOP() << "];";
if ( postPopExpr != 0 ) {
ret << "{";
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 << ");";
}
ret << "(_ps)";
break;
case GenInlineItem::Targs:
- ret << "(" << CS() << ")";
+ ret << "(" << vCS() << ")";
break;
case GenInlineItem::Entry:
ret << item->targState->id;
{
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"
" 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"
;
{
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"
" _trans += _klen;\n"
" }\n"
"\n"
- " _klen = " << RL() << "[" << CS() << "];\n"
+ " _klen = " << RL() << "[" << vCS() << "];\n"
" if ( _klen > 0 ) {\n"
" int _lower = _keys;\n"
" int _mid;\n"
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";
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";
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() ) {
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";
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";
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";
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";
return ret.str();
}
-string JavaTabCodeGen::EOFV()
+string JavaTabCodeGen::vEOF()
{
ostringstream ret;
if ( eofExpr == 0 )
return ret.str();
}
-string JavaTabCodeGen::CS()
+string JavaTabCodeGen::vCS()
{
ostringstream ret;
if ( csExpr == 0 )
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() )
string P();
string PE();
- string EOFV();
+ string vEOF();
- string CS();
+ string vCS();
string STACK();
string TOP();
string TOKSTART();
/* 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. */
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") <<
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 << ");";
}
}
ret << "begin\n"
- << STACK() << "[" << TOP() << "++] = " << CS() << "; " << CS() << " = " <<
+ << STACK() << "[" << TOP() << "++] = " << vCS() << "; " << vCS() << " = " <<
callDest << "; ";
rbxGoto(ret, "_again") <<
"\nend\n";
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") <<
void RbxGotoCodeGen::RET( ostream &ret, bool inFinish )
{
- ret << "begin\n" << CS() << " = " << STACK() << "[--" << TOP() << "]; " ;
+ ret << "begin\n" << vCS() << " = " << STACK() << "[--" << TOP() << "]; " ;
if ( postPopExpr != 0 ) {
ret << "{";
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";
}
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";
}
out <<
- " case ( " << CS() << " )\n";
+ " case ( " << vCS() << " )\n";
STATE_GOTOS();
out <<
" end # case\n"
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";
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";
}
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";
return ret.str();
}
-string RubyCodeGen::EOFV()
+string RubyCodeGen::vEOF()
{
ostringstream ret;
if ( eofExpr == 0 )
return ret.str();
}
-string RubyCodeGen::CS()
+string RubyCodeGen::vCS()
{
ostringstream ret;
if ( csExpr == 0 )
ret << "(_ps)";
break;
case GenInlineItem::Targs:
- ret << "(" << CS() << ")";
+ ret << "(" << vCS() << ")";
break;
case GenInlineItem::Entry:
ret << item->targState->id;
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() )
string P();
string PE();
- string EOFV();
+ string vEOF();
- string CS();
+ string vCS();
string TOP();
string STACK();
string ACT();
{
out <<
" begin\n"
- " " << CS() << " = " << gotoDest << "\n"
+ " " << vCS() << " = " << gotoDest << "\n"
" _goto_level = _again\n"
" next\n"
" end\n";
{
out <<
" begin\n"
- " " << CS() << " = (";
+ " " << vCS() << " = (";
INLINE_LIST( out, ilItem->children, 0, inFinish );
out << ")\n";
out <<
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";
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";
out <<
" begin\n"
" " << TOP() << " -= 1\n"
- " " << CS() << " = " << STACK() << "[" << TOP() << "]\n";
+ " " << vCS() << " = " << STACK() << "[" << TOP() << "]\n";
if ( postPopExpr != 0 ) {
out << "begin\n";
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";
if ( redFsm->anyFromStateActions() ) {
out <<
- " case " << FSA() << "[" << CS() << "] \n";
+ " case " << FSA() << "[" << vCS() << "] \n";
FROM_STATE_ACTION_SWITCH() <<
" end\n";
}
}
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 */
if ( redFsm->anyToStateActions() ) {
out <<
- " case " << TSA() << "[" << CS() << "] \n";
+ " case " << TSA() << "[" << vCS() << "] \n";
TO_STATE_ACTION_SWITCH() <<
" end\n"
"\n";
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";
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";
if ( redFsm->anyEofActions() ) {
out <<
- " case " << EA() << "[" << CS() << "]\n";
+ " case " << EA() << "[" << vCS() << "]\n";
EOF_ACTION_SWITCH() <<
" end\n";
}
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"
{
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"
{
out <<
" begin\n"
- " " << CS() << " = " << gotoDest << "\n"
+ " " << vCS() << " = " << gotoDest << "\n"
" _trigger_goto = true\n"
" _goto_level = _again\n"
" break\n"
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"
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";
out <<
" begin\n"
" " << TOP() << " -= 1\n"
- " " << CS() << " = " << STACK() << "[" << TOP() << "]\n";
+ " " << vCS() << " = " << STACK() << "[" << TOP() << "]\n";
if ( postPopExpr != 0 ) {
out << "begin\n";
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 <<
void RubyFlatCodeGen::NEXT_EXPR( ostream &ret, GenInlineItem *ilItem, bool inFinish )
{
- ret << CS() << " = (";
+ ret << vCS() << " = (";
INLINE_LIST( ret, ilItem->children, 0, inFinish );
ret << ");";
}
void RubyFlatCodeGen::TARGS( ostream &ret, bool inFinish, int targState )
{
- ret << "(" << CS() << ")";
+ ret << "(" << vCS() << ")";
}
void RubyFlatCodeGen::BREAK( ostream &out, int targState )
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";
if ( redFsm->anyFromStateActions() ) {
out <<
- " _acts = " << FSA() << "[" << CS() << "]\n"
+ " _acts = " << FSA() << "[" << vCS() << "]\n"
" _nacts = " << A() << "[_acts]\n"
" _acts += 1\n"
" while _nacts > 0\n"
}
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 <<
if ( redFsm->anyToStateActions() ) {
out <<
- " _acts = " << TSA() << "[" << CS() << "]\n"
+ " _acts = " << TSA() << "[" << vCS() << "]\n"
" _nacts = " << A() << "[_acts]\n"
" _acts += 1\n"
" while _nacts > 0\n"
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";
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";
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"
{
out <<
" begin\n"
- " " << CS() << " = " << gotoDest << "\n"
+ " " << vCS() << " = " << gotoDest << "\n"
" _goto_level = _again\n"
" next\n"
" end\n";
{
out <<
" begin\n"
- " " << CS() << " = (";
+ " " << vCS() << " = (";
INLINE_LIST( out, ilItem->children, 0, inFinish );
out << ")\n";
out <<
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";
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";
out <<
" begin\n"
" " << TOP() << " -= 1\n"
- " " << CS() << " = " << STACK() << "[" << TOP() << "]\n";
+ " " << vCS() << " = " << STACK() << "[" << TOP() << "]\n";
if ( postPopExpr != 0 ) {
out << "begin\n";
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";
if ( redFsm->anyFromStateActions() ) {
out <<
- " case " << FSA() << "[" << CS() << "] \n";
+ " case " << FSA() << "[" << vCS() << "] \n";
FROM_STATE_ACTION_SWITCH() <<
" end # from state action switch \n"
"\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() ) {
if ( redFsm->anyToStateActions() ) {
out <<
- " case " << TSA() << "[" << CS() << "] \n";
+ " case " << TSA() << "[" << vCS() << "] \n";
TO_STATE_ACTION_SWITCH() <<
" end\n"
"\n";
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";
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";
if ( redFsm->anyEofActions() ) {
out <<
" begin\n"
- " case ( " << EA() << "[" << CS() << "] )\n";
+ " case ( " << EA() << "[" << vCS() << "] )\n";
EOF_ACTION_SWITCH() <<
" end\n"
" end\n";
{
out <<
" begin\n"
- " " << CS() << " = " << gotoDest << "\n"
+ " " << vCS() << " = " << gotoDest << "\n"
" _trigger_goto = true\n"
" _goto_level = _again\n"
" break\n"
{
out <<
" begin\n"
- " " << CS() << " = (";
+ " " << vCS() << " = (";
INLINE_LIST( out, ilItem->children, 0, inFinish );
out << ")\n";
out <<
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"
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";
out <<
" begin\n"
" " << TOP() << " -= 1\n"
- " " << CS() << " = " << STACK() << "[" << TOP() << "]\n";
+ " " << vCS() << " = " << STACK() << "[" << TOP() << "]\n";
if ( postPopExpr != 0 ) {
out << "begin\n";
{
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"
" 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++ ) {
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"
" _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"
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";
if ( redFsm->anyFromStateActions() ) {
out <<
- " _acts = " << FSA() << "[" << CS() << "]\n"
+ " _acts = " << FSA() << "[" << vCS() << "]\n"
" _nacts = " << A() << "[_acts]\n"
" _acts += 1\n"
" while _nacts > 0\n"
}
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 <<
if ( redFsm->anyToStateActions() ) {
out <<
- " _acts = " << TSA() << "[" << CS() << "]\n"
+ " _acts = " << TSA() << "[" << vCS() << "]\n"
" _nacts = " << A() << "[_acts]\n"
" _acts += 1\n"
" while _nacts > 0\n"
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";
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";
if ( redFsm->anyEofActions() ) {
out <<
- " __acts = " << EA() << "[" << CS() << "]\n"
+ " __acts = " << EA() << "[" << vCS() << "]\n"
" __nacts = " << " " << A() << "[__acts]\n"
" __acts += 1\n"
" while __nacts > 0\n"
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 << ");";
}