Answer to Exercise 78

| ANSWER TO EXERCISE 78
| (See the `NounDomain` specification in Appendix A9.) This routine passes on any `REPARSE_CODE`, as it must, but keeps a matched object in its own `third` variable, returning the 'skip this text' code to the parser. Thus the parser never sees any third parameter.
    Global third;
    [ ThirdNoun x;
      x=NounDomain(player,location,0);
      if (x==REPARSE_CODE) return x; if (x==0) return -1; third = x;
      return 0;
    ];

Back to the exercise in section 27

Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.