[PARSE BUG]: Problem with #if directive in enums
s33b00r opened this issue · 1 comments
s33b00r commented
Problem description
When parsing a c++ file, there seems to be a problem with enums and some preprocessor items within an enum block.
From the given code, I got this error message: parse error evaluating '#if !defined(_WIN32)': unexpected '#if !defined(_WIN32)', expected '}' or 'NAME'
C++ code that can't be parsed correctly (please double-check that https://robotpy.github.io/cxxheaderparser/ has the same error)
enum {
OK = 0,
// More enums [...]
#if !defined(_WIN32)
BAD_INDEX = -1,
// More enums [...]
#else
BAD_INDEX = -31,
// More enums [...]
#endif
UNEXPECTED_NULL = 15,
// More enums [...]
};
auscompgeek commented
Per the readme, this doesn't support preprocessor directives such as #if
.
No C preprocessor substitution support implemented. If you are parsing headers that contain macros, you should preprocess your code using the excellent pure python preprocessor pcpp or your favorite compiler