Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing parserm.h

ScopeWithin_O (lines 3844-3927)

3844  [ ScopeWithin_O domain nosearch context i ad n;
3845   
3846      ! If the scope reason is unusual, don't parse.
3847   
3848      if (scope_reason ~= PARSING_REASON or TALKING_REASON) {
3849          DoScopeAction(domain);
3850          jump DontAccept;
3851      }
3852   
3853      ! "it" or "them" matches to the it-object only.  (Note that (1) this means
3854      ! that "it" will only be understood if the object in question is still
3855      ! in context, and (2) only one match can ever be made in this case.)
3856   
3857      if (match_from <= num_words) {  ! If there's any text to match, that is
3858          wn = match_from;
3859          i = NounWord();
3860          if (i == 1 && player == domain) MakeMatch(domain, 1);
3861          if (i >= 2 && i < 128 && (LanguagePronouns-->i == domain)) MakeMatch(domain, 1);
3862      }
3863   
3864      ! Construing the current word as the start of a noun, can it refer to the
3865      ! object?
3866   
3867      wn = match_from;
3868      if (TryGivenObject(domain) > 0)
3869          if (indef_nspec_at > 0 && match_from ~= indef_nspec_at) {
3870              ! This case arises if the player has typed a number in
3871              ! which is hypothetically an indefinite descriptor:
3872              ! e.g. "take two clubs".  We have just checked the object
3873              ! against the word "clubs", in the hope of eventually finding
3874              ! two such objects.  But we also backtrack and check it
3875              ! against the words "two clubs", in case it turns out to
3876              ! be the 2 of Clubs from a pack of cards, say.  If it does
3877              ! match against "two clubs", we tear up our original
3878              ! assumption about the meaning of "two" and lapse back into
3879              ! definite mode.
3880   
3881              wn = indef_nspec_at;
3882              if (TryGivenObject(domain) > 0) {
3883                  match_from = indef_nspec_at;
3884                  ResetDescriptors();
3885              }
3886              wn = match_from;
3887          }
3888   
3889    .DontAccept;
3890   
3891      ! Shall we consider the possessions of the current object, as well?
3892      ! Only if it's a container (so, for instance, if a dwarf carries a
3893      ! sword, then "drop sword" will not be accepted, but "dwarf, drop sword"
3894      ! will).
3895      ! Also, only if there are such possessions.
3896      !
3897      ! Notice that the parser can see "into" anything flagged as
3898      ! transparent - such as a dwarf whose sword you can get at.
3899   
3900      if (child(domain) ~= 0 && domain ~= nosearch && IsSeeThrough(domain) == 1)
3901          ScopeWithin(domain,nosearch,context);
3902   
3903      ! Drag any extras into context
3904   
3905      ad = domain.&add_to_scope;
3906      if (ad ~= 0) {
3907   
3908          ! Test if the property value is not an object.
3909          #Ifdef TARGET_ZCODE;
3910          i = (UnsignedCompare(ad-->0, top_object) > 0);
3911          #Ifnot; ! TARGET_GLULX
3912          i = (((ad-->0)->0) ~= $70);
3913          #Endif; ! TARGET_
3914   
3915          if (i) {
3916              ats_flag = 2+context;
3917              RunRoutines(domain, add_to_scope);
3918              ats_flag = 0;
3919          }
3920          else {
3921              n = domain.#add_to_scope;
3922              for (i=0 : (WORDSIZE*i)<n : i++)
3923                  if (ad-->i)
3924                      ScopeWithin_O(ad-->i, 0, context);
3925          }
3926      }
3927  ];


Last updated 27 February 2004. The librarian in charge of this page is Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight. Please email any comments, suggestions or corrections to cedenqs@inform-fiction.org.