-
Notifications
You must be signed in to change notification settings - Fork 22
Description
There is an issue with durative-action. I created the following minimal test domain:
(define (domain test-domain)
(:requirements :strips :typing :durative-actions :fluents :timed-initial-literals)
(:action test
:parameters (?a)
:effect ()
)
(:durative-action test2
:parameters (?a)
:duration (= ?duration 1)
:condition ()
:effect ()
)
)I parse it with the following code:
inp = FileStream("testdomain.pddl")
lexer = pddlLexer(inp)
stream = CommonTokenStream(lexer)
parser = pddlParser(stream)
tree = parser.domain()
domain = DomainListener()
walker = ParseTreeWalker()
walker.walk(domain, tree)This causes the following exception:
Traceback (most recent call last):
File "/home/stei_fn/.PyCharm2018.1/config/scratches/scratch_13.py", line 25, in <module>
walker.walk(domain, tree)
File "/home/stei_fn/.local_leap/lib/python3.4/site-packages/antlr4/tree/Tree.py", line 151, in walk
self.walk(listener, child)
File "/home/stei_fn/.local_leap/lib/python3.4/site-packages/antlr4/tree/Tree.py", line 151, in walk
self.walk(listener, child)
File "/home/stei_fn/.local_leap/lib/python3.4/site-packages/antlr4/tree/Tree.py", line 151, in walk
self.walk(listener, child)
File "/home/stei_fn/.local_leap/lib/python3.4/site-packages/antlr4/tree/Tree.py", line 149, in walk
self.enterRule(listener, t)
File "/home/stei_fn/.local_leap/lib/python3.4/site-packages/antlr4/tree/Tree.py", line 163, in enterRule
ctx.enterRule(listener)
File "/home/stei_fn/.local_leap/lib/python3.4/site-packages/pddlpy/pddlParser.py", line 1818, in enterRule
listener.enterTypedVariableList(self)
File "/home/stei_fn/.local_leap/lib/python3.4/site-packages/pddlpy/pddl.py", line 116, in enterTypedVariableList
self.scopes[-1].variable_list[v.getText()] = None
IndexError: list index out of range
I used PyCharm for debugging and discovered the following. The action scope is successfully parsed. The exception occures, when the parameter scope of the duractive-action is to be parsed. The list of scopes is empty, which I think means the duractive-action scope has not been parsed successfully.
I had a look at the source code of pddl.py. The class DomainListener has methods enterActionDef / exitActionDef. I would expect corresponding methods for durative-actions, but there is no enterDurativeActionDef / exitDurativeActionDef. So I guess this is the root of this issue.
Could you please fix this? I am very happy that I found this Python package, as it look very useful to me. Yet, this issue prevents me from using it.
(I am using the latest release on PyPi, 0.1.9).