ned14 / pcpp

A C99 preprocessor written in pure Python
Other
215 stars 39 forks source link

Avoid macro expansion #67

Open soumyaranjansabat opened 2 years ago

soumyaranjansabat commented 2 years ago

How can only the #if and #else be evaluated and pre-processed and avoid macro expansion of any available macros in the code?

Tried overiridng with few PreprocessorHooks but unsuccessful. Would really appreciate some help.

Input

define PARAM_A STD_ON

define LOOPVAL 3

if (PARAM_A== STD_ON)

while(iter < LOOPVAL ) {

}

endif

Expected Output while(iter < LOOPVAL ) {

}

Not Expected Output while(iter < 3) {

}

Similarly for other macro like functions etc.

ned14 commented 2 years ago

Supply me your PreprocessorHooks implementation and I'll take a look.