tizen 2.3.1 release
[external/ragel.git] / ragel / rlscan.rl
index 3c325c3..68c9c22 100644 (file)
@@ -413,6 +413,7 @@ void Scanner::handleImport()
                if ( active() && machineSpec == 0 && machineName == 0 ) {
                        InputItem *inputItem = new InputItem;
                        inputItem->type = InputItem::Write;
+                       inputItem->loc.fileName = fileName;
                        inputItem->loc.line = line;
                        inputItem->loc.col = column;
                        inputItem->name = parser->sectionName;
@@ -555,18 +556,21 @@ bool isAbsolutePath( const char *path )
 char **Scanner::makeIncludePathChecks( const char *thisFileName, 
                const char *fileName, int fnlen )
 {
-       char **checks = new char*[2];
+       char **checks = 0;
        long nextCheck = 0;
-
-       bool caseInsensitive = false;
        long length = 0;
+       bool caseInsensitive = false;
        char *data = prepareLitString( InputLoc(), fileName, fnlen, 
                        length, caseInsensitive );
 
        /* Absolute path? */
-       if ( isAbsolutePath( data ) )
+       if ( isAbsolutePath( data ) ) {
+               checks = new char*[2];
                checks[nextCheck++] = data;
+       }
        else {
+               checks = new char*[2 + id.includePaths.length()];
+
                /* Search from the the location of the current file. */
                const char *lastSlash = strrchr( thisFileName, PATH_SEP );
                if ( lastSlash == 0 )
@@ -933,7 +937,7 @@ ifstream *Scanner::tryOpenInclude( char **pathChecks, long &found )
 
        # Parser definitions. 
        parser_def := |*
-               'length_cond' => { token( KW_Length ); };
+               #'length_cond' => { token( KW_Length ); };
                'machine' => { token( KW_Machine ); };
                'include' => { token( KW_Include ); };
                'import' => { token( KW_Import ); };