4 usage: config-enum enum [file ...]
6 Returns the elements from an enum declaration.
8 "Best effort": we're not building an entire C interpreter here!
17 if (!getopts
("", \
%opts) || @ARGV < 1) {
31 last if s/\/\*.*\*\///s;
39 $in_enum = 1 if s/^\s*enum\s+${enum}(?:\s|$)//;
42 # remove explicit values
45 # extract each identifier
46 while (m/\b([a-z_][a-z0-9_]*)\b/ig) {
51 # don't exit: there may be multiple versions of the same enum, e.g.
52 # inside different #ifdef blocks. Let's explicitly return all of
53 # them and let external tooling deal with it.
55 $in_enum = 0 if m/}\s*;/;