Skip to content

Instantly share code, notes, and snippets.

@rikkimax
Last active August 29, 2015 13:57
Show Gist options
  • Save rikkimax/9566069 to your computer and use it in GitHub Desktop.
Save rikkimax/9566069 to your computer and use it in GitHub Desktop.
{
Include: test.h
Include: test2.h
Unknown: {
something
}
Condition: 1 + 1 == 2 {
}
Unknown: {
woot
}
End condition
Condition: defined _WIN32 {
}
Unknown: {
is windows
}
Else condition: defined __unix__ {
}
Unknown: {
is unix
}
End condition
Define variable: PI {
3.14159
}
Undefine: PI
Define function: RADTODEG(x) {
((x) * 57.29578)
}
}
module main;
import defs;
import parser;
import std.stdio;
void main() {
PPFile file = PPFile("""
#include \"test.h\"
#include <test2.h>
something
#if 1 + 1 == 2
woot
#endif
#ifdef _WIN32
is windows
#elif defined __unix__
is unix
#endif
#define PI 3.14159
#undef PI
#define RADTODEG(x) ((x) * 57.29578)
""");
executePPParser(file);
writeln(file.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment