Hi all, I am trying to write a regex to solve the below C struct for one of our requirement. I am parsing the C structure file. In that I will have child and parent struct. The child will inherit parent struct members. I want the output, which consists of struct members and there length for further processing
INPUT:
#define Len1 10;
#define Len2 20;
#define Len3 3;
#define Len4 4;
typedef struct
{
char CHAR1 [Len1];
char CHAR2 [Len2];
} MyParent;
typedef struct
{
MyParent base;
char CHAR3 [Len3];
char CHAR4 [Len4];
} MyChild;
In the above I have to get: below OUTPUT:
CHAR1 10
CHAR2 20
CHAR3 3
CHAR4 4
The Perl Script will be really helpfull;