public static String readSqlCmdTemplateVariable(String template, int start, int end, Object [] MV_returnarray) {
    { int cursor = start;
      boolean escapedP = false;

      if ((cursor >= end) ||
          (!(template.charAt(cursor) == '{'))) {
      }
      else {
        loop000 : while (cursor < end) {
          { char c = template.charAt(cursor);

            if (c == '\\') {
              escapedP = true;
              cursor = cursor + 1;
            }
            else if (c == '}') {
              break loop000;
            }
            else {
            }
            cursor = cursor + 1;
          }
        }
        if (cursor < end) {
          if (escapedP) {
            { String _return_temp = Stella.unescapeTokenString(Native.string_subsequence(template, start + 1, cursor), '\\', false);

              MV_returnarray[0] = IntegerWrapper.wrapInteger(cursor + 1);
              return (_return_temp);
            }
          }
          else {
            { String _return_temp = Native.string_subsequence(template, start + 1, cursor);

              MV_returnarray[0] = IntegerWrapper.wrapInteger(cursor + 1);
              return (_return_temp);
            }
          }
        }
      }
      { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

        {
          stream000.nativeStream.println("Illegal template variable syntax at position `" + cursor + "' in");
          stream000.nativeStream.println();
          stream000.nativeStream.print("    `" + template + "'");
        }
;
        throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
      }
    }
  }