Fix empty initializer braces.
This commit is contained in:
parent
205b152301
commit
3476d69806
2 changed files with 8 additions and 5 deletions
|
@ -380,9 +380,9 @@ actspk: {
|
||||||
|
|
||||||
motions: !!omap
|
motions: !!omap
|
||||||
- MOT_0:
|
- MOT_0:
|
||||||
words: []
|
words: !!null
|
||||||
- MOT_1:
|
- MOT_1:
|
||||||
words: []
|
words: !!null
|
||||||
- MOT_2:
|
- MOT_2:
|
||||||
words: ['road', 'hill']
|
words: ['road', 'hill']
|
||||||
- MOT_3:
|
- MOT_3:
|
||||||
|
@ -516,7 +516,7 @@ motions: !!omap
|
||||||
- MOT_67:
|
- MOT_67:
|
||||||
words: ['cave']
|
words: ['cave']
|
||||||
- MOT_68:
|
- MOT_68:
|
||||||
words: []
|
words: !!null
|
||||||
- MOT_69:
|
- MOT_69:
|
||||||
words: ['cross']
|
words: ['cross']
|
||||||
- MOT_70:
|
- MOT_70:
|
||||||
|
|
|
@ -405,14 +405,17 @@ def get_actspk(actspk):
|
||||||
|
|
||||||
def get_motions(motions):
|
def get_motions(motions):
|
||||||
template = """ {{
|
template = """ {{
|
||||||
.words = (const char* []) {{{}}},
|
.words = {},
|
||||||
}},
|
}},
|
||||||
"""
|
"""
|
||||||
mot_str = ""
|
mot_str = ""
|
||||||
for motion in motions:
|
for motion in motions:
|
||||||
contents = motion[1]
|
contents = motion[1]
|
||||||
|
if contents["words"] == None:
|
||||||
|
mot_str += template.format("NULL")
|
||||||
|
continue
|
||||||
c_words = [make_c_string(s) for s in contents["words"]]
|
c_words = [make_c_string(s) for s in contents["words"]]
|
||||||
words_str = ", ".join(c_words)
|
words_str = "(const char* []) {" + ", ".join(c_words) + "}"
|
||||||
mot_str += template.format(words_str)
|
mot_str += template.format(words_str)
|
||||||
return mot_str
|
return mot_str
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue