jsmacro
jsmacro copied to clipboard
Allow @include within @ifdefs to conditionally include files
I think this requires the parsing to be rewritten to go line by line instead of how it is now. Consider for example:
//@define DEBUG 0
var foo = function() {
//@if DEBUG
// define inside if needs to work first, and is simpler to demonstrate.
//@define FOO 1
//@end
var bar = "Hello World";
//@if FOO
alert('This.');
alert('That.');
//@end
};
The way the parsing works now, no matter how you order things, you will never get the expected result. If you parse defines first, you will always get FOO defined to 1, even if DEBUG is 0, and if you parse if/ifdef/else/end first, DEBUG will not have been defined yet.