- Joined
- Sep 26, 2009
- Messages
- 9,529
I've just published a fairly-refined version of a vJass-to-Lua macro intended to be used with NotePad++. It's lightweight, extremely fast and reversible with a simple Ctrl+Z.
www.hiveworkshop.com
The JASS version is nearly finished (the globals block is annoying to deal with and currently requires users to manage their code somewhat if they declared globals without an initialization value).
The vJass version works fairly well. I intend to do more with enabling method operators and converting "this" to "self" in non-static methods, and also intend to support hooks and properly-comment-out native declarations. Those are on my to-do list and will get done either today or tomorrow.
Overall, it's extremely handy, lightweight and fast. I've compared it to cJass2Lua:
1) cJass2Lua is flagged as a virus upon running for the first time, whereas this is just an XML file used to direct a NotePad++ macro.
2) cJass2Lua is about 200 times slower at parsing text (regex search and replace is absolutely destroying it in terms of performance).
3) cJass2Lua will just stop working if it encounters code it doesn't like, such as modules. This tool will just ignore things it doesn't understand.
4) cJass2Lua is incredibly painful to work with (spaghetti code) and requires re-compiling each time a change needs to be made. This just requires the XML be saved and NotePad++ reloaded.
5) cJass2Lua kills several vJass behaviors such as modules, function interfaces, but doesn't know what to do with them. I intend to support every popular vJass feature and have it compiled to its Lua equivalent (using vJass-style-struct where necessary).
6) cJass2Lua first converts your vJass to cJass, then it converts it to JASS, then converts it to Lua. This keeps the syntax vJass-y by skipping those 2 middle points.
7) cJass2Lua: almost 1MB and many thousands of lines of code. Barely any comments within the code makes it hard to tell what it's doing. However, this XML file is so short and straightforward that anyone should be able to pick it up and copy/edit elements within it to do what they need.
I'm extremely proud of this thing and am surprised at how easy it was to make it work. I didn't know anything about Regex until yesterday when I started digging around, and now I have translated an entire programming language using these newly-acquired skills.
I recommend this tutorial for anyone who wants to have a go at understanding/making changes to the regex code: Regular Expression Tutorial - Learn How to Use Regular Expressions
I would be curious to know if anyone here is familiar enough with regex to know if I can do what I'm doing with functions parameters without cloning the same code repeatedly whenever a new parameter is added. I can't really determine how/if function calls are supposed to work within the NotePad++ find/replace engine.

Convert vJass to Lua using NotePad++
This small macro, intended for use with NotePad++, can (nearly) instantly convert a JASS or vJass script file into a Lua script, using regex find and replace. Compared to cJass2Lua, this parses a script file 100-200 times faster, and is very easy to add onto and tweak as needed. Mistakes can be...

The JASS version is nearly finished (the globals block is annoying to deal with and currently requires users to manage their code somewhat if they declared globals without an initialization value).
The vJass version works fairly well. I intend to do more with enabling method operators and converting "this" to "self" in non-static methods, and also intend to support hooks and properly-comment-out native declarations. Those are on my to-do list and will get done either today or tomorrow.
Overall, it's extremely handy, lightweight and fast. I've compared it to cJass2Lua:
1) cJass2Lua is flagged as a virus upon running for the first time, whereas this is just an XML file used to direct a NotePad++ macro.
2) cJass2Lua is about 200 times slower at parsing text (regex search and replace is absolutely destroying it in terms of performance).
3) cJass2Lua will just stop working if it encounters code it doesn't like, such as modules. This tool will just ignore things it doesn't understand.
4) cJass2Lua is incredibly painful to work with (spaghetti code) and requires re-compiling each time a change needs to be made. This just requires the XML be saved and NotePad++ reloaded.
5) cJass2Lua kills several vJass behaviors such as modules, function interfaces, but doesn't know what to do with them. I intend to support every popular vJass feature and have it compiled to its Lua equivalent (using vJass-style-struct where necessary).
6) cJass2Lua first converts your vJass to cJass, then it converts it to JASS, then converts it to Lua. This keeps the syntax vJass-y by skipping those 2 middle points.
7) cJass2Lua: almost 1MB and many thousands of lines of code. Barely any comments within the code makes it hard to tell what it's doing. However, this XML file is so short and straightforward that anyone should be able to pick it up and copy/edit elements within it to do what they need.
I'm extremely proud of this thing and am surprised at how easy it was to make it work. I didn't know anything about Regex until yesterday when I started digging around, and now I have translated an entire programming language using these newly-acquired skills.
I recommend this tutorial for anyone who wants to have a go at understanding/making changes to the regex code: Regular Expression Tutorial - Learn How to Use Regular Expressions
I would be curious to know if anyone here is familiar enough with regex to know if I can do what I'm doing with functions parameters without cloning the same code repeatedly whenever a new parameter is added. I can't really determine how/if function calls are supposed to work within the NotePad++ find/replace engine.