It was very hard to validate the content of the array (and struct) as needed, with if-else statements… So I learned to use regular expressions and made these, used them with matchAll… Now everything is working as I hoped, and it’s very fast processing huge files! 
/* Regex to remove comments */
const reComment = new RegExp(
  "(?:\\/\\*[^]*?\\*\\/)" + /* search "/ *" and any characters until "* /" */
  "|"                     + /* or */
  "(?:\\/\\/.*)"          , /* search "//" and any characters until line terminator*/ 
  "g"
);
/* Regex to search arrays to be validated afterward */
const reArray = new RegExp(
  "uint8_t"                   + /* Search "uint8_t" */
  "\\s+([^]+?)"               + /* skip at least one whitespace, capture variable name */
  "\\s*\\[\\s*(\\d*?)\\s*\\]" + /* skip any whitespaces until "[", try capture array size, skip any whitespaces until "]" */
  "\\s*\\=\\s*\\{"            + /* skip any whitespaces until "=", skip any whitespaces until "{" */
  "\\s*([^]+?)\\,?"           + /* skip any whitespaces and capture array content until a possible "," at the last value of the array */
  "\\s*\\}\\s*\\;"            , /* skip any whitespaces until "}", skip any whitespaces until ";" */
  "g"
);
/* Regex to extract arrays content, numbers from -255 to 255 and characters such as 'C' or '\n' */
const reArrayData = new RegExp(
  "\\-?\\b(?:"    + /* Optional "-", assert word boundary, followed by... */
  "[0-9]"         + /* a single digit, 0 to 9 */
  "|"             + /* or */
  "[1-9][0-9]"    + /* two digits, 10 to 99 */
  "|"             + /* or */
  "1[0-9][0-9]"   + /* three digits, 100 to 199 */
  "|"             + /* or */
  "2[0-4][0-9]"   + /* three digits, 200 to 249 */
  "|"             + /* or */
  "25[0-5]"       + /* three digits, 250 to 255 */
  ")\\b"          + /* assert word boundary */
  "|"             + /* or if it's not a number from -255 to 255 */
  "\\'\\\\?.?\\'" , /* search a "'" followed by a possible "\" (for escaped characters), followed by any character and "'" */
  "g"
);
/* Regex to search structs */
const reStruct = new RegExp(
  "struct"              + /* Search "struct" followed by */
  "(?:\\s*\\{"          + /* either any whitespaces and "{"... */
  "|"                   + /* or */
  "\\s+([^]*?)\\s*\\{)" + /* skip at least one whitespace, try capture a typename, until any whitespaces and "{"... */
  "\\s*([^]+?)\\s*\\}"  + /* skip any whitespaces, capture struct content, until any whitespaces and "}" */
  "\\s*([^]*?)\\s*\\;"  , /* skip any whitespaces, try capture object name, until any whitespaces and ";" */
  "g"
);
/* Regex to extract struct variables */
const reStructData = new RegExp(
  "(int8_t|uint8_t|char|int16_t|uint16_t|float)" + /* Capture variable type */
  "\\s+([^\\s]+?)"                               + /* skip at least one whitespace, capture variable name */
  "\\s*(?:\\[\\s*(\\d+)\\s*\\])?\\s*\\;"         , /* skip any whitespaces, possibly capture an array size between, until any whitespaces and ";" */
  "g"
);
For some reasons I needed to remove all comments in the file and replace them with spaces:
str = str.replace( reComment, m => { return " ".repeat(m.length); });
Then used matchAll and forEach like so
[...str.matchAll( reStruct )].forEach( m => {
    [...m[2].matchAll( reStructData )].forEach( m2 => {
        // etc
Maybe it can be useful for someone else 