[gobject-introspection] annotationparser: Don't ignore annotations if there's a : in docs
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] annotationparser: Don't ignore annotations if there's a : in docs
- Date: Tue, 28 Sep 2010 23:07:45 +0000 (UTC)
commit e70a36aa6b44a48ebcdc9a71c3d0eda4a17c119e
Author: Colin Walters <walters verbum org>
Date: Tue Sep 28 18:59:04 2010 -0400
annotationparser: Don't ignore annotations if there's a : in docs
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
giscanner/annotationparser.py | 6 +++++-
tests/scanner/annotation.c | 14 ++++++++++++++
tests/scanner/annotation.h | 2 ++
3 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 6eacfad..5e45e5d 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 275ec0d..9fa422c 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 e4f2906..ef05ddb 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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]