• Create Account

### #Actualalnite

Posted 27 September 2012 - 12:13 PM

Some languages are blessed with preprocessor directives, but there are other languages that don't have them for various reasons.

So then my question is this: Is there a generic preprocessor tools out there where you can inject a few rules, process any text files, and output the result to new text files.

If the file was a Java source code, and DEBUG was set to false, it would preprocess them like this:
//#if DEBUG
int var = 10 + debugValue;
//#else
int var = 10;
//#endif

Output:
//#if DEBUG
//	 int var = 10 + debugValue;
//#else
int var = 10;
//#endif


If it was Python:
##if DEBUG
var = 10 + debugValue
##else
var = 10;
##endif

Output:
##if DEBUG
#	 var = 10 + debugValue
##else
var = 10;
##endif


And as you can see, you can extend this to any programming languages or scripts (HTML, CSS, bash, anything) that don't support preprocessor directives natively but support comments. Alas, I can't find any good tools that can do this seemingly-straightforward task properly.

### #2alnite

Posted 27 September 2012 - 12:10 PM

Some languages are blessed with preprocessor directives, but there are other languages that don't have them for various reasons.

So then my question is this: Is there a generic preprocessor tools out there where you can inject a few rules, process any text files, and output the result to new text files.

If the file is a Java source code, and DEBUG is set to false, it will preprocess them like this:
//#if DEBUG
int var = 10 + debugValue;
//#else
int var = 10;
//#endif

Output:
//#if DEBUG
//     int var = 10 + debugValue;
//#else
int var = 10;
//#endif


If it was Python:
##if DEBUG
var = 10 + debugValue
##else
var = 10;
##endif

Output:
##if DEBUG
#	 var = 10 + debugValue
##else
var = 10;
##endif


And as you can see, you can extend this to any programming languages (HTML, CSS, bash, anything) that don't support preprocessor directives natively. Alas, I can't find any good tools that can do this seemingly-straightforward task properly.

### #1alnite

Posted 27 September 2012 - 12:09 PM

Some languages are blessed with preprocessor directives, but there are other languages that don't have them for various reasons.

So then my question is this: Is there a generic preprocessor tools out there where you can inject a few rules, process any text files, and output the result to new text files.

If the file is a Java source code, it will preprocess them like this:
//#if DEBUG
int var = 10 + debugValue;
//#else
int var = 10;
//#endif


If it was Python:
##if DEBUG
var = 10 + debugValue
##else
var = 10;
##endif


And as you can see, you can extend this to any programming languages (HTML, CSS, bash, anything) that don't support preprocessor directives natively. Alas, I can't find any good tools that can do this seemingly-straightforward task properly.

PARTNERS