/* Write out referenced actions. */
if ( act->numToStateRefs > 0 ) {
/* Write the case label, the action and the case break. */
- out << "\twhen " << act->actionId << "\n";
+ out << "\twhen " << act->actionId << " then\n";
ACTION( out, act, 0, false );
}
}
/* Write out referenced actions. */
if ( act->numFromStateRefs > 0 ) {
/* Write the case label, the action and the case break. */
- out << "\twhen " << act->actionId << "\n";
+ out << "\twhen " << act->actionId << " then\n";
ACTION( out, act, 0, false );
}
}
/* Write out referenced actions. */
if ( act->numEofRefs > 0 ) {
/* Write the case label, the action and the case break. */
- out << "\twhen " << act->actionId << "\n";
+ out << "\twhen " << act->actionId << " then\n";
ACTION( out, act, 0, true );
}
}
/* Write out referenced actions. */
if ( act->numTransRefs > 0 ) {
/* Write the case label, the action and the case break. */
- out << "\twhen " << act->actionId << "\n";
+ out << "\twhen " << act->actionId << " then\n";
ACTION( out, act, 0, false );
}
}
void RbxGotoCodeGen::GOTO_HEADER( RedStateAp *state )
{
/* Label the state. */
- out << "when " << state->id << "\n";
+ out << "when " << state->id << " then\n";
}
/* Write out the single indicies. */
for ( int j = 0; j < numSingles; j++ ) {
- out << "\t\twhen " << KEY(data[j].lowKey) << "\n";
+ out << "\t\twhen " << KEY(data[j].lowKey) << " then\n";
TRANS_GOTO(data[j].value, 0) << "\n";
}
/* Label the state and bail immediately. */
outLabelUsed = true;
RedStateAp *state = redFsm->errState;
- out << "when " << state->id << "\n";
+ out << "when " << state->id << " then\n";
rbxGoto(out << " ", "_out") << "\n";
}
/* States that are final and have an out action need a case. */
if ( st->eofAction != 0 ) {
/* Write the case label. */
- out << "\t\twhen " << st->id << "\n";
+ out << "\t\twhen " << st->id << " then\n";
/* Write the goto func. */
rbxGoto(out, label("f", st->eofAction->actListId)) << "\n";
void RbxGotoCodeGen::BREAK( ostream &ret, int targState )
{
outLabelUsed = true;
- rbxGoto(ret, "_out") << "\n";
+
+ out <<
+ " begin\n"
+ " " << P() << " += 1\n"
+ " " << rbxGoto(ret, "_out") << "\n"
+ " end\n";
}
void RbxGotoCodeGen::writeData()