* Tweaked the loop in parse_script to better handle when the outer brackets aren't checked.

* Fixed a typo in skip_space that stopped skipping characters when it encountered a '*' or '/' in a block comment.
  ex: /* this will give a parse error after this character->* */
      /* same thing here->/ */

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11487 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
FlavioJS 2007-10-16 17:32:47 +00:00
parent 253807fc03
commit 7109831b80
2 changed files with 14 additions and 3 deletions

View File

@ -3,6 +3,11 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/10/16
* Tweaked the loop in parse_script to better handle when the outer
brackets aren't checked.
* Fixed a typo in skip_space that stopped skipping characters when it
encountered a '*' or '/' in a block comment. [FlavioJS]
2007/10/15 2007/10/15
* Fixed NPC_CRITICALWOUND to reduce heal by 20% per level [Playtester] * Fixed NPC_CRITICALWOUND to reduce heal by 20% per level [Playtester]
* Fixing TK Mission asigning non spawning mobs. [Zephyrus] * Fixing TK Mission asigning non spawning mobs. [Zephyrus]

View File

@ -461,6 +461,7 @@ static void script_reportdata(struct script_data* data)
else else
{// ??? {// ???
ShowDebug("Data: reference name='%s' type=%s\n", reference_getname(data), script_op2name(data->type)); ShowDebug("Data: reference name='%s' type=%s\n", reference_getname(data), script_op2name(data->type));
ShowDebug("Please report this!!! - str_data.type=%s\n", script_op2name(str_data[reference_getid(data)].type);
} }
break; break;
case C_POS:// label case C_POS:// label
@ -740,7 +741,7 @@ const char* skip_space(const char* p)
{ {
if( *p == '\0' ) if( *p == '\0' )
disp_error_message("script:skip_space: end of file while parsing block comment. expected "CL_BOLD"*/"CL_NORM, p); disp_error_message("script:skip_space: end of file while parsing block comment. expected "CL_BOLD"*/"CL_NORM, p);
if( *p == '*' || p[1] == '/' ) if( *p == '*' && p[1] == '/' )
{// end of block comment {// end of block comment
p += 2; p += 2;
break; break;
@ -1897,6 +1898,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
int i; int i;
struct script_code *code; struct script_code *code;
static int first=1; static int first=1;
char end;
if( src == NULL ) if( src == NULL )
return NULL;// empty script return NULL;// empty script
@ -1961,6 +1963,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
script_buf = NULL; script_buf = NULL;
return NULL; return NULL;
} }
end = '\0';
} }
else else
{// requires brackets around the script {// requires brackets around the script
@ -1975,11 +1978,13 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
script_buf = NULL; script_buf = NULL;
return NULL; return NULL;
} }
end = '}';
} }
while (*p && (*p != '}' || syntax.curly_count != 0) ) while( syntax.curly_count != 0 || *p != end )
{ {
p=skip_space(p); if( *p == '\0' )
disp_error_message("unexpected end of script",p);
// label¾¯“ÁŽê<C5BD>ˆ<CB86> // label¾¯“ÁŽê<C5BD>ˆ<CB86>
tmpp=skip_space(skip_word(p)); tmpp=skip_space(skip_word(p));
if(*tmpp==':' && !(!strncasecmp(p,"default:",8) && p + 7 == tmpp)){ if(*tmpp==':' && !(!strncasecmp(p,"default:",8) && p + 7 == tmpp)){
@ -1988,6 +1993,7 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
if( parse_options&SCRIPT_USE_LABEL_DB ) if( parse_options&SCRIPT_USE_LABEL_DB )
strdb_put(scriptlabel_db, GETSTRING(str_data[i].str), (void*)script_pos); strdb_put(scriptlabel_db, GETSTRING(str_data[i].str), (void*)script_pos);
p=tmpp+1; p=tmpp+1;
p=skip_space(p);
continue; continue;
} }