mirror of
https://github.com/davidhalter/parso.git
synced 2026-08-12 10:54:59 +08:00
Tokenizer: Simplify end of string regexes
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user