summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-09-28 18:59:04 -0400
committerColin Walters <walters@verbum.org>2010-09-28 19:00:12 -0400
commite70a36aa6b44a48ebcdc9a71c3d0eda4a17c119e (patch)
treece36534cf28f6dff8c2baf8b41cb40c36f9c3187
parent9d5a58a4e98a8c2160d36f5aa21489d55f49756b (diff)
downloadgobject-introspection-e70a36aa6b44a48ebcdc9a71c3d0eda4a17c119e.tar.gz
annotationparser: Don't ignore annotations if there's a : in docsGOBJECT_INTROSPECTION_0_9_8
The annotation parser changed to be stricter about annotation content, but we introduced a regression where a : in the documentation would wrongly cause the annotation to be skipped. https://bugzilla.gnome.org/show_bug.cgi?id=630862
-rw-r--r--giscanner/annotationparser.py6
-rw-r--r--tests/scanner/annotation.c14
-rw-r--r--tests/scanner/annotation.h2
3 files changed, 21 insertions, 1 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 6eacfade..5e45e5dc 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -508,7 +508,11 @@ class AnnotationParser(object):
argname = TAG_RETURNS
tag = DocTag(block, argname)
tag.set_position(block.position.offset(lineno))
- second_colon_index = line.rfind(':')
+ line_after_first_colon_space = line[first_colonspace_index + 2:]
+ second_colon_index = line_after_first_colon_space.find(':')
+ if second_colon_index >= 0:
+ second_colon_index += first_colonspace_index + 2
+ assert line[second_colon_index] == ':'
found_options = False
if second_colon_index > first_colonspace_index:
value_line = \
diff --git a/tests/scanner/annotation.c b/tests/scanner/annotation.c
index 275ec0d6..9fa422ce 100644
--- a/tests/scanner/annotation.c
+++ b/tests/scanner/annotation.c
@@ -757,3 +757,17 @@ annotation_invalid_annotation (int foo)
char backslash_parsing_tester_2 = '\\';
+
+
+/**
+ * annotation_test_parsing_bug630862:
+ *
+ * See https://bugzilla.gnome.org/show_bug.cgi?id=630862
+ *
+ * Returns: (transfer none): An object, note the colon:in here
+ */
+GObject *
+annotation_test_parsing_bug630862 (void)
+{
+ return NULL;
+}
diff --git a/tests/scanner/annotation.h b/tests/scanner/annotation.h
index e4f29065..ef05ddb2 100644
--- a/tests/scanner/annotation.h
+++ b/tests/scanner/annotation.h
@@ -156,5 +156,7 @@ struct AnnotationStruct
void annotation_ptr_array (GPtrArray *array);
+GObject * annotation_test_parsing_bug630862 (void);
+
#endif /* __ANNOTATION_OBJECT_H__ */