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 } DOTGenerator dotGenerator = new DOTGenerator( g ); string dot = dotGenerator.GetDOT( dfa.startState ); string dotFileName = g.name + "." + "dec-" + d; if ( g.implicitLexer ) { dotFileName = g.name + Grammar.grammarTypeToFileNameSuffix[(int)g.type] + "." + "dec-" + d; } try { WriteDOTFile( g, dotFileName, dot ); } catch ( IOException ioe ) { ErrorManager.Error( ErrorManager.MSG_CANNOT_GEN_DOT_FILE, dotFileName, ioe ); } } }
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 ); } } }
protected virtual void GenerateNFAs( Grammar g ) { DOTGenerator dotGenerator = new DOTGenerator( g ); ICollection<Rule> rules = g.GetAllImportedRules(); rules.addAll( g.Rules ); foreach ( Rule r in rules ) { try { string dot = dotGenerator.GetDOT( r.startState ); if ( dot != null ) { WriteDOTFile( g, r, dot ); } } catch ( IOException ioe ) { ErrorManager.Error( ErrorManager.MSG_CANNOT_WRITE_FILE, ioe ); } } }