Skip to content

Commit 2dff3eb

Browse files
Fix bug on typed list of types
1 parent 1e03b75 commit 2dff3eb

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

fond4ltlf/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def check_symbols(symbols, parsed_domain):
5555
return True
5656

5757

58-
def execute(planning_domain, planning_problem, goal_formula, no_disj_preconds):
58+
def execute(planning_domain, planning_problem, goal_formula, no_disj_preconds=False):
5959
"""Execute the compilation."""
6060
pddl_parser = PDDLParser()
6161
parsed_domain = pddl_parser(planning_domain)

fond4ltlf/parser/parser.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,15 @@ def p_constants_def(self, p):
138138
p[0] = p[3]
139139

140140
def p_typed_lst_name(self, p):
141-
"""typed_lst_name : names_lst"""
141+
"""typed_lst_name : names_lst HYPHEN type typed_lst_name
142+
| names_lst HYPHEN NAME
143+
| names_lst"""
142144
if len(p) == 2:
143145
p[0] = p[1]
144-
# elif len(p) == 5:
145-
# p[0] = [Term.constant(value, p[3]) for value in p[1]] + p[4]
146+
elif len(p) == 4:
147+
p[0] = [Term.constant(value, p[3]) for value in p[1]]
148+
elif len(p) == 5:
149+
p[0] = [Term.constant(value, p[3]) for value in p[1]] + p[4]
146150

147151
def p_names_lst(self, p):
148152
"""names_lst : NAME names_lst
@@ -449,7 +453,7 @@ def p_error(self, p):
449453

450454
if __name__ == "__main__":
451455
par = PDDLParser()
452-
with open("../../tests/data/pddl-domains/triangle-tireworld/p01.pddl", "r") as f:
456+
with open("../../tests/data/pddl-domains/robot-coffee/domain-fond.pddl", "r") as f:
453457
domain = f.read()
454458

455459
result = par(domain)

tests/test_parsing.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,6 @@ def test_robot_coffee():
624624
)
625625
).read()
626626
pddl_parser = PDDLParser()
627-
# tmp = list(planning_problem[400:])
628627
parsed_domain = pddl_parser(planning_domain)
629628
parsed_problem = pddl_parser(planning_problem)
630629
assert parsed_domain is not None

0 commit comments

Comments
 (0)