]> git.cworth.org Git - apitrace/commitdiff
Try to interpret the SAL annotations.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 28 Apr 2012 22:21:58 +0000 (23:21 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 28 Apr 2012 22:21:58 +0000 (23:21 +0100)
specs/scripts/cdecl.py

index bc5bcd1a04f1d8e9acf6862f0ec951ba8111fd24..3d02d5321d95fc7ad1023d5c2b0bc1946398beea 100755 (executable)
@@ -36,7 +36,7 @@ import optparse
 
 class DeclParser:
 
-    token_re = re.compile(r'(\d[x0-9a-fA-F.UL]*|\w+|\s+|.)')
+    token_re = re.compile(r'(\d[x0-9a-fA-F.UL]*|\w+|\s+|"[^"]*"|.)')
 
     multi_comment_re = re.compile(r'/\*.*?\*/', flags = re.DOTALL)
     single_comment_re = re.compile(r'//.*',)
@@ -301,6 +301,22 @@ class DeclParser:
                 tag = self.consume()
                 tags.append(tag)
             self.consume(']')
+            if tags[0] == 'annotation':
+                assert tags[1] == '('
+                assert tags[3] == ')'
+                tags = tags[2]
+                assert tags[0] == '"'
+                assert tags[-1] == '"'
+                tags = tags[1:-1]
+                try:
+                    tags, args = tags.split('(')
+                except ValueError:
+                    pass
+                assert tags[0] == '_'
+                assert tags[-1] == '_'
+                tags = tags[1:-1]
+                tags = tags.lower()
+                tags = tags.split('_')
         if self.lookahead().startswith('__'):
             # Parse __in, __out, etc tags
             tag = self.consume()[2:]