The terminateAllParsers function moved into InputData.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Mon, 16 Mar 2009 01:58:23 +0000 (01:58 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Mon, 16 Mar 2009 01:58:23 +0000 (01:58 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@742 052ea7fc-9027-0410-9066-f65837a77df0

ragel/inputdata.cpp
ragel/inputdata.h
ragel/main.cpp
ragel/parsedata.cpp
ragel/ragel.h

index f2831e0..9e464d3 100644 (file)
@@ -195,6 +195,20 @@ void InputData::generateReduced()
        }
 }
 
+/* Send eof to all parsers. */
+void InputData::terminateAllParsers( )
+{
+       /* FIXME: a proper token is needed here. Suppose we should use the
+        * location of EOF in the last file that the parser was referenced in. */
+       InputLoc loc;
+       loc.fileName = "<EOF>";
+       loc.line = 0;
+       loc.col = 0;
+       for ( ParserDict::Iter pdel = parserDict; pdel.lte(); pdel++ )
+               pdel->value->token( loc, Parser_tk_eof, 0, 0 );
+}
+
+
 void InputData::writeOutput()
 {
        if ( generateDot ) {
index 93550fa..8ccabeb 100644 (file)
@@ -48,6 +48,7 @@ struct InputData
        void openOutput();
        void generateReduced();
        void prepareMachineGen();
+       void terminateAllParsers();
 
        void cdDefaultFileName( const char *inputFile );
        void javaDefaultFileName( const char *inputFile );
index 53ac915..970fefc 100644 (file)
@@ -469,19 +469,7 @@ void process( const char *inputFileName )
        /* Finished, final check for errors.. */
        if ( gblErrorCount > 0 )
                exit(1);
-       
-       /* Now send EOF to all parsers. */
-       terminateAllParsers();
-
-       /* Finished, final check for errors.. */
-       if ( gblErrorCount > 0 )
-               exit(1);
-
-       /* Bail on above error. */
-       if ( gblErrorCount > 0 )
-               exit(1);
 
-       /* Locate the backend program */
        if ( generateDot ) {
                wantComplete = false;
                outputActive = false;
@@ -489,6 +477,14 @@ void process( const char *inputFileName )
 
        InputData inputData( inputFileName, outputActive, wantComplete );
 
+       /* Now send EOF to all parsers. */
+       inputData.terminateAllParsers();
+
+       /* Bail on above error. */
+       if ( gblErrorCount > 0 )
+               exit(1);
+
+       /* Locate the backend program */
        /* Compiles machines. */
        inputData.prepareMachineGen();
 
index a534348..6ff3e75 100644 (file)
@@ -1449,19 +1449,6 @@ void ParseData::generateReduced( InputData &inputData )
        }
 }
 
-/* Send eof to all parsers. */
-void terminateAllParsers( )
-{
-       /* FIXME: a proper token is needed here. Suppose we should use the
-        * location of EOF in the last file that the parser was referenced in. */
-       InputLoc loc;
-       loc.fileName = "<EOF>";
-       loc.line = 0;
-       loc.col = 0;
-       for ( ParserDict::Iter pdel = parserDict; pdel.lte(); pdel++ )
-               pdel->value->token( loc, Parser_tk_eof, 0, 0 );
-}
-
 void writeLanguage( std::ostream &out )
 {
        out << " lang=\"";
index 7a5dcd0..1372120 100644 (file)
@@ -96,7 +96,6 @@ std::ostream &warning( const InputLoc &loc );
 
 struct XmlParser;
 
-void terminateAllParsers( );
 void xmlEscapeHost( std::ostream &out, char *data, long len );
 
 typedef Vector<const char *> ArgsVector;