diff options
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/annotationparser.py | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index 9ab629b3..16a66f33 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -440,6 +440,27 @@ SIGNAL_RE = re.compile( ''', re.UNICODE | re.VERBOSE) +# Pattern matching action identifiers. +ACTION_RE = re.compile( + r''' + ^ # start + \s* # 0 or more whitespace characters + (?P<class_name>[\w]+) # class name + \s* # 0 or more whitespace characters + \|{1} # 1 required vertical bar + \s* # 0 or more whitespace characters + (?P<action_name>[\w-]+\.[\w-]+) # action name + \s* # 0 or more whitespace characters + (?P<delimiter>:?) # delimiter + \s* # 0 or more whitespace characters + (?P<fields>.*?) # annotations + description + \s* # 0 or more whitespace characters + :? # invalid delimiter + \s* # 0 or more whitespace characters + $ # end + ''', + re.UNICODE | re.VERBOSE) + # Pattern matching parameters. PARAMETER_RE = re.compile( r''' @@ -1338,13 +1359,22 @@ class GtkDocCommentBlockParser(object): identifier_fields = result.group('fields') identifier_fields_start = result.start('fields') else: - result = SYMBOL_RE.match(line) + result = ACTION_RE.match(line) if result: - identifier_name = '%s' % (result.group('symbol_name'), ) - identifier_delimiter = result.group('delimiter') - identifier_fields = result.group('fields') - identifier_fields_start = result.start('fields') + identifier_name = 'ACTION:%s:%s' % (result.group('class_name'), + result.group('action_name')) + identifier_delimiter = None + identifier_fields = None + identifier_fields_start = None + else: + result = SYMBOL_RE.match(line) + + if result: + identifier_name = '%s' % (result.group('symbol_name'), ) + identifier_delimiter = result.group('delimiter') + identifier_fields = result.group('fields') + identifier_fields_start = result.start('fields') if result: in_part = PART_IDENTIFIER @@ -2117,7 +2147,7 @@ class GtkDocCommentBlockWriter(object): lines = [] # Identifier part - if block.name.startswith('SECTION'): + if block.name.startswith('SECTION') or block.name.startswith('ACTION'): lines.append(block.name) else: if block.annotations: |