/* Advance and test buffer pos. */
if ( state->labelNeeded ) {
- if ( hasEnd ) {
+ if ( !noEnd ) {
out <<
" if ( ++" << P() << " == " << PE() << " )\n"
" goto _out" << state->id << ";\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"
"\n";
- if ( hasEnd ) {
+ if ( !noEnd ) {
outLabelUsed = true;
out <<
" if ( ++" << P() << " == " << PE() << " )\n"
}
out <<
- " switch ( " << CS() << " )\n {\n";
+ " switch ( " << vCS() << " )\n {\n";
STATE_GOTOS( partition );
SWITCH_DEFAULT() <<
" }\n";
"const int " << START() << " = " << START_STATE_ID() << ";\n"
"\n";
- if ( writeFirstFinal ) {
+ if ( !noFinal ) {
out <<
"const int " << FIRST_FINAL() << " = " << FIRST_FINAL_STATE() << ";\n"
"\n";
}
- if ( writeErr ) {
+ if ( !noError ) {
out <<
"const int " << ERROR() << " = " << ERROR_STATE() << ";\n"
"\n";
" {\n"
" int _stat = 0;\n";
- if ( hasEnd ) {
+ if ( !noEnd ) {
out <<
" if ( " << P() << " == " << PE() << " )\n"
" goto _out;\n";
* partition-switch exit from the last partition. */
out << "_reenter:\n";
- if ( hasEnd ) {
+ if ( !noEnd ) {
out <<
" if ( ++" << P() << " == " << PE() << " )\n"
" goto _out;\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"
" if ( _stat )\n"
" goto _reenter;\n";
- if ( hasEnd )
+ if ( !noEnd )
out << " _out: {}\n";
out <<
}
}
- if ( hasEnd ) {
+ if ( !noEnd ) {
for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ )
st->outNeeded = st->labelNeeded;
}