summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-06-06 17:42:44 -0700
committerElliott Hughes <enh@google.com>2012-06-06 17:44:43 -0700
commit4825756c621ff709079ef3cd3f981e7036c0ebdb (patch)
tree29f2db93457dc7eca2ccc95d20e0e159283e9edf /tools
parent6c564a8138d1b2a230d55e1f5850a95b6fb42582 (diff)
downloadart-4825756c621ff709079ef3cd3f981e7036c0ebdb.zip
art-4825756c621ff709079ef3cd3f981e7036c0ebdb.tar.gz
art-4825756c621ff709079ef3cd3f981e7036c0ebdb.tar.bz2
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
Diffstat (limited to 'tools')
-rwxr-xr-xtools/generate-operator-out.py12
1 files changed, 9 insertions, 3 deletions
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 @@ _NAMESPACES = {}
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 @@ def ProcessFile(filename):
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 @@ def ProcessFile(filename):
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