Exemplo n.º 1
0
 def args(cls, player):
     return parser.ObjectIn(player)("item")
Exemplo n.º 2
0
 def args(cls, player):
     item = parser.ObjectIn(player)
     destination = parser.NearbyObject(player)
     return (item("item") + pyp.Keyword("to") + destination("destination")
            | destination("destination") + item("item")
            | item("item") + pyp.Keyword("in") + destination("destination"))
Exemplo n.º 3
0
 def args(cls, player):
     return parser.ObjectIn(player)("item") | parser.EmptyLine()
Exemplo n.º 4
0
 def test_combining_object_tokens_partial(self):
     grammar = parser.ObjectIn(self.player) + pyp.Word(pyp.alphas)
     parse_result = grammar.parseString("app pie")
     self.assertEqual(list(parse_result), [self.objects["apple"], "pie"])
Exemplo n.º 5
0
 def test_objectin_notfound(self):
     self.assert_error_message(parser.NotFoundError, "I don't know of an "
                               "object in lobby called \"asdf\"",
                               parser.ObjectIn(self.lobby).parseString,
                               "asdf",
                               parseAll=True)
Exemplo n.º 6
0
 def test_objectin_ambiguous(self):
     self.assertRaises(parser.AmbiguityError,
                       parser.ObjectIn(self.lobby).parseString,
                       "Play",
                       parseAll=True)
Exemplo n.º 7
0
 def test_objectin(self):
     self.assert_parse(parser.ObjectIn(self.lobby), "Player", self.player)
     self.assert_parse(parser.ObjectIn(self.lobby), "Players",
                       self.neighbor)