.developing preprocessor

git-svn-id: svn://ultimatepp.org/upp/trunk@8156 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-02-08 18:13:21 +00:00
parent 9588f09099
commit 5193e84ff2
3 changed files with 10 additions and 7 deletions

View file

@ -250,6 +250,12 @@ String Cpp::Preprocess(Stream& in, bool needresult)
result.Cat("\n");
if(strncmp(s + 1, "define", 6) == 0)
Define(s + 7);
else
if(strncmp(s + 1, "undef", 5) == 0) {
CParser p(s + 6);
if(p.IsId())
macro.UnlinkKey(p.ReadId());
}
}
else
if(needresult)

View file

@ -5,13 +5,6 @@
using namespace Upp;
class CT {
public:
struct ST : Moveable<ST> {
int x, y;
};
};
struct CppMacro : Moveable<CppMacro> {
String body;
Index<String> param;

View file

@ -13,6 +13,10 @@ TEST second line
TEST // TEST
#undef TEST
This should not be expanded, it was undefined: TEST
#define __Expand1(x) x(1)
#define __Expand2(x) __Expand1(x) x(2)
#define __Expand3(x) __Expand2(x) x(3)