summaryrefslogtreecommitdiff
path: root/giscanner/annotationparser.py
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-08-23 17:01:01 +0200
committerDieter Verfaillie <dieterv@optionexplicit.be>2013-10-08 20:57:20 +0200
commitce352de62e1ccc9ecaa2649d85569acc272ee0ed (patch)
treeffc00c9c149795ed95b2486b1f95a7800de64a8d /giscanner/annotationparser.py
parent001631bf9b9e672154492bf6547c0c7c985ed3e0 (diff)
downloadgobject-introspection-ce352de62e1ccc9ecaa2649d85569acc272ee0ed.tar.gz
giscanner: complain about text before the ' * '
Makes our GTK-Doc comment block rewriting tool halt on such issues, requireing user intervention instead of writing back even more bogus data.
Diffstat (limited to 'giscanner/annotationparser.py')
-rw-r--r--giscanner/annotationparser.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 7b7d0d1d..244df114 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -324,6 +324,8 @@ COMMENT_ASTERISK_RE = re.compile(
r'''
^ # start
\s* # 0 or more whitespace characters
+ (?P<comment>.*?) # invalid comment text
+ \s* # 0 or more whitespace characters
\* # 1 asterisk character
\s? # 0 or 1 whitespace characters
# WARNING: removing more than 1
@@ -1213,6 +1215,13 @@ class GtkDocCommentBlockParser(object):
# Get rid of the ' * ' at the start of the line.
result = COMMENT_ASTERISK_RE.match(line)
if result:
+ comment = result.group('comment')
+ if comment:
+ marker = ' ' * result.start('comment') + '^'
+ error('invalid comment text:\n%s\n%s' %
+ (original_line, marker),
+ position)
+
column_offset = result.end(0)
line = line[result.end(0):]