From: José Fonseca Date: Sat, 28 Apr 2012 22:21:58 +0000 (+0100) Subject: Try to interpret the SAL annotations. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=cb07b607f43573ce93884a1b1cb49e7b80ea2b3e;p=apitrace Try to interpret the SAL annotations. --- diff --git a/specs/scripts/cdecl.py b/specs/scripts/cdecl.py index bc5bcd1..3d02d53 100755 --- a/specs/scripts/cdecl.py +++ b/specs/scripts/cdecl.py @@ -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:]