Advertisement

Change '' '' statements

Started by May 21, 2006 01:37 PM
6 comments, last by GameDev.net 18 years, 6 months ago
I want to change the sintax of angelscript from: function() { ... } to something like function() if( ... ) ... end if ( ... ) .. else .. end end But I dont know where to start. Its posible? [Edited by - Dokam on May 21, 2006 2:03:46 PM]
Acheivable with macro abuse.
Advertisement
You'll want to change the as_parser.cpp file, so that it parses the statement blocks correctly.

Take a look at the method asCParser::ParseStatementBlock() and how it is used. Your first change would be for it to not require the start token '{', and then you can rename the end token '}' to 'end' in the as_tokendef.h. Another change is to always require a statement block after if statements, as currently a statement block or a single statement is allowed.

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

Thanks for the info, im on the right way now.

Another question, could I configure the language not case sensitive? I dont like scripters go with case sensitive problems when naming and using variables and function names.
You'll have to see if WL has done all the string comparisons through one function, or just used strcmp all over the place. If the latter, do a 'find in files' for whatever function he is using, and change it to your own.
You should take a look at the as_tokenizer.cpp, and modify it to convert characters to lowercase as it tokenizes the script.

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
This is not a bad idea. Maybe there should be an option for the engine to use case insensitive syntax (when parsing)?
Quote: Original post by gilad_novik
This is not a bad idea. Maybe there should be an option for the engine to use case insensitive syntax (when parsing)?

maybe via some sort of optional #pragma-like statement at the beginning of each script?

This topic is closed to new replies.

Advertisement