Improved graphviz output and got -M and -S working again.
[external/ragel.git] / ragel / rubycodegen.cpp
index f285c58..5b50346 100644 (file)
@@ -54,10 +54,9 @@ using std::cerr;
 using std::endl;
 
 /* Target ruby impl */
-extern RubyImplEnum rubyImpl;
 
 /* Target language and output style. */
-extern CodeStyleEnum codeStyle;
+extern CodeStyle codeStyle;
 
 /* Io globals. */
 extern istream *inStream;
@@ -74,90 +73,6 @@ extern int numSplitPartitions;
  * Callbacks invoked by the XML data parser.
  */
 
-/* Invoked by the parser when the root element is opened. */
-ostream *rubyOpenOutput( const char *inputFile )
-{
-       if ( hostLang->lang != HostLang::Ruby ) {
-               error() << "this code generator is for Ruby only" << endl;
-               exit(1);
-       }
-
-       /* If the output format is code and no output file name is given, then
-        * make a default. */
-       if ( outputFileName == 0 ) {
-               const char *ext = findFileExtension( inputFile );
-               if ( ext != 0 && strcmp( ext, ".rh" ) == 0 )
-                       outputFileName = fileNameFromStem( inputFile, ".h" );
-               else
-                       outputFileName = fileNameFromStem( inputFile, ".rb" );
-       }
-
-       /* Make sure we are not writing to the same file as the input file. */
-       if ( outputFileName != 0 && strcmp( inputFile, outputFileName  ) == 0 ) {
-               error() << "output file \"" << outputFileName  << 
-                               "\" is the same as the input file" << endl;
-       }
-
-       if ( outputFileName != 0 ) {
-               /* Create the filter on the output and open it. */
-               outFilter = new output_filter( outputFileName );
-               outFilter->open( outputFileName, ios::out|ios::trunc );
-               if ( !outFilter->is_open() ) {
-                       error() << "error opening " << outputFileName << " for writing" << endl;
-                       exit(1);
-               }
-
-               /* Open the output stream, attaching it to the filter. */
-               outStream = new ostream( outFilter );
-       }
-       else {
-               /* Writing out ot std out. */
-               outStream = &cout;
-       }
-       return outStream;
-}
-
-/* Invoked by the parser when a ragel definition is opened. */
-CodeGenData *rubyMakeCodeGen( const char *sourceFileName, const char *fsmName, 
-               ostream &out, bool wantComplete )
-{
-       CodeGenData *codeGen = 0;
-       switch ( codeStyle ) {
-               case GenTables: 
-                       codeGen = new RubyTabCodeGen(out);
-                       break;
-               case GenFTables:
-                       codeGen = new RubyFTabCodeGen(out);
-                       break;
-               case GenFlat:
-                       codeGen = new RubyFlatCodeGen(out);
-                       break;
-               case GenFFlat:
-                       codeGen = new RubyFFlatCodeGen(out);
-                       break;
-               case GenGoto:
-                       if ( rubyImpl == Rubinius ) {
-                               codeGen = new RbxGotoCodeGen(out);
-                       } else {
-                               cout << "Goto style is still _very_ experimental " 
-                                       "and only supported using Rubinius.\n"
-                                       "You may want to enable the --rbx flag "
-                                       " to give it a try.\n";
-                               exit(1);
-                       }
-                       break;
-               default:
-                       cout << "Invalid code style\n";
-                       exit(1);
-                       break;
-       }
-       codeGen->sourceFileName = sourceFileName;
-       codeGen->fsmName = fsmName;
-       codeGen->wantComplete = wantComplete;
-
-       return codeGen;
-}
-
 
 void rubyLineDirective( ostream &out, const char *fileName, int line )
 {