docs: private void processSource(Context cx, String filename)
      {
          if (filename == null) {
              BufferedReader in = new BufferedReader
                  (new InputStreamReader(System.in));
              String sourceName = "<stdin>";
              int lineno = 1;
              boolean hitEOF = false;
              do {
                  int startline = lineno;
                  System.err.print("js> ");
                  System.err.flush();
                  try {
                      String source = "";
                      // Collect lines of source to compile.
                      while(true) {
                          String newline;
                          newline = in.readLine();
                          if (newline == null) {
                              hitEOF = true;
                              break;
                          }
                          source = source + newline + "\n";
                          lineno++;
                          // Continue collecting as long as more lines
                          // are needed to complete the current
                          // statement.  stringIsCompilableUnit is also
                          // true if the source statement will result in
                          // any error other than one that might be
                          // resolved by appending more source.
                          if (cx.stringIsCompilableUnit(source))
                              break;
                      }
                      Object result = cx.evaluateString(this, source,
                                                        sourceName, startline,
                                                        null);
                      if (result != Context.getUndefinedValue()) {
                          System.err.println(Context.toString(result));
                      }
                  }
                  catch (WrappedException we) {
                      // Some form of exception was caught by JavaScript and
                      // propagated up.
                      System.err.println(we.getWrappedException().toString());
                      we.printStackTrace();
                  }
                  catch (EvaluatorException ee) {
                      // Some form of JavaScript error.
                      System.err.println("js: " + ee.getMessage());
                  }
                  catch (JavaScriptException jse) {
                      // Some form of JavaScript error.
                      System.err.println("js: " + jse.getMessage());
                  }
                  catch (IOException ioe) {
                      System.err.println(ioe.toString());
                  }
                  if (quitting) {
                      // The user executed the quit() function.
                      break;
                  }
              } while (!hitEOF);
              System.err.println();
          } else {
              FileReader in = null;
              try {
                  in = new FileReader(filename);
              }
              catch (FileNotFoundException ex) {
                  Context.reportError("Couldn't open file \"" + filename + "\".");
                  return;
              }
  
              try {
                  // Here we evalute the entire contents of the file as
                  // a script. Text is printed only if the print() function
                  // is called.
                  cx.evaluateReader(this, in, filename, 1, null);
              }
              catch (WrappedException we) {
                  System.err.println(we.getWrappedException().toString());
                  we.printStackTrace();
              }
              catch (EvaluatorException ee) {
                  System.err.println("js: " + ee.getMessage());
              }
              catch (JavaScriptException jse) {
                  System.err.println("js: " + jse.getMessage());
              }
              catch (IOException ioe) {
                  System.err.println(ioe.toString());
              }
              finally {
                  try {
                      in.close();
                  }
                  catch (IOException ioe) {
                      System.err.println(ioe.toString());
                  }
              }
          }
      }