def sees(I, wants): I.am_here += Toke_Whitespace.burn(I.skoarse, I.am_here) for want in wants: X = I.see(want) if X: return X return None
def burn(I, want): toke = I.saw if toke is None: toke = I.see(want) if isinstance(toke, want): I.saw = None I.am_here += toke.burn() I.am_here += Toke_Whitespace.burn(I.skoarse, I.am_here) return toke raise Exception("I tried to burn " + want.__name__ + ", but what I saw is " + toke.__class__.__name__)