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 )
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;
}
/* 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 );
if ( gblErrorCount > 0 )
exit(1);
}
-
+
+ id.verifyWritesHaveData();
+ if ( gblErrorCount > 0 )
+ exit(1);
+
/*
* From this point on we should not be reporting any errors.
*/
{
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 );