Prettier '!sd.]' fix
This commit is contained in:
parent
657b81ac94
commit
5dac9d1dfb
32
src/fix.py
32
src/fix.py
|
@ -167,16 +167,28 @@ def fix_common_displaced_commands(line: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
# '!sd。」'
|
# '!sd。」'
|
||||||
if len(tokens) > 3 and \
|
if (
|
||||||
tokens[-3].token == '!sd' and \
|
len(tokens) > 3
|
||||||
tokens[-2].token in ['。」','」','。','、」'] and \
|
and tokens[-3].token == '!sd'
|
||||||
tokens[-1].type == scripter.TokenType.COMMAND:
|
and tokens[-2].token in [ # quot
|
||||||
|
'。」',
|
||||||
# Prepend to end
|
'」',
|
||||||
quot = tokens.pop(-2).token
|
'。',
|
||||||
excl = tokens.pop(-2).token
|
'、」',
|
||||||
tokens[-1].token = excl + tokens[-1].token
|
]
|
||||||
tokens[-2].token += quot
|
and tokens[-1].type == scripter.TokenType.COMMAND # final
|
||||||
|
):
|
||||||
|
# Get the final symbols
|
||||||
|
# [text][command]<[text][command]>
|
||||||
|
quot = tokens[-2].token
|
||||||
|
final = tokens[-1].token
|
||||||
|
# Append them to the previous ones (-3 and -4)
|
||||||
|
# <[text+text][command+command]>[text][command]
|
||||||
|
tokens[-4].token += quot
|
||||||
|
tokens[-3].token += final
|
||||||
|
# Trim the leftovers
|
||||||
|
# [text+text][command+command]<>
|
||||||
|
tokens = tokens[:-2]
|
||||||
|
|
||||||
|
|
||||||
for t in tokens:
|
for t in tokens:
|
||||||
|
|
Loading…
Reference in New Issue