robotpy / robotpy-cppheaderparser

DEPRECATED: use cxxheaderparser instead
Other
123 stars 39 forks source link

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

Open rkocjh1997 opened 1 year ago

rkocjh1997 commented 1 year ago

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