moo.core.parse.Lexer

class moo.core.parse.Lexer(command)

An instance of this class will identify the various parts of a imperative sentence. This may be of use to verb code, as well.

__init__(command)

Methods

__init__(command)

Attributes

command

The full, unparsed command string the player typed.

words

The tokenised words from the command, preserving quoted spans.

dobj_str

The direct-object substring, or None if the command had no direct object.

dobj_spec_str

Any specifier on the direct object (my, the, a possessive like Bill's).

prepositions

Dict mapping each preposition that appeared in the command to a list of [spec_str, obj_str, obj] triples.