The parserExists function should be called before active is checked.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sun, 11 Feb 2007 06:30:54 +0000 (06:30 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sun, 11 Feb 2007 06:30:54 +0000 (06:30 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@97 052ea7fc-9027-0410-9066-f65837a77df0

ragel/rlscan.rl

index 8cbd2f2..34b3fcc 100644 (file)
@@ -144,7 +144,7 @@ bool Scanner::parserExists()
                return true;
 
        if ( ! parserExistsError ) {
-               scan_error() << "include: there is no previous specification name" << endl;
+               scan_error() << "there is no previous specification name" << endl;
                parserExistsError = true;
        }
        return false;
@@ -245,7 +245,7 @@ void Scanner::token( int type )
 
        action handle_include
        {
-               if ( active && parserExists() ) {
+               if ( parserExists() && active ) {
                        char *inclSectionName = word;
                        char *inclFileName = 0;
 
@@ -295,6 +295,7 @@ void Scanner::token( int type )
 
        action write_command
        {
+               parserExists();
                if ( active && machineSpec == 0 && machineName == 0 ) {
                        output << "<write"
                                        " def_name=\"" << parser->sectionName << "\""
@@ -324,7 +325,7 @@ void Scanner::token( int type )
        action handle_token
        {
                /* Send the token off to the parser. */
-               if ( active && parserExists() ) {
+               if ( parserExists() && active ) {
                        InputLoc loc;
 
                        #if 0
@@ -400,7 +401,7 @@ void Scanner::endSection( )
        }%%
 
        /* Close off the section with the parser. */
-       if ( active && parserExists() ) {
+       if ( parserExists() && active ) {
                InputLoc loc;
                loc.fileName = fileName;
                loc.line = line;