* @param type
   * @param module
   * @param environment
   * @return Stella_Object
   */
  public static Stella_Object stringToObject(String string, LogicObject type, Module module, Environment environment) {
    { Module mdl000 = module;
      Context cxt000 = mdl000;

      if (mdl000 == null) {
        mdl000 = ((Module)(Stella.$MODULE$.get()));
        cxt000 = ((Context)(Stella.$CONTEXT$.get()));
      }
      { Object old$Module$000 = Stella.$MODULE$.get();
        Object old$Context$000 = Stella.$CONTEXT$.get();

        try {
          Native.setSpecial(Stella.$MODULE$, mdl000);
          Native.setSpecial(Stella.$CONTEXT$, cxt000);
          environment = environment;
          synchronized (Logic.$POWERLOOM_LOCK$) {
            { Stella_Object obj = Stella.readSExpressionFromString(string);

              if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(obj), Logic.SGT_STELLA_LITERAL_WRAPPER)) {
                { LiteralWrapper obj000 = ((LiteralWrapper)(obj));

                  if (type == null) {
                    return (obj000);
                  }
                  { Surrogate testValue000 = Stella_Object.safePrimaryType(obj000);

                    if (Surrogate.subtypeOfStringP(testValue000)) {
                      { StringWrapper obj001 = ((StringWrapper)(obj000));

                        if (NamedDescription.subrelationOfP(((NamedDescription)(type)), PLI.$STRING_CONCEPT$)) {
                          return (obj001);
                        }
                        else {
                          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

                            stream000.nativeStream.print("String argument found, but `" + type + "' is not a subconcept of `" + PLI.$STRING_CONCEPT$ + "'");
                            throw ((ParsingError)(ParsingError.newParsingError(stream000.theStringReader()).fillInStackTrace()));
                          }
                        }
                      }
                    }
                    else if (Surrogate.subtypeOfIntegerP(testValue000)) {
                      { IntegerWrapper obj001 = ((IntegerWrapper)(obj000));

                        if (NamedDescription.subrelationOfP(((NamedDescription)(type)), PLI.$INTEGER_CONCEPT$)) {
                          return (obj001);
                        }
                        else if (NamedDescription.subrelationOfP(((NamedDescription)(type)), PLI.$FLOAT_CONCEPT$)) {
                          return (FloatWrapper.wrapFloat(((double)(obj001.wrapperValue))));
                        }
                        else {
                          return (PLI.getObject(string, module, environment));
                        }
                      }
                    }
                    else if (Surrogate.subtypeOfFloatP(testValue000)) {
                      { FloatWrapper obj001 = ((FloatWrapper)(obj000));

                        if (NamedDescription.subrelationOfP(((NamedDescription)(type)), PLI.$FLOAT_CONCEPT$)) {
                          return (obj001);
                        }
                        else {
                          return (PLI.getObject(string, module, environment));
                        }
                      }
                    }
                    else {
                      { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

                        stream001.nativeStream.print("`" + testValue000 + "' is not a valid case option");
                        throw ((StellaException)(StellaException.newStellaException(stream001.theStringReader()).fillInStackTrace()));
                      }
                    }
                  }
                }
              }
              else {
                if (type == null) {
                  return (PLI.getObject(string, module, environment));
                }
                else if (NamedDescription.subrelationOfP(((NamedDescription)(type)), PLI.$STRING_CONCEPT$)) {
                  return (StringWrapper.wrapString(string));
                }
                else if (NamedDescription.subrelationOfP(((NamedDescription)(type)), PLI.$LITERAL_CONCEPT$)) {
                  { OutputStringStream stream002 = OutputStringStream.newOutputStringStream();

                    stream002.nativeStream.print("`" + string + "' is a non-literal, but `" + type + "' is a subconcept of `" + PLI.$LITERAL_CONCEPT$ + "'");
                    throw ((ParsingError)(ParsingError.newParsingError(stream002.theStringReader()).fillInStackTrace()));
                  }
                }
                else {
                  return (PLI.getObject(string, module, environment));
                }
              }
            }
          }

        } finally {
          Stella.$CONTEXT$.set(old$Context$000);
          Stella.$MODULE$.set(old$Module$000);
        }
      }
    }
  }