Example #1
0
 def args(cls, player):
     return parser.ObjectIn(player)("item")
Example #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"))
Example #3
0
 def args(cls, player):
     return parser.ObjectIn(player)("item") | parser.EmptyLine()
Example #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"])
Example #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)
Example #6
0
 def test_objectin_ambiguous(self):
     self.assertRaises(parser.AmbiguityError,
                       parser.ObjectIn(self.lobby).parseString,
                       "Play",
                       parseAll=True)
Example #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)