🐛 FIX: 修复了ptml转换过程中括号匹配不对的问题
This commit is contained in:
parent
5320acc838
commit
714c5a4c8e
|
@ -93,15 +93,21 @@ def format_trans_to_bracket(file_path: str) -> str:
|
||||||
|
|
||||||
level = 0
|
level = 0
|
||||||
for i in ptml_tab:
|
for i in ptml_tab:
|
||||||
|
|
||||||
|
if i.startswith('//'):
|
||||||
|
continue
|
||||||
|
|
||||||
new_level = counter_(i) // 4
|
new_level = counter_(i) // 4
|
||||||
if new_level == level:
|
if new_level == level:
|
||||||
ptml_new += i
|
ptml_new += i
|
||||||
elif new_level > level:
|
elif new_level > level:
|
||||||
ptml_new += '{\n' + i
|
ptml_new += '{\n' + i
|
||||||
|
level += 1
|
||||||
elif new_level < level:
|
elif new_level < level:
|
||||||
ptml_new += '\n}' + i
|
ptml_new += '\n}' + i
|
||||||
level = new_level
|
level -= 1
|
||||||
ptml_new += '}'
|
for i in range(level):
|
||||||
|
ptml_new += '}'
|
||||||
|
|
||||||
import re
|
import re
|
||||||
new_path = re.sub('/[a-zA-Z0-9_]*\.ptml', '/bracket_ptml.ptml',file_path)
|
new_path = re.sub('/[a-zA-Z0-9_]*\.ptml', '/bracket_ptml.ptml',file_path)
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
selector
|
selector
|
||||||
{
|
{
|
||||||
selector
|
sequence
|
||||||
{
|
|
||||||
cond HasMap()
|
|
||||||
act ExploreEnv()
|
|
||||||
|
|
||||||
} sequence
|
|
||||||
{
|
{
|
||||||
cond Chatting()
|
cond Chatting()
|
||||||
act DealChat()
|
act DealChat()
|
||||||
|
@ -15,6 +10,6 @@ selector
|
||||||
cond HasSubTask()
|
cond HasSubTask()
|
||||||
sequence
|
sequence
|
||||||
{
|
{
|
||||||
cond At(Robot,Table)
|
act SubTaskPlaceHolder()
|
||||||
|
|
||||||
} cond At(Robot,Table)}
|
} cond At(Talb,ea)}}
|
|
@ -1,5 +1,12 @@
|
||||||
selector
|
selector
|
||||||
|
// selector
|
||||||
|
// cond HasMap()
|
||||||
|
// act ExploreEnv()
|
||||||
sequence
|
sequence
|
||||||
cond Chatting()
|
cond Chatting()
|
||||||
act DealChat()
|
act DealChat()
|
||||||
act At(Coffee,Table)
|
sequence
|
||||||
|
cond HasSubTask()
|
||||||
|
sequence
|
||||||
|
act SubTaskPlaceHolder()
|
||||||
|
cond At(Talb,ea)
|
Loading…
Reference in New Issue