Take the 2-minute tour ×  I'm trying to extract specific hard
coded variables from C source code. My remaining problem is that
I'd like to parse array initialisation, for example:  #define
SOMEVAR { {T_X, {1, 2}}, {T_Y, {3, 4}} }  It's enough to parse
this example into "{T_X, {1, 2}}" and "{T_Y, {3, 4}}", since
it's then possible to recurse to get the full structure.
However, it needs to be sufficiently general so as to be able to
parse any user defined types.  Even better would be a list of
regular expressions that can be used to extra values from
general C code constructs like #define, enums and global
variables.  The C code is provided to me, so I have no control
over it. I'd rather not write a function that parses it a
character at a time. However, it'd be OK to have a sequence of
regular expressions.  This is not a problem of getting files
into MATLAB or basic regular expressions. I'm after a specific
regular expression that preserves groupings by brackets.  EDIT:
Looks like regular expressions don't do