Fix token_dump for strings with single quotes in them. Update f-string test tokens.
This commit is contained in:
@@ -145,6 +145,7 @@ def string_token(line, n_line, pysrc):
|
||||
while True:
|
||||
end = line.find(quotes, start)
|
||||
if end > 0 and line[end - 1] == '\\':
|
||||
content += line[start:end + 1]
|
||||
start = end + 1
|
||||
continue
|
||||
elif end >= 0:
|
||||
|
@@ -21,10 +21,10 @@ print ( f'{123}:\\s+' ) <EOL>
|
||||
print ( f'x{12}' * 3 ) <EOL>
|
||||
print ( f'f-string. \t\tformat value 0: {var1}, 1 (!s): {var2!s}, 2 (!r): {var2!r}, 3 (!a): {var2!a}, 4: {var3:6.3}, constant: {123}. End.' ) <EOL>
|
||||
print ( 'percent format %d ' % 444 + f'f-string {123} and {var1!s}' + f' add another f-str {var3:2.3}' + ' regular string regular string ' ) <EOL>
|
||||
print ( f'' ) <EOL>
|
||||
print ( f'\'\'\'{\'single quoted string\'} \'singles in f-string\' {"single quote \' inside"} "doubles in f-string" {\'double quoted string\'} " both \' {\'double quotes " inside\'}\'\'\'' ) <EOL>
|
||||
print ( f'"""{\'single quoted string\'} \'singles in f-string\' {"single quote \' inside"} "doubles in f-string" {\'double quoted string\'} " both \' {\'double quotes " inside\'}"""' ) <EOL>
|
||||
print ( f'' ) <EOL>
|
||||
print ( f'' ) <EOL>
|
||||
print ( f'single quote \t\t{var1}"{var1!s}" \'{var2!a}{var3:.2f}\' """{var1!r}""" \'\'\'{var2}\'\'\'' ) <EOL>
|
||||
print ( f'double quote \t\t{var1}"{var1!s}" \'{var2!a}{var3:.2f}\' """{var1!r}""" \'\'\'{var2}\'\'\'' ) <EOL>
|
||||
print ( f'{var3 * x} {var3:.2f} {var3:.5f} {x:02} {x * x:3} {x * x * x:4} {s1:>10} {a:x} {a:o} {a:e}' ) <EOL>
|
||||
print ( f'some {{braces}} {\'inner literal: {braces} {{double braces}}\'}' ) <EOL>
|
||||
print ( f'f-string dict {some_dict[2]} and {{function call in expression}}: {max([\n 1,\n 20,\n 3])}' ) <EOL>
|
||||
|
Reference in New Issue
Block a user