Inform 7 Home Page / Documentation
§17.13. New tokens
We have now made good use of square-bracketed tokens, such as "[something]", in a variety of "Understand..." sentences. It is sometimes convenient to create new tokens of our own, to match whatever grammar we choose: this enables complicated knots of grammar to be used in many different "Understand..." sentences without having to write it all out each time.
For instance, here are new tokens: one for each of two groups of alternative prepositions.
Understand "beneath/under/by/near/beside/alongside/against" or "next to" or "in front of" as "[beside]".
Understand "on/in/inside" or "on top of" as "[within]".
Again, note that the slash indicates a choice between words only, not between entire phrases. For instance, if we write:
Understand "red bird/robin" as "[robin]".
then the two alternative forms are "red bird" and "red robin", not "red bird" and "robin". By contrast,
Understand "red bird" or "robin" as "[robin]".
will understand either "red bird" or "robin" but not "red robin". If we want to capture all three forms, we might define
Understand "red bird/robin" or "robin" as "[robin]".
|Start of Chapter 17: Understanding|
|Back to §17.12. This/that|
|Onward to §17.14. Tokens can produce values|
To set the scene, and make new actions to provide for two of these ways:
The Laundry is a room. "An old Limehouse haunt, the Chinese laundry used by the down-trodden wives of the Tong of the Black Scorpion." The vast marble sink is here. "There is nothing obviously oriental about the vast marble sink, which is large enough to lie down inside. A wooden-rack floor, equipped for easy drainage, turns out also to be equipped for snagging the shoes of passers-by." The sink is an enterable container, fixed in place.
Instead of lying near the sink, say "Lying down close to the cool butcher's marble slabs of the sink, your attention is caught by the sight of coolie shoes through a floor-level grille for ventilation. The game is afoot!"
So far, so good. Now for the grammar, where we create two new tokens: one for each of two groups of alternative prepositions.