--- a/src/eric7/Utilities/ModuleParser.py Wed Jan 25 10:08:19 2023 +0100 +++ b/src/eric7/Utilities/ModuleParser.py Wed Jan 25 13:43:10 2023 +0100 @@ -593,11 +593,11 @@ break start, i = m.capturedStart(), m.capturedEnd() - if m.hasCaptured("MethodModifier"): + if m.captured("MethodModifier"): modifierIndent = _indent(m.captured("MethodModifierIndent")) modifierType = m.captured("MethodModifierType") - elif m.hasCaptured("Method"): + elif m.captured("Method"): # found a method definition or function thisindent = _indent(m.captured("MethodIndent")) meth_name = m.captured("MethodName") @@ -704,7 +704,7 @@ modifierType = Function.General modifierIndent = -1 - elif m.hasCaptured("Docstring"): + elif m.captured("Docstring"): contents = m.captured("DocstringContents3") if contents: contents = _hashsub(r"\1", contents) @@ -718,7 +718,7 @@ if cur_obj: cur_obj.addDescription(contents) - elif m.hasCaptured("String"): + elif m.captured("String"): if modulelevel and ( src[start - len("\r\n") : start] == "\r\n" or src[start - len("\n") : start] == "\n" @@ -737,7 +737,7 @@ if cur_obj: cur_obj.addDescription(contents) - elif m.hasCaptured("Class"): + elif m.captured("Class"): # we found a class definition thisindent = _indent(m.captured("ClassIndent")) lineno += src.count("\n", last_lineno_pos, start) @@ -795,7 +795,7 @@ # add nested classes to the module classstack.append((cur_class, thisindent)) - elif m.hasCaptured("Attribute"): + elif m.captured("Attribute"): lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start index = -1 @@ -809,13 +809,13 @@ else: index -= 1 - elif m.hasCaptured("Main"): + elif m.captured("Main"): # 'main' part of the script, reset class stack lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start classstack = [] - elif m.hasCaptured("Variable"): + elif m.captured("Variable"): thisindent = _indent(m.captured("VariableIndent")) variable_name = m.captured("VariableName") isSignal = m.captured("VariableSignal") != "" @@ -848,7 +848,7 @@ classstack[index][0].addGlobal(variable_name, attr) break - elif m.hasCaptured("Import"): + elif m.captured("Import"): # - import module names = [ n.strip() @@ -860,7 +860,7 @@ [name for name in names if name not in self.imports] ) - elif m.hasCaptured("ImportFrom"): + elif m.captured("ImportFrom"): # - from module import stuff mod = m.captured("ImportFromPath") namesLines = ( @@ -879,7 +879,7 @@ [name for name in names if name not in self.from_imports[mod]] ) - elif m.hasCaptured("ConditionalDefine"): + elif m.captured("ConditionalDefine"): # a conditional function/method definition thisindent = _indent(m.captured("ConditionalDefineIndent")) while conditionalsstack and conditionalsstack[-1] >= thisindent: @@ -889,7 +889,7 @@ conditionalsstack.append(thisindent) deltaindentcalculated = 0 - elif m.hasCaptured("Comment") and modulelevel: + elif m.captured("Comment") and modulelevel: continue modulelevel = False @@ -915,7 +915,7 @@ break start, i = m.capturedStart(), m.capturedEnd() - if m.hasCaptured("Method"): + if m.captured("Method"): # found a method definition or function thisindent = indent indent += 1 @@ -982,14 +982,14 @@ cur_obj = f classstack.append((None, thisindent)) # Marker for nested fns - elif m.hasCaptured("Docstring"): + elif m.captured("Docstring"): contents = m.captured("DocstringContents") if contents: contents = _hashsub(r"\1", contents) if cur_obj: cur_obj.addDescription(contents) - elif m.hasCaptured("Class"): + elif m.captured("Class"): # we found a class definition thisindent = indent indent += 1 @@ -1037,7 +1037,7 @@ acstack.append(["public", thisindent]) # default access control is 'public' - elif m.hasCaptured("Module"): + elif m.captured("Module"): # we found a module definition thisindent = indent indent += 1 @@ -1070,7 +1070,7 @@ acstack.append(["public", thisindent]) # default access control is 'public' - elif m.hasCaptured("AccessControl"): + elif m.captured("AccessControl"): aclist = m.captured("AccessControlList") if not aclist: index = -1 @@ -1114,7 +1114,7 @@ else: index -= 1 - elif m.hasCaptured("Attribute"): + elif m.captured("Attribute"): lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start index = -1 @@ -1142,7 +1142,7 @@ lastGlobalEntry.setEndLine(lineno - 1) lastGlobalEntry = None - elif m.hasCaptured("Attr"): + elif m.captured("Attr"): lineno += src.count("\n", last_lineno_pos, start) last_lineno_pos = start index = -1 @@ -1193,11 +1193,11 @@ else: index -= 1 - elif m.hasCaptured("Begin"): + elif m.captured("Begin"): # a begin of a block we are not interested in indent += 1 - elif m.hasCaptured("End"): + elif m.captured("End"): # an end of a block indent -= 1 if indent < 0: @@ -1209,10 +1209,10 @@ indent = 0 elif ( - m.hasCaptured("String") - or m.hasCaptured("Comment") - or m.hasCaptured("ClassIgnored") - or m.hasCaptured("BeginEnd") + m.captured("String") + or m.captured("Comment") + or m.captured("ClassIgnored") + or m.captured("BeginEnd") ): pass