Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000981I6 LibraryGeneralpublic2012-08-08 16:242015-05-10 17:47
Assigned ToDavidG 
PlatformOSOS Version
Product Version6/11 
Target Version6/12Fixed in Version6/12 
Summary0000981: Minor problem with parse_name
DescriptionOriginally reported by Martin Oehm as Issue L61123

I think I have found a (rather minor) error with the parse_name routine. On page 209, the DM4 states:

    "It [parse_name] should return:
      0 if the text didn't make any sense at all,
      k if k words in a row of the text seem to refer to the object, or
      -1 to tell the parser it doesn't want to decide after all.

    The word marker wn can be left anywhere afterwards."

But the word marker's position is not reset after returning -1 as it should. In TryGivenObject (parserm.h), the local variable j is used to keep track of the start of parsing with parse_name and is only used to recalculate wn after a match. In my opinion, a line should be inserted here after line 4032:

  4004 if (obj.parse_name ~= 0) {
  4005 parser_action = NULL; j=wn;
  4006 k = RunRoutines(obj, parse_name);

  ... ! ... handle parse_name result

  4029 MakeMatch(obj, k);
  4030 return k;
  4031 }
  4032 if (k == 0) jump NoWordsMatch;
  >>>> wn = j;
  4033 }

This might not be an issue -- none of the parse_names in the DM4 exercises that return -1 move the word marker, and usually, as in Zarf's parse_name variants, all the parsing is done in parse_name and the return value is zero.

But in my case I have read a word with NextWord() which I want to process further. The routine looks a bit like that:

  parse_name [;
      if (NextWord() == 'schild') {
          ! handle special case
          if (CheckArticle(male)) return 1;
          return 0;
      } ! wn has moved by 1
      return -1; ! look at the unambigous synonyms
                      ! given in the name property
  ], ...

Here, CheckArticle is a way of checking whether an article was used and if so, assure that it matches a certain gender. If there is no article or a correct one, match. If there's an article but it doesn't match the gender, fail. In all other cases, look at the other synonyms*. Of course I could move the word marker back by one, but wouldn't it be more consistent to reset wn after returning -1 anyway?

* As a brief explanation: "Schild" as a male noun means shield, as a neuter noun it means sign, so if the player refers to "das Schild" I don't want the disambiguation question to come up, since using the correct article, the object is already uniquely described.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
jmcgrew (administrator)
2015-05-10 17:47

Closing all resolved issues from 2014 and earlier.

- Issue History
Date Modified Username Field Change
2012-08-08 16:24 DavidG New Issue
2012-08-09 16:45 DavidG Target Version 6/11 => 6/12
2012-08-09 16:46 DavidG Assigned To => DavidG
2012-08-09 16:46 DavidG Status new => assigned
2012-08-09 17:02 DavidG Status assigned => resolved
2012-08-09 17:02 DavidG Fixed in Version => 6/12
2012-08-09 17:02 DavidG Resolution open => fixed
2015-05-10 17:47 jmcgrew Note Added: 0003719
2015-05-10 17:47 jmcgrew Status resolved => closed

Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker