Original Parser

version 1 by Ron Newcomb

  • Home page
  • Beginning
  • Previous
  • Next

  • Chapter - CantSee

    [The |CantSee| routine returns a good error number for the situation where
    the last word looked at didn't seem to refer to any object in context.

    The idea is that: if the actor is in a location (but not inside something
    like, for instance, a tank which is in that location) then an attempt to
    refer to one of the words listed as meaningful-but-irrelevant there
    will cause ``you don't need to refer to that in this game'' rather than
    ``no such thing'' or ``what's `it'?''.

    (The advantage of not having looked at ``irrelevant'' local nouns until
    now is that it stops them from clogging up the ambiguity-resolving process.
    Thus game objects always triumph over scenery.)]

    To if it's more specific decide on (cpe - a command parser error):
    (- if ({cpe} > (+ the latest parser error +)) return {cpe}; -).

    To decide if (cpe1 - a command parser error) is more specific than (cpe2 - a command parser error):
    (- ({cpe1} > {cpe2}) -).

    To decide which command parser error is a more specific error if possible (this is CantSee):
        now remember where the typo's at is where the previous typo's at;
        if the scope decider is not currently blank:
            now the context that this noun didn't make sense within is the scope decider;
            decide on the noun did not make sense in that context error;
        decrement the parser's current word position;
        let the word be the next word;
        if the word is the pronoun used:
            now the word is the next word if any;
            decrement the parser's current word position;
            if the word is no more words left to parse or the (the understood command's current position) element of the grammar line tokens is not the end of line token:
                split the (the understood command's current position - 1) element of the grammar line tokens into the current grammar token & current token type;
                if the current token type is either '<description of values>' or '<adjective>':
                    if it's more specific decide on the referred to a determination of scope error;
                    now the saved pronoun used is the pronoun used;
                    now the saved pronoun reference object is the pronoun reference object;
                    if it's more specific decide on the can’t see it at the moment error;
        if it's more specific decide on the can’t see any such thing error;
        otherwise decide on the latest parser error.

    [ CantSee i w e;

    if (scope_token ~= 0) {
    scope_error = scope_token; return ASKSCOPE_PE;

    wn--; w = NextWord();
    e = CANTSEE_PE;
    if (w == pronoun_word) {
            w = NextWordStopped(); wn--;
            if ((w == -1) || (line_token-->(pcount) ~= ENDIT_TOKEN)) {
                !DebugToken(pcount-1); print " ", found_ttype, "^";
                if (found_ttype == ROUTINE_FILTER_TT or ATTR_FILTER_TT)
                    e = NOTINCONTEXT_PE;
                else {
                    pronoun__word = pronoun_word;
                    pronoun__obj = pronoun_obj;
                    e = ITGONE_PE;

    if (etype > e) return etype;
    return e;