X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=ragel%2Fmain.cpp;h=2b54b511e1f4486ae77b60f6399f9b157fe0873a;hb=refs%2Fheads%2Ftizen_2.3.1;hp=a16a50a3974946d4f29688d22ea78f74c2269a09;hpb=f1567f9b225bf5046716296e7a43349d11feb5dc;p=external%2Fragel.git diff --git a/ragel/main.cpp b/ragel/main.cpp index a16a50a..2b54b51 100644 --- a/ragel/main.cpp +++ b/ragel/main.cpp @@ -336,16 +336,17 @@ void processArgs( int argc, const char **argv, InputData &id ) printStatistics = true; break; case '-': { - char *eq = strchr( pc.paramArg, '=' ); + char *arg = strdup( pc.paramArg ); + char *eq = strchr( arg, '=' ); if ( eq != 0 ) *eq++ = 0; - if ( strcmp( pc.paramArg, "help" ) == 0 ) + if ( strcmp( arg, "help" ) == 0 ) usage(); - else if ( strcmp( pc.paramArg, "version" ) == 0 ) + else if ( strcmp( arg, "version" ) == 0 ) version(); - else if ( strcmp( pc.paramArg, "error-format" ) == 0 ) { + else if ( strcmp( arg, "error-format" ) == 0 ) { if ( eq == 0 ) error() << "expecting '=value' for error-format" << endl; else if ( strcmp( eq, "gnu" ) == 0 ) @@ -355,12 +356,13 @@ void processArgs( int argc, const char **argv, InputData &id ) else error() << "invalid value for error-format" << endl; } - else if ( strcmp( pc.paramArg, "rbx" ) == 0 ) + else if ( strcmp( arg, "rbx" ) == 0 ) rubyImpl = Rubinius; else { error() << "--" << pc.paramArg << " is an invalid argument" << endl; } + free( arg ); break; } @@ -448,6 +450,7 @@ void process( InputData &id ) /* Make the first input item. */ InputItem *firstInputItem = new InputItem; firstInputItem->type = InputItem::HostData; + firstInputItem->loc.fileName = id.inputFileName; firstInputItem->loc.line = 1; firstInputItem->loc.col = 1; id.inputItems.append( firstInputItem ); @@ -482,7 +485,11 @@ void process( InputData &id ) if ( gblErrorCount > 0 ) exit(1); } - + + id.verifyWritesHaveData(); + if ( gblErrorCount > 0 ) + exit(1); + /* * From this point on we should not be reporting any errors. */ @@ -507,7 +514,7 @@ char *makeIntermedTemplate( const char *baseFileName ) { char *result = 0; const char *templ = "ragel-XXXXXX.xml"; - char *lastSlash = strrchr( baseFileName, '/' ); + const char *lastSlash = strrchr( baseFileName, '/' ); if ( lastSlash == 0 ) { result = new char[strlen(templ)+1]; strcpy( result, templ );