Last Update - 12/25/2013
Here are a few functions that will take any Autoit code and convert it to RTF format with AutoIt syntax highlighted.
The code can be saved or applied right to the RichEdit control you are working with.
Special thanks go to MrCreator. A good amount of ideas for different parts of the code and regular expressions came from studying his Autoit Syntax Highlight for HTML\BBCode. Viewing how he handled certain situations was very helpful. Thanks to Robjong also for feedback on some of the SRE expressions.
Update - 12/25/2013
Fixed incorrect coloring for INI functions
Update - 10/29/2013
Heres my latest version. Its been completly rewritten in assembly and is working very fast. The previous version for this library worked by checking for each catagory (variable, keyword, string, etc) one catagory at a time using reg expressions. The libaray works by walking the data one time adds the coloring each time it hits a catagory. Each time we hit a catogory, we jump to that catagoys procedure and continue processing until that catagory is over, then return to the main loop, or another catagorey. This make processing parts like comments and strings very fast.
For strings Im passing the data to an autoit function for the send keys. For the UDFs im also passing the data to an auto it function, but only to check if its a function, not modify any data. Using a dictionary, I setup a structure where the key is the function name and the item for that key is the length. Checking to see if a key exists in a dictionary is very fast, so is the lookup so if it is a key, I pass back the length of the funtion, along with the function type (Native, UDF, Keyword). Code for Native functions and Keywords are built into the assembly code, the reason they are also in the udfs is for case insensitve checks. The assembly code then adds the coloring and copys the bytes specifed by the length.
There full assembly code is in the build folder. That includes everything you need compile the full function if you wanted to change it somehow. Theres also a short little brief on assembly code in general and working with strings in assembly.
Update - 10/20/2013
Please let me know if you have any problems. Thanks
RESHv2.3.zip 25.23KB 168 downloads
RESHv3.1.zip 155.52KB 203 downloads
Edited by Beege, 25 December 2013 - 10:49 AM.