1 from .pddl_parser_base.PDDLGrammarLexer
import PDDLGrammarLexer
2 from .pddl_parser_base.PDDLGrammarParser
import PDDLGrammarParser
3 from .pddl_parser_base.PDDLGrammarVisitor
import PDDLGrammarVisitor
4 from antlr4
import PredictionMode
5 from antlr4.CommonTokenStream
import CommonTokenStream
6 from antlr4.error.ErrorListener
import ConsoleErrorListener
7 from antlr4.error.Errors
import RecognitionException
8 from antlr4.error.ErrorStrategy
import BailErrorStrategy, DefaultErrorStrategy
9 from antlr4.InputStream
import InputStream
21 parser._interp.predictionMode = PredictionMode.SLL
23 parser.removeErrorListeners()
25 parser._errHandler = BailErrorStrategy()
28 visitor.visit(parser.output())
29 except RuntimeError
as exception:
30 if isinstance(exception, RecognitionException):
32 parser.addErrorListener(ConsoleErrorListener.INSTANCE)
34 parser._errHandler = DefaultErrorStrategy()
35 parser._interp.predictionMode = PredictionMode.LL
37 visitor.visit(parser.output())
41 def get_parameters(self):
44 def visitAtom(self, ctx):
45 for index
in range(1, len(ctx.IDENTIFIER())):
46 self.
_parameters.append(ctx.IDENTIFIER(index).getText())