summaryrefslogtreecommitdiffstats
path: root/clang/docs/tools/dump_format_style.py
diff options
context:
space:
mode:
Diffstat (limited to 'clang/docs/tools/dump_format_style.py')
-rwxr-xr-xclang/docs/tools/dump_format_style.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py
index db65e6e65b1..acb0dfcaf4a 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -77,6 +77,20 @@ class Enum(object):
def __str__(self):
return '\n'.join(map(str, self.values))
+class NestedEnum(object):
+ def __init__(self, name, enumtype, comment, values):
+ self.name = name
+ self.comment = comment
+ self.values = values
+ self.type = enumtype
+
+ def __str__(self):
+ s = '\n* ``%s %s``\n%s' % (self.type, self.name,
+ doxygen2rst(indent(self.comment, 2)))
+ s += indent('\nPossible values:\n\n', 2)
+ s += indent('\n'.join(map(str, self.values)),2)
+ return s;
+
class EnumValue(object):
def __init__(self, name, comment, config):
self.name = name
@@ -156,7 +170,12 @@ def read_options(header):
comment += clean_comment_line(line)
else:
state = State.InNestedStruct
- nested_struct.values.append(NestedField(line.replace(';', ''), comment))
+ field_type, field_name = re.match(r'([<>:\w(,\s)]+)\s+(\w+);',line).groups()
+ if field_type in enums:
+ nested_struct.values.append(NestedEnum(field_name,field_type,comment,enums[field_type].values))
+ else:
+ nested_struct.values.append(NestedField(field_type + " " + field_name, comment))
+
elif state == State.InEnum:
if line.startswith('///'):
state = State.InEnumMemberComment
OpenPOWER on IntegriCloud