--- a/eric6/ThirdParty/EditorConfig/editorconfig/fnmatch.py Thu Jan 14 17:58:40 2021 +0100 +++ b/eric6/ThirdParty/EditorConfig/editorconfig/fnmatch.py Thu Jan 14 18:01:59 2021 +0100 @@ -28,7 +28,7 @@ LEFT_BRACE = re.compile( r""" - (?: ^ | [^\\] ) # Beginning of string or a character besides "\" + (?<! \\ ) # Not preceded by "\" \{ # "{" @@ -38,7 +38,7 @@ RIGHT_BRACE = re.compile( r""" - (?: ^ | [^\\] ) # Beginning of string or a character besides "\" + (?<! \\ ) # Not preceded by "\" \} # "}" @@ -135,7 +135,7 @@ else: result += '[^/]*' elif current_char == '?': - result += '.' + result += '[^/]' elif current_char == '[': if in_brackets: result += '\\[' @@ -148,8 +148,8 @@ break pos += 1 if has_slash: - result += '\\[' + pat[index:(pos + 1)] + '\\]' - index = pos + 2 + result += '\\[' + pat[index:(pos + 1)] + index = pos + 1 else: if index < length and pat[index] in '!^': index += 1 @@ -163,8 +163,11 @@ else: result += '\\' + current_char elif current_char == ']': - result += current_char - in_brackets = False + if in_brackets and pat[index-2] == '\\': + result += '\\]' + else: + result += current_char + in_brackets = False elif current_char == '{': pos = index has_comma = False @@ -178,7 +181,7 @@ num_range = NUMERIC_RANGE.match(pat[index:pos]) if num_range: numeric_groups.append(map(int, num_range.groups())) - result += "([+-]?\d+)" + result += r"([+-]?\d+)" else: inner_result, inner_groups = translate(pat[index:pos], nested=True) @@ -216,5 +219,5 @@ else: is_escaped = False if not nested: - result += '\Z(?ms)' + result = r'(?s)%s\Z' % result return result, numeric_groups