robotpy-cppheaderparser icon indicating copy to clipboard operation
robotpy-cppheaderparser copied to clipboard

[BUG]: Can't get `array_size`when the number inside the parentheses`()`

Open rkocjh1997 opened this issue 1 year ago • 0 comments

Problem description

First, I have a header file, just like:

#define POINT_SIZE (80)

typedef struct
{
    uint32_t lat[POINT_SIZE];
    uint32_t lon[POINT_SIZE];
} LINEAR_OBJECT;

Then, I preprocessed the header by using PCPP, the header:

typedef struct
{
    uint32_t lat[(80)];
    uint32_t lon[(80)];
} LINEAR_OBJECT;

I parse this header, but I can't get array_size. After investigation, the code that caused this problem was found(line 3326). If modify it like this, the problem can be solved

                    # self.nameStack[: bracePos + 1] + self.nameStack[endParen + 1 :] # original code
                    self.nameStack[: bracePos + 1] + self.nameStack[parenPos + 1 : endParen] + self.nameStack[endParen + 1 :] # modified code

Operating System

Linux

Installed Python Packages

No response

Reproducible example code

No response

rkocjh1997 avatar Jul 04 '23 09:07 rkocjh1997