Eglin |
11-11-2003 12:45 PM |
diff - parse errors
Small patch to include filenames in script parse error reports.
Code:
--- ./parser.h Tue Nov 11 12:44:58 2003
+++ ../../../pristine-11-10/NewSource/zone/parser.h Sun Nov 9 13:15:16 2003
@@ -84,7 +84,7 @@
int numtok(std::string text, const char * character);
- int ParseCommands(std::string text, int line, int justcheck, int32 npcid, Mob* other, Mob* mob, std::string filename = string("none"));
+ int ParseCommands(std::string text, int line, int justcheck, int32 npcid, Mob* other, Mob* mob);
int ParseIf(std::string text);
int pcalc(char * string);
void ParseVars(std::string& text, int32 npcid, Mob* mob);
--- ./parser.cpp Tue Nov 11 13:04:17 2003
+++ ../../../pristine-11-10/NewSource/zone/parser.cpp Sun Nov 9 13:15:05 2003
@@ -956,7 +956,7 @@
if (bracket == 0)
{
buffer.replace(buffer.length()-1,buffer.length(),"");
- int heh = ParseCommands(buffer,line_num,0,0,0,0, filename);
+ int heh = ParseCommands(buffer,line_num,0,0,0,0);
if (!heh) return 0;
event1->command = buffer;
buffer="";
@@ -964,7 +964,7 @@
}
if (bracket==-1)
{
- printf("Line: %d, File: %s | error C0006: syntax error : too many ')'s\n",line_num,filename.c_str());
+ printf("Line: %d | error C0006: syntax error : too many ')'s\n",line_num);
return 0;
}
}
@@ -1401,7 +1401,7 @@
return 1;
}
-int Parser::ParseCommands(string text, int line, int justcheck, int32 npcid, Mob* other, Mob* mob, std::string filename)
+int Parser::ParseCommands(string text, int line, int justcheck, int32 npcid, Mob* other, Mob* mob)
{
string buffer,command,parms,temp,temp2;
temp2 = text;
@@ -1431,7 +1431,7 @@
{
if (last_finished)
{
- printf("Line: %d, File: %s | error C0008: syntax error : missing ';' before function '%s'\n", line, command.c_str(), filename.c_str());
+ printf("Line: %d | error C0008: syntax error : missing ';' before function '%s'\n", line, command.c_str());
return 0;
}
command = buffer;
@@ -1439,7 +1439,7 @@
argnums = GetArgs(command);
if (argnums == -1)
{
- printf("Line: %d, File: %s | error C0007: '%s' : Unknown function\n", line, command.c_str(), filename.c_str());
+ printf("Line: %d | error C0007: '%s' : Unknown function\n", line, command.c_str());
return 0;
}
}
@@ -1459,7 +1459,7 @@
}
if (paren<0)
{
- printf("Line: %d, File: %s | error C0006: syntax error : too many ')'s\n",line, filename.c_str());
+ printf("Line: %d | error C0006: syntax error : too many ')'s\n",line);
return 0;
}
}
@@ -1479,12 +1479,12 @@
bracket--;
if (last_finished)
{
- printf("Line: %d, File: %s | error C0008: syntax error : missing ';' before '}'\n", line, filename.c_str());
+ printf("Line: %d | error C0008: syntax error : missing ';' before '}'\n", line);
return 0;
}
if (bracket<0)
{
- printf("Line: %d, File: %s | error C0006: syntax error : too many '}'s\n",line, filename.c_str());
+ printf("Line: %d | error C0006: syntax error : too many '}'s\n",line);
return 0;
}
if (bracket == 0)
@@ -1501,7 +1501,7 @@
last_finished=0;
if (argnums != 1 && argnums!=argit)
{
- printf("Line: %d, File: %s | error C0001: '%s' : function does not take %d parameter(s)\n", line, command.c_str(), argit, filename.c_str());
+ printf("Line: %d | error C0001: '%s' : function does not take %d parameter(s)\n", line, command.c_str(), argit);
return 0;
}
if (!justcheck)
@@ -1509,7 +1509,7 @@
argit=1;
}
else {
- printf("Line: %d, File: %s | error C0002: '%s' :syntax error : '(' %d '('s still not closed.\n", line, command.c_str(), paren, filename.c_str());
+ printf("Line: %d | error C0002: '%s' :syntax error : '(' %d '('s still not closed.\n", line, command.c_str(), paren);
}
}
if (escape) escape--;
@@ -1517,7 +1517,7 @@
}
if (last_finished)
{
- printf("Line: %d, File: %s | error C0008: syntax error : missing ';' before '}'\n", line, filename.c_str());
+ printf("Line: %d | error C0008: syntax error : missing ';' before '}'\n", line);
return 0;
}
return 1;
|