diff options
author | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-05-15 22:48:42 +0200 |
---|---|---|
committer | Dieter Verfaillie <dieterv@optionexplicit.be> | 2013-10-08 20:54:43 +0200 |
commit | 8d9396f9b3253bff876456ec695bcea7cbbf7a69 (patch) | |
tree | 7256bd0097818045e2fba5228dffebc5e6058ca8 | |
parent | e88a99496cf4091ec16670a2fe656878fc055692 (diff) | |
download | gobject-introspection-8d9396f9b3253bff876456ec695bcea7cbbf7a69.tar.gz |
giscanner: expand parse_comment_block() parameters
Makes it consistent with the parse_comment_blocks() and
_parse_comment_block() methods.
-rw-r--r-- | giscanner/annotationparser.py | 14 | ||||
-rw-r--r-- | tests/scanner/annotationparser/test_parser.py | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py index 3b9b90a9..40a01401 100644 --- a/giscanner/annotationparser.py +++ b/giscanner/annotationparser.py @@ -841,13 +841,13 @@ class GtkDocCommentBlockParser(object): comment_blocks = {} - for comment in comments: + for (comment, filename, lineno) in comments: try: - comment_block = self.parse_comment_block(comment) + comment_block = self.parse_comment_block(comment, filename, lineno) except Exception: message.warn('unrecoverable parse error, please file a GObject-Introspection ' 'bug report including the complete comment block at the ' - 'indicated location.', message.Position(comment[1], comment[2])) + 'indicated location.', message.Position(filename, lineno)) continue if comment_block is not None: @@ -866,17 +866,17 @@ class GtkDocCommentBlockParser(object): return comment_blocks - def parse_comment_block(self, comment): + def parse_comment_block(self, comment, filename, lineno): ''' Parse a single GTK-Doc comment block. :param comment: string representing the GTK-Doc comment block including it's start ("``/**``") and end ("``*/``") tokens. - :returns: a :class:`DocBlock` object or ``None`` + :param filename: source file name where the comment block originated from + :param lineno: line number in the source file where the comment block starts + :returns: a :class:`GtkDocCommentBlock` object or ``None`` ''' - comment, filename, lineno = comment - # 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 diff --git a/tests/scanner/annotationparser/test_parser.py b/tests/scanner/annotationparser/test_parser.py index 2c8cd6ed..adf4f657 100644 --- a/tests/scanner/annotationparser/test_parser.py +++ b/tests/scanner/annotationparser/test_parser.py @@ -83,7 +83,7 @@ class TestCommentBlock(unittest.TestCase): # Parse GTK-Doc comment block commentblock = testcase.find(ns('{}input')).text - parsed_docblock = GtkDocCommentBlockParser().parse_comment_block((commentblock, 'test.c', 1)) + parsed_docblock = GtkDocCommentBlockParser().parse_comment_block(commentblock, 'test.c', 1) parsed_tree = self.parsed2tree(parsed_docblock).split('\n') emitted_messages = [w[w.find(':') + 1:].strip() for w in output.getvalue()] |