Custom keyword and object type flag (solved, code attached)

Started by
16 comments, last by WitchLord 12 years, 7 months ago
Great. I took a quick look at it and it looks good.

I'll take a closer look and add some regression tests for the changes to include in the SDK as soon as possible.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
I see you have a method for class variables, but what about class functions? Looks like you got a start on it, but I don't see anything in the code that suggests that it's finding metadata for class functions.

I see you have a method for class variables, but what about class functions? Looks like you got a start on it, but I don't see anything in the code that suggests that it's finding metadata for class functions.


You are correct. That is not yet implemented, since I had no need for it, but should be quite simple to add. Just a matter of adding a few lines where the global functions are added.
I've finally checked in this improvement to the CScriptBuilder add-on. Except for a few minor tweaks and fixes I kept it pretty much as-is.

You'll find the updated version in revision 954.


Thanks a lot for the contribution.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Found a small error in the new code



if( currentClass == "" )
pos = SkipStatement(pos);
else
pos += len;


should be:





if( currentClass != "" )
pos = SkipStatement(pos);
else
pos += len;


Else it will not skip functions in classes properly.
Another thing I found. Need to add:



//Skip any white spaces in case meta data follows:
t = engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len);
while(t == asTC_COMMENT || t == asTC_WHITESPACE) {
pos += len;
t = engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len);
}


At the end of the section that checks handles the start of class, ie the one that starts with:
if( modifiedScript.substr(pos,len) == "class" )
{


Sorry for spamming changes, but seemed so small that was not worth to upload the entire code.
Thanks. I'll apply these fixes as soon as possible.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

You were right. The changes were needed, however as I applied them I saw that the code could be cleaned up a bit so I ended up doing it a bit differently.

Here's the diff for revision 958.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement