public virtual void GenerateDFAs( Grammar g )
{
for ( int d = 1; d <= g.NumberOfDecisions; d++ )
{
DFA dfa = g.GetLookaheadDFA( d );
if ( dfa == null )
{
continue; // not there for some reason, ignore
}
IGraphGenerator generator;
if (GenerateDgmlGraphs)
{
generator = new DgmlGenerator(g);
}
else
{
generator = new DOTGenerator(g);
}
string graph = generator.GenerateGraph( dfa.StartState );
string graphFileName = g.name + "." + "dec-" + d;
if ( g.implicitLexer )
{
graphFileName = g.name + Grammar.grammarTypeToFileNameSuffix[(int)g.type] + "." + "dec-" + d;
}
try
{
WriteGraphFile( g, graphFileName, graph, generator.FileExtension );
}
catch ( IOException ioe )
{
ErrorManager.Error( ErrorManager.MSG_CANNOT_GEN_DOT_FILE,
graphFileName,
ioe );
}
}
}