summaryrefslogtreecommitdiff
path: root/giscanner/annotationparser.py
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-07-18 07:29:36 +0200
committerDieter Verfaillie <dieterv@optionexplicit.be>2013-10-08 20:56:03 +0200
commit3177c9868cc5daab1c7915c27e19f7236bb338df (patch)
treea2c2113e151021423d2dbdb14923702a5f22324c /giscanner/annotationparser.py
parenta769acd93913cac8871b40c90fada1fbc7419c85 (diff)
downloadgobject-introspection-3177c9868cc5daab1c7915c27e19f7236bb338df.tar.gz
giscanner: accept different forms of line breaks
Diffstat (limited to 'giscanner/annotationparser.py')
-rw-r--r--giscanner/annotationparser.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 625ffdf8..88a8c73a 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -282,6 +282,9 @@ TRANSFER_OPTIONS = [OPT_TRANSFER_CONTAINER,
OPT_TRANSFER_NONE]
+# Pattern used to normalize different types of line endings
+LINE_BREAK_RE = re.compile(r'\r\n|\r|\n', re.UNICODE)
+
# Program matching the start of a comment block.
#
# Results in 0 symbolic groups.
@@ -1143,10 +1146,7 @@ class GtkDocCommentBlockParser(object):
:returns: a :class:`GtkDocCommentBlock` object or ``None``
'''
- # Assign line numbers to each line of the comment block,
- # which will later be used as the offset to calculate the
- # real line number in the source file
- comment_lines = list(enumerate(comment.split('\n')))
+ comment_lines = list(enumerate(re.sub(LINE_BREAK_RE, '\n', comment).split('\n')))
# Check for the start the comment block.
if COMMENT_START_RE.match(comment_lines[0][1]):