Tokenizer: Simplify end of string regexes

This commit is contained in:
Dave Halter
2019-01-22 09:33:57 +01:00
parent fe69989fbc
commit dc2582f488
+4 -4
View File
@@ -167,13 +167,13 @@ def _create_token_collection(version_info):
FStringStart = group(*fstring_prefixes) FStringStart = group(*fstring_prefixes)
# Tail end of ' string. # Tail end of ' string.
Single = r"[^'\\]*(?:\\.[^'\\]*)*'" Single = r"(?:\\.|[^'\\])*'"
# Tail end of " string. # Tail end of " string.
Double = r'[^"\\]*(?:\\.[^"\\]*)*"' Double = r'(?:\\.|[^"\\])*"'
# Tail end of ''' string. # Tail end of ''' string.
Single3 = r"[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''" Single3 = r"(?:\\.|'(?!'')|[^'\\])*'''"
# Tail end of """ string. # Tail end of """ string.
Double3 = r'[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""' Double3 = r'(?:\\.|"(?!"")|[^"\\])*"""'
Triple = group(StringPrefixWithF + "'''", StringPrefixWithF + '"""') Triple = group(StringPrefixWithF + "'''", StringPrefixWithF + '"""')
# Because of leftmost-then-longest match semantics, be sure to put the # Because of leftmost-then-longest match semantics, be sure to put the