public static PartialMatchFrame makePartialMatchFrame(QueryIterator query) {
    { GeneralizedSymbol matchmode = ((GeneralizedSymbol)(query.options.lookup(Logic.KWD_MATCH_MODE)));
      ControlFrame frame = query.baseControlFrame;
      Keyword kind = frame.state;

      if (matchmode == null) {
        matchmode = Logic.$PARTIAL_MATCH_MODE$;
      }
      if ((matchmode == Logic.KWD_BASIC) ||
          (matchmode == Logic.KWD_INCREMENTAL)) {
        return (IncrementalPartialMatch.newIncrementalPartialMatch(kind, frame));
      }
      else if ((matchmode == Logic.KWD_NN) ||
          (matchmode == Logic.KWD_NEURAL_NETWORK)) {
        return (NnPartialMatch.newNnPartialMatch(kind, frame));
      }
      else {
        { Stella_Object renamed_Class = null;
          String classname = matchmode.symbolName + "-PARTIAL-MATCH";

          { Module temp000 = matchmode.homeModule();

            { Module module = ((temp000 != null) ? temp000 : ((Module)(Stella.$MODULE$.get())));

              { Object old$Module$000 = Stella.$MODULE$.get();
                Object old$Context$000 = Stella.$CONTEXT$.get();

                try {
                  Native.setSpecial(Stella.$MODULE$, module);
                  Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
                  renamed_Class = Stella.string_lookupClass(classname);
                  if (renamed_Class == null) {
                    renamed_Class = Stella.string_getObject(classname, null);
                  }

                } finally {
                  Stella.$CONTEXT$.set(old$Context$000);
                  Stella.$MODULE$.set(old$Module$000);
                }
              }
              if ((renamed_Class != null) &&
                  Stella_Object.isaP(renamed_Class, Logic.SGT_STELLA_CLASS)) {
                return (((PartialMatchFrame)(Surrogate.createObject(((Stella_Class)(renamed_Class)).classType, Cons.cons(Logic.KWD_CONTROL_FRAME, Cons.cons(frame, Cons.cons(Logic.KWD_KIND, Cons.cons(kind, Stella.NIL))))))));
              }
              else {
                { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

                  { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();

                    try {
                      Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
                      stream000.nativeStream.println("PARSING ERROR: Unknown partial match mode: `" + matchmode + "'.");
                      Logic.helpSignalPropositionError(stream000, Logic.KWD_ERROR);

                    } finally {
                      Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
                    }
                  }
                  throw ((ParsingError)(ParsingError.newParsingError(stream000.theStringReader()).fillInStackTrace()));
                }
              }
            }
          }
        }
      }
    }
  }