Auto-generate operator<< for enum ::art:Class::Status.
This requires a bit more work in the script to support
enums nested inside classes.
Change-Id: Id0e3561c3675214f74f47ac9f36ba82c41fa775d
diff --git a/tools/generate-operator-out.py b/tools/generate-operator-out.py
index ba2b4d1..23d6d3e 100755
--- a/tools/generate-operator-out.py
+++ b/tools/generate-operator-out.py
@@ -45,6 +45,7 @@
def Confused(filename, line_number, line):
sys.stderr.write('%s:%d: confused by:\n%s\n' % (filename, line_number, line))
+ raise Exception("giving up!")
sys.exit(1)
@@ -83,7 +84,7 @@
continue
# Is this the start or end of an enclosing class or struct?
- m = re.compile(r'^(?:class|struct) (\S+) \{').search(raw_line)
+ m = re.compile(r'^(?:class|struct)(?: MANAGED)? (\S+).* \{').search(raw_line)
if m:
enclosing_classes.append(m.group(1))
continue
@@ -102,8 +103,13 @@
in_enum = False
continue
- # Whitespace?
- line = raw_line.strip()
+ # Strip // comments.
+ line = re.sub(r'//.*', '', raw_line)
+
+ # Strip whitespace.
+ line = line.strip()
+
+ # Skip blank lines.
if len(line) == 0:
continue