[英]Best approach to parsing a *.c/*.h files using C# for declarations and data type definitions
I need to parse .c/ .h files for the data declaration and extract the type declarations. 我需要解析.c / .h文件以获取数据声明并提取类型声明。 For example, I might need to extract the variable declaration and it corresponding data type that might look like: 例如,我可能需要提取变量声明及其对应的数据类型,如下所示:
typedef union
{
struct
{
unsigned char OG15 : 1,
...
OG0 : 1;
} Bits;
unsigned short Packed;
} OUTPUT_DESCRIPTOR;
OUTPUT_DESCRIPTOR DiscreteWord1;
So my questions would be (using C#): 所以我的问题是(使用C#):
Thx 谢谢
Mark 标记
Not sure whether any of this is the best approach, but I can propose two working approaches: 不知道这是否是最好的方法,但是我可以提出两种可行的方法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.