diff -r d14ddbfbbd36 -r c6dda2cbe081 Utilities/ModuleParser.py --- a/Utilities/ModuleParser.py Sat Feb 16 10:27:50 2019 +0100 +++ b/Utilities/ModuleParser.py Sat Mar 02 11:15:24 2019 +0100 @@ -59,14 +59,18 @@ _py_getnext = re.compile( r""" - (?P<String> - \""" (?P<StringContents1> + (?P<Comment> + \# .*? $ # ignore everything in comments + ) + +| (?P<String> + \""" (?P<StringContents1> [^"\\]* (?: (?: \\. | "(?!"") ) [^"\\]* )* ) - \""" + \""" | ''' (?P<StringContents2> [^'\\]* (?: @@ -528,7 +532,7 @@ deltaindent = 0 deltaindentcalculated = 0 i = 0 - modulelevel = 1 + modulelevel = True cur_obj = self modifierType = Function.General modifierIndent = -1 @@ -646,9 +650,9 @@ contents = _hashsub(r"\1", contents) else: if self.file.lower().endswith('.ptl'): - contents = "" + contents = "" else: - contents = 1 and m.group("DocstringContents1") \ + contents = m.group("DocstringContents1") \ or m.group("DocstringContents2") if cur_obj: cur_obj.addDescription(contents) @@ -665,7 +669,7 @@ if self.file.lower().endswith('.ptl'): contents = "" else: - contents = 1 and m.group("StringContents1") \ + contents = m.group("StringContents1") \ or m.group("StringContents2") if cur_obj: cur_obj.addDescription(contents) @@ -813,10 +817,14 @@ conditionalsstack.append(thisindent) deltaindentcalculated = 0 + elif m.start("Comment") >= 0: + if modulelevel: + continue + else: assert 0, "regexp _getnext found something unexpected" - modulelevel = 0 + modulelevel = False def __rb_scan(self, src): """