/**
   * Runs a BeanShell script. Errors are passed to the caller.
   *
   * <p>If the <code>in</code> parameter is non-null, the script is read from that stream; otherwise
   * it is read from the file identified by <code>path</code> .
   *
   * <p>The <code>scriptPath</code> BeanShell variable is set to the path name of the script.
   *
   * @param path The script file's VFS path.
   * @param in The reader to read the script from, or <code>null</code> .
   * @param namespace The namespace to run the script in.
   * @exception Exception instances are thrown when various BeanShell errors occur
   * @since jEdit 4.2pre5
   */
  public void _runScript(String path, Reader in, NameSpace namespace) throws Exception {
    log.info("Running script " + path);

    Interpreter interp = createInterpreter(namespace);

    try {
      if (in == null) {
        in = res.getResourceAsReader(path);
      }

      setupDefaultVariables(namespace);
      interp.set("scriptPath", path);

      running = true;

      interp.eval(in, namespace, path);
    } catch (Exception e) {
      unwrapException(e);
    } finally {
      running = false;

      try {
        // no need to do this for macros!
        if (namespace == global) {
          resetDefaultVariables(namespace);
          interp.unset("scriptPath");
        }
      } catch (EvalError e) {
        // do nothing
      }
    }
  } // }}}
  /**
   * Evaluates the specified BeanShell expression. Unlike <code>eval()</code> , this method passes
   * any exceptions to the caller.
   *
   * @param namespace The namespace
   * @param command The expression
   * @return Description of the Return Value
   * @exception Exception instances are thrown when various BeanShell errors occur
   * @since jEdit 3.2pre7
   */
  public Object _eval(NameSpace namespace, String command) throws Exception {
    Interpreter interp = createInterpreter(namespace);

    try {
      setupDefaultVariables(namespace);
      if (log.isDebugEnabled()) {
        log.debug("Running script: " + command);
      }
      return interp.eval(command);
    } catch (Exception e) {
      unwrapException(e);
      // never called
      return null;
    } finally {
      // try {
      resetDefaultVariables(namespace);
      // }
      // catch (UtilEvalError e) {
      // do nothing
      // }
    }
  } // }}}