[ragel-users] BUG while processing import directive
Denis Naumov
alexander.me at gmail.com
Mon Jul 11 09:29:51 UTC 2011
Hi, Adrian.
I found that if we use "import" directive, and import file was not
found - ragel crashes with exception.
from sources i found function
void Scanner::handleImport() in rlscan.rl.
code ===============================
ifstream *inFile = tryOpenInclude( importChecks, found );
if ( inFile == 0 )
{
scan_error() << "import: could not open import file " <<
"for reading" << endl;
char **tried = importChecks;
while ( *tried != 0 )
scan_error() << "import: attempted: \"" << *tried++ << '\"' << endl;
}
Scanner scanner( id, importChecks[found], *inFile, parser, 0,
includeDepth+1, true );
scanner.do_scan( );
scanner.importToken( 0, 0, 0 );
scanner.flushImport();
delete inFile;
==========================
this mean that Scanner will work always -
if (inFile != 0) - file was found - scanner will work ( OK )
and
if (inFile == 0) - file not found - scanner will work ( BUG )
Solution can be like in Scanner::handleInclude()
== patch 1 ============================
if ( inFile == 0 )
{
error output ....
}
else
{
Scanner ....
}
== patch 1 end ========================
or
== patch 2 ============================
like in Scanner::handleInclude()
if ( inFile == 0 )
{
error output ....
RETURN;
}
Scanner ....
== patch 2 end ========================
Best regards.
Denis.
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
More information about the ragel-users
mailing list