Parser error message



   string parser_error_message(int type, object ob, mixed arg, int flag);


   This apply is called by the to generate intelligent error messages in cases where rules have been "nearly matched". The parameters passed are the error code (defined in an parser_errors.h file packaged with FluffOS), the object concerned (if known), data about the error (dependent on the error code) and whether or not the error was a "plural" error or not (i.e. the error data represents more than one object).



   string parser_error_message(int error, object ob, mixed arg, int plural)
       switch (error)
       case PARSE_NOT_HERE: /*  couldn't find a matching object */
           return "There is no " + arg + " here.\n";

       case PARSE_NOT_ALIVE: /* is_living() returned 0 for match for LIV token */
           if (plural)
               return "The " + pluralize(arg) + " are not alive.\n";
               return "The " + arg + " isn't alive.\n";

       case PARSE_UNACCESSIBLE: /* inventory_accessible() returned 0 in container */
           if (plural)
               return "They are out of reach.\n";
               return "It is out of your reach.\n";

       case PARSE_AMBIGUOUS: /* more than one object matched for a singular rule */
           return "Which of the " + query_multiple_short(arg) +
               " do you mean?\n";

       case PARSE_WRONG_NUMBER: /* not enough matching objects found */
           arg = -arg - 1;
           if (arg > 1)
               return "There are only " + query_num(arg) + " of them.\n";
               return "There is only one of them.\n";

       case PARSE_ALLOCATED: /* no idea what this one is :) */
           return arg;

       case PARSE_NOT_FOUND: /* no matching object found */
           return "There is no " + arg + " here.\n";

       case PARSE_TOO_MANY: /* multiple objects matched for a singular rule? */
           return "You can only do that to one thing at a time.\n";