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 ); } } }
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 ); } } }