}
}
-void InputData::generateReduced()
+void InputData::prepareMachineGen()
{
/* No machine spec or machine name given. Generate everything. */
for ( ParserDict::Iter parser = parserDict; parser.lte(); parser++ ) {
if ( pd->instanceList.length() > 0 )
pd->prepareMachineGen( 0 );
}
+}
- openOutput();
-
- if ( gblErrorCount > 0 )
- return;
-
+void InputData::generateReduced()
+{
for ( ParserDict::Iter parser = parserDict; parser.lte(); parser++ ) {
ParseData *pd = parser->value->pd;
if ( pd->instanceList.length() > 0 )
pd->generateReduced( *this );
}
-
- writeOutput();
}
void InputData::writeOutput()
cgd->writeStatement( ii->loc, ii->writeArgs.length()-1, ii->writeArgs.data );
}
- else {
+ else /*if ( /!generateDot )*/ {
*outStream << '\n';
lineDirective( *outStream, inputFileName, ii->loc.line );
*outStream << ii->data.str();
" -x Run the frontend only: emit XML intermediate format\n"
" -V Generate a dot file for Graphviz\n"
" -p Display printable characters on labels\n"
-" -S <spec> FSM specification to output (for rlgen-dot)\n"
-" -M <machine> Machine definition/instantiation to output (for rlgen-dot)\n"
+" -S <spec> FSM specification to output (for graphviz output)\n"
+" -M <machine> Machine definition/instantiation to output (for graphviz output)\n"
"host language:\n"
" -C The host language is C, C++, Obj-C or Obj-C++ (default)\n"
" -D The host language is D\n"
InputData inputData( inputFileName, outputActive, wantComplete );
- /* Write the machines, then the surrounding code. */
+ /* Compiles machines. */
+ inputData.prepareMachineGen();
+
+ if ( gblErrorCount > 0 )
+ exit(1);
+
+ inputData.openOutput();
+
+ /* Generates the reduced machine, which we use to write output. */
inputData.generateReduced();
+ if ( gblErrorCount > 0 )
+ exit(1);
+
+ inputData.writeOutput();
+
/* Close the input and the intermediate file. */
delete inFile;