Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000525Core InformUnderstandingpublic2011-01-29 17:192014-05-07 07:33
ReporterRon Newcomb 
Assigned Tograham 
PrioritynormalSeveritymildReproducibilityalways
StatusclosedResolutionfixed 
PlatformPPCOSMac OS XOS Version10.4
Product Version6G60 
Target VersionFixed in Version6L02 
Summary0000525: Five parser errors don't run the printing a parser error activity (with solution)
DescriptionFound this while testing the Rewrite The Command Line extension. These parser errors don't run said activity, so their error was appearing on the same line as the command:

  You can't begin with a comma.
  You seem to want to talk to someone, but I can't see whom.
  You can't talk to the ___.
  To talk to someone, try "someone, hello" or some such.
  To repeat a command like "frog, jump", just say "again", not "frog, again".

In section C of the parser, I6 GOTOs .ReType rather than setting "best_etype" and GOTOing .GiveError.

The solution is written as valid Inform 7, rather than as broken I6 snippets.
Minimal Source Text To Reproduce
There is room. A rock is here. Bob is a man, here.

For printing a parser error: say "The [latest parser error] happened."

Test me with "she said, x me / rock, x me / Bob foobar, x me / me, again"

[ I don't believe the begin-with-comma error is possible to trigger anymore. I tried and tried. ]
Additional InformationSome [more] command parser errors are
can't again the addressee error,
comma can't begin error,
can't see whom to talk to error,
can't talk to inanimate things error, and
didn't understand addressee's last name error.

Include (-

Constant STUCK_PE = 1;
Constant UPTO_PE = 2;
Constant NUMBER_PE = 3;
Constant ANIMA_PE = 4;
Constant CANTSEE_PE = 5;
Constant TOOLIT_PE = 6;
Constant NOTHELD_PE = 7;
Constant MULTI_PE = 8;
Constant MMULTI_PE = 9;
Constant VAGUE_PE = 10;
Constant EXCEPT_PE = 11;
Constant VERB_PE = 12;
Constant SCENERY_PE = 13;
Constant ITGONE_PE = 14;
Constant JUNKAFTER_PE = 15;
Constant TOOFEW_PE = 16;
Constant NOTHING_PE = 17;
Constant ASKSCOPE_PE = 18;
Constant NOTINCONTEXT_PE = 19;
Constant BLANKLINE_PE = 20; ! Not formally a parser error, but used by I7 as if
Constant ANIMAAGAIN_PE = 21; ! 20: "To repeat a command like ~frog, jump~, just say ~again~, not ~frog, again~."
Constant COMMABEGIN_PE = 22; ! 22: "You can’t begin with a comma.";
Constant MISSINGPERSON_PE = 23; ! 23: "You seem to want to talk to someone, but I can’t see whom.";
Constant ANIMALISTEN_PE = 24; ! 24: "You can’t talk to ", (the) x1, ".";
Constant TOTALK_PE = 25; ! 25: "To talk to someone, try ~someone, hello~ or some such.";

-) instead of "Parser Error Numbers" in "Definitions.i6t".
                               
Include (-
! Only check for a comma (a "someone, do something" command) if we are
! not already in the middle of one. (This simplification stops us from
! worrying about "robot, wizard, you are an idiot", telling the robot to
! tell the wizard that she is an idiot.)

if (actor == player) {
for (j=2 : j<=num_words : j++) {
i=NextWord();
if (i == comma_word) jump Conversation;
}
}
jump NotConversation;

! NextWord nudges the word number wn on by one each time, so we've now
! advanced past a comma. (A comma is a word all on its own in the table.)

.Conversation;

j = wn - 1;
if (j == 1) {
best_etype = COMMABEGIN_PE;
!L__M(##Miscellany, 22);
jump GiveError;
}

! Use NounDomain (in the context of "animate creature") to see if the
! words make sense as the name of someone held or nearby

wn = 1; lookahead = HELD_TOKEN;
scope_reason = TALKING_REASON;
l = NounDomain(player,actors_location,6);
scope_reason = PARSING_REASON;
if (l == REPARSE_CODE) jump ReParse;
if (l == 0) {
if (verb_word && ((verb_word->#dict_par1) & 1)) jump NotConversation;
best_etype = MISSINGPERSON_PE;
!L__M(##Miscellany, 23);
jump GiveError;
}

.Conversation2;

! The object addressed must at least be "talkable" if not actually "animate"
! (the distinction allows, for instance, a microphone to be spoken to,
! without the parser thinking that the microphone is human).

if (l hasnt animate && l hasnt talkable) {
best_etype = ANIMALISTEN_PE;
!L__M(##Miscellany, 24, l);
jump GiveError;
}

! Check that there aren't any mystery words between the end of the person's
! name and the comma (eg, throw out "dwarf sdfgsdgs, go north").

if (wn ~= j) {
if (verb_word && ((verb_word->#dict_par1) & 1)) jump NotConversation;
best_etype = TOTALK_PE; ! 25: "To talk to someone, try ~someone, hello~ or some such.";
!L__M(##Miscellany, 25);
jump GiveError;
}

! The player has now successfully named someone. Adjust "him", "her", "it":

PronounNotice(l);

! Set the global variable "actor", adjust the number of the first word,
! and begin parsing again from there.

verb_wordnum = j + 1;

! Stop things like "me, again":

if (l == player) {
wn = verb_wordnum;
if (NextWordStopped() == AGAIN1__WD or AGAIN2__WD or AGAIN3__WD) {
best_etype = ANIMAAGAIN_PE;
!L__M(##Miscellany, 20);
jump GiveError;
}
}

actor = l;
actors_location = ScopeCeiling(l);
#Ifdef DEBUG;
if (parser_trace >= 1)
print "[Actor is ", (the) actor, " in ", (name) actors_location, "]^";
#Endif; ! DEBUG
jump BeginCommand;

-) instead of "Parser Letter C" in "Parser.i6t".

Include (-
    ! If the player was the actor (eg, in "take dfghh") the error must be printed,
    ! and fresh input called for. In three cases the oops word must be jiggled.

    if ((etype ofclass Routine) || (etype ofclass String)) {
        if (ParserError(etype) ~= 0) jump ReType;
    } else {
if (verb_wordnum == 0 && etype == CANTSEE_PE) etype = VERB_PE;
players_command = 100 + WordCount(); ! The snippet variable ``player's command''
        BeginActivity(PRINTING_A_PARSER_ERROR_ACT);
        if (ForActivity(PRINTING_A_PARSER_ERROR_ACT)) jump SkipParserError;
    }
    pronoun_word = pronoun__word; pronoun_obj = pronoun__obj;

    if (etype == ANIMAAGAIN_PE) L__M(##Miscellany, 20);
    if (etype == COMMABEGIN_PE) L__M(##Miscellany, 22);
    if (etype == MISSINGPERSON_PE) L__M(##Miscellany, 23);
    if (etype == ANIMALISTEN_PE) L__M(##Miscellany, 24,l);
    if (etype == TOTALK_PE) L__M(##Miscellany, 25);

    if (etype == STUCK_PE) { L__M(##Miscellany, 27); oops_from = 1; }
    if (etype == UPTO_PE) { L__M(##Miscellany, 28);
        for (m=0 : m<32 : m++) pattern-->m = pattern2-->m;
        pcount = pcount2; PrintCommand(0); L__M(##Miscellany, 56);
    }
    if (etype == NUMBER_PE) L__M(##Miscellany, 29);
    if (etype == CANTSEE_PE) { L__M(##Miscellany, 30); oops_from=saved_oops; }
    if (etype == TOOLIT_PE) L__M(##Miscellany, 31);
    if (etype == NOTHELD_PE) { L__M(##Miscellany, 32); oops_from=saved_oops; }
    if (etype == MULTI_PE) L__M(##Miscellany, 33);
    if (etype == MMULTI_PE) L__M(##Miscellany, 34);
    if (etype == VAGUE_PE) L__M(##Miscellany, 35);
    if (etype == EXCEPT_PE) L__M(##Miscellany, 36);
    if (etype == ANIMA_PE) L__M(##Miscellany, 37);
    if (etype == VERB_PE) L__M(##Miscellany, 38);
    if (etype == SCENERY_PE) L__M(##Miscellany, 39);
    if (etype == ITGONE_PE) {
        if (pronoun_obj == NULL)
                                L__M(##Miscellany, 35);
        else L__M(##Miscellany, 40);
    }
    if (etype == JUNKAFTER_PE) L__M(##Miscellany, 41);
    if (etype == TOOFEW_PE) L__M(##Miscellany, 42, multi_had);
    if (etype == NOTHING_PE) {
        if (parser_results-->ACTION_PRES == ##Remove &&
         parser_results-->INP2_PRES ofclass Object) {
            noun = parser_results-->INP2_PRES; ! ensure valid for messages
            if (noun has animate) L__M(##Take, 6, noun);
            else if (noun hasnt container or supporter) L__M(##Insert, 2, noun);
            else if (noun has container && noun hasnt open) L__M(##Take, 9, noun);
            else if (children(noun)==0) L__M(##Search, 6, noun);
            else parser_results-->ACTION_PRES = 0;
            }
        if (parser_results-->ACTION_PRES ~= ##Remove) {
            if (multi_wanted==100) L__M(##Miscellany, 43);
            else L__M(##Miscellany, 44);
        }
    }
    if (etype == ASKSCOPE_PE) {
        scope_stage = 3;
        if (indirect(scope_error) == -1) {
            best_etype = nextbest_etype;
            if (~~((etype ofclass Routine) || (etype ofclass String)))
             EndActivity(PRINTING_A_PARSER_ERROR_ACT);
            jump GiveError;
        }
    }
    if (etype == NOTINCONTEXT_PE) L__M(##Miscellany, 73);

    .SkipParserError;
    if ((etype ofclass Routine) || (etype ofclass String)) jump ReType;
    say__p = 1;
    EndActivity(PRINTING_A_PARSER_ERROR_ACT);

-) instead of "Parser Letter I" in "Parser.i6t".
TagsNo tags attached.
Effect(serious/mild) Game compiles but misbehaves
Attached Files

- Relationships

-  Notes
(0000981)
Ron Newcomb (reporter)
2011-01-29 17:24

Er, please remove the line

   print "j is ", j, "^";

from the solution. ::facepalm::
(0000993)
EmacsUser (manager)
2011-02-07 16:17

Confirmed, and proposed solution edited to remove the extraneous print.
(0002512)
graham (administrator)
2014-02-16 02:38

This is blatantly a suggestion, not a bug, but I've carried it through.

- Issue History
Date Modified Username Field Change
2011-01-29 17:19 Ron Newcomb New Issue
2011-01-29 17:24 Ron Newcomb Note Added: 0000981
2011-01-29 18:22 jmcgrew Status new => acknowledged
2011-02-07 16:17 EmacsUser Note Added: 0000993
2011-02-07 16:17 EmacsUser Status acknowledged => confirmed
2011-02-07 16:17 EmacsUser Additional Information Updated View Revisions
2014-02-16 02:38 graham Note Added: 0002512
2014-02-16 02:38 graham Status confirmed => resolved
2014-02-16 02:38 graham Resolution open => fixed
2014-02-16 02:38 graham Assigned To => graham
2014-05-07 07:32 jmcgrew Fixed in Version => 6L02
2014-05-07 07:33 jmcgrew Status resolved => closed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker