|Parsing snippet of C (macro definitions) [message #917536]
||Thu, 20 September 2012 07:12
| Federico Tomassetti
Registered: July 2009
I would like to parse the definition of macros to try to understand what they contain and categorize them. For example:
#define A 123
#define B "hello"
would be categorized as constant while
#define C 23*A
would be an expression, and so on.
I have learned ho to use CDT to parse entire files and I was wondering if it possible to use the same API to parse just a snippet of C code, so to recognize that 123 is an integer literal. Maybe I could trick the API surrounding the expression with a dummy function and assigning the value to a variable but I would try to avoid that. Any suggestion?
Powered by FUDForum
. Page generated in 0.11669 seconds