Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 11-11-2003, 12:45 PM
Eglin
Hill Giant
 
Join Date: Nov 2003
Posts: 168
Default 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;
Reply With Quote
  #2  
Old 11-11-2003, 09:09 PM
kathgar
Discordant
 
Join Date: May 2002
Posts: 434
Default

That diff was confusing me for a little whie, you took the differences between you editted copy to the CVS copy. Not really big since we would manually merge it anyways. Other than that keep up the good work and i'll talk tot he maintainer of parser.cpp
__________________
++[>++++++<-]>[<++++++>-]<.>++++[>+++++<-]>[<
+++++>-]<+.+++++++..+++.>>+++++[<++++++>-]<+
+.<<+++++++++++++++.>.+++.------.--------.>+.
Reply With Quote
  #3  
Old 11-11-2003, 10:54 PM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

Smart change, identify the filename where the error is occuring..

Appreciate the change, in the future can you also attatch a .patch file (you know, diff old.txt new.txt > oldnew.patch )

You can use the output from the boards, but the spacing gets annoying to correct.. patch can be pretty finiky..

Thanks again!
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote
  #4  
Old 11-12-2003, 09:45 AM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

I merged this in, but you made quit a few mistakes in placement of the filename.c_str() 's.

You added them onto the end of all the printf's, even when they were not the last parameter in there.
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 01:30 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3