summaryrefslogtreecommitdiff
path: root/giscanner/annotationparser.py
diff options
context:
space:
mode:
authorMathieu Duponchelle <mduponchelle1@gmail.com>2020-07-22 21:29:43 +0000
committerMathieu Duponchelle <mduponchelle1@gmail.com>2020-07-22 21:29:43 +0000
commit46d32c596cc41fd66036c648aca4900058072749 (patch)
treeb6759fc2c0cc25293b07c527b5661ecf97f33546 /giscanner/annotationparser.py
parent9f9d8cefe966d260cf8c12971dcad40537adb5c6 (diff)
parentd7504419093aef9fae802ad599cff1bf9022e24d (diff)
downloadgobject-introspection-46d32c596cc41fd66036c648aca4900058072749.tar.gz
Merge branch 'sincify-members-and-fields' into 'master'
giscanner: parse block comments for members and fields Closes #348 See merge request GNOME/gobject-introspection!230
Diffstat (limited to 'giscanner/annotationparser.py')
-rw-r--r--giscanner/annotationparser.py34
1 files changed, 32 insertions, 2 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 63212963..f8257206 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -461,6 +461,27 @@ ACTION_RE = re.compile(
''',
re.UNICODE | re.VERBOSE)
+# Pattern matching struct fields.
+FIELD_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 dot
+ \s* # 0 or more whitespace characters
+ (?P<field_name>[\w-]*\w) # field 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'''
@@ -1368,13 +1389,22 @@ class GtkDocCommentBlockParser(object):
identifier_fields = None
identifier_fields_start = None
else:
- result = SYMBOL_RE.match(line)
+ result = FIELD_RE.match(line)
if result:
- identifier_name = '%s' % (result.group('symbol_name'), )
+ identifier_name = '%s.%s' % (result.group('class_name'),
+ result.group('field_name'))
identifier_delimiter = result.group('delimiter')
identifier_fields = result.group('fields')
identifier_fields_start = result.start('fields')
+ 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